Page 1 sur 3

Créer une table avec les heures ensoleillement

Posté : 12 janv. 2015, 23:29
par Météo Villarzel
Voilà un petit tuto pour créer une table supplémentaire avec les heures d'ensoleillement, le rainrate maxi, le THSW min et max et le THW min et max.
Ce script à été réalisé par Pidou de http://www.meteo-pont-salomon.fr/
Un grand merci à lui.

Premièrement, télécharger cette archives http://www.boock.ch/meteo/sauv-donnees/ ... esdata.zip

L'archive comprends 3 fichiers
Autresdata.sql
CreationAutresdata.php
Autresdata.php

Premièrement vous devez exécuter une requête SQL depuis votre base de données principale crée par VP2SQL (data) avec le contenu du fichier Autresdata.sql
autresdata1.jpg
Maintenant vous devez avoir une nouvelle table nommée Autresdata, comme ci dessous
autresdata2.jpg
Ensuite vous devez modifier les deux fichiers php, en mettant le lien vers votre fichier de connexion à la BDD

Dans le fichier CreationAutresdata.php vous devez aussi indiquer ligne 22 et 23 le début de vos enregistrements (tstamp) http://www.timestamp.fr/ ce n'est pas obligé d'indiquer le premier enregistrement, moi par exemple j'ai une VP2 depuis mars 2012, donc j'ai mis ça comme date de départ, les enregistrements sans valeurs de la radiation solaire ne servent à rien.
autresdata3.jpg
Il faut maintenant uploader vos deux fichiers php sur votre serveur, et lancer le fichier CreationAutresdata.php depuis un navigateur.
Suivant vos données et votre vitesse de connexion, ça va prendre quelques dizaines de minutes pour construire la base avec vos données.
A la fin vous devez avoir ça,
autresdata4.jpg
Votre base de données est à jour avec les enregistrements déjà présents dans votre base de données, maintenant vous devez créer un CRON pour exécuter le fichier Autresdata.php à intervalle régulier, par exemple toutes les 30 minutes, ou n'importe quelle autre fréquence.

Il ne vous reste plus qu'a faire vos graphique avec cette nouvelle table.
Par exemple
http://www.boock.ch/meteo/heures_ensoleillement.php

A+

Re: Créer une table avec les heures ensoleillement

Posté : 13 janv. 2015, 07:54
par PascalWMR
Salut Pierre-André
Premièrement, télécharger cette archives http://www.boock.ch/meteo/graphiques_dy ... minmax.php
Trop top ten ton tuto. Encore une fois merci.

Mais bon il y a un cafard dans le lien de téléchargement de l'archive :roll:

A+
Pascal

Re: Créer une table avec les heures ensoleillement

Posté : 13 janv. 2015, 08:55
par Météo Villarzel
Oups :mrgreen:
C'est corrigé.

A+

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 17:45
par Javier
Saludos

Félicitations à Pierre-André et Pidou pour ce grand travail. :D
Il fonctionne très bien, sauf pour redémarrer toutes les quelques secondes, la direction CreationAutresdata.php que la mise à jour de la table se arrête.
Est-il normal?

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 18:23
par Javier
La mise à jour a été définitivement arrêté à la date 201212090000

Le message d'erreur est:

Code : Tout sélectionner

Undefined variable: UTC_min_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_min_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: tstamp_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: UTC_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: tstamp_min_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: UTC_min_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_min_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: tstamp_max_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: UTC_max_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_max_THSW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: tstamp_min_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: UTC_min_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_min_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: tstamp_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: UTC_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Notice: Undefined variable: TZ_max_THW in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 92 PHP Fatal error: Maximum execution time of 60 seconds exceeded in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php on line 41 

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 18:29
par Météo Villarzel
Salut Javier

le problème viens de ton hébergeur qui n'accepte pas les requêtes de plus de 60 secondes

Fatal error: Maximum execution time of 60 seconds exceeded in H:\webspace\hostings\kocher.es\hosting\www\graficos-highcharts\CreationAutresdata.php

Mois j'ai du relancer seulement 2 fois le script pour 3 ans de données.

Tu peux faire un CRON toutes les 5 minutes pour cette tâche; ça devrait fonctionner

A+

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 20:21
par Javier
Tu avez raison
Je ai contacté mon hébergement et, en fait, le problème vient autour.
Maintenant, je essaie de trouver une solution.

Infiniment reconnaissant :D

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 20:36
par Météo Villarzel
Normalement tu doit pouvoir faire un CronJob chez ton hébergeur,

Mais il y a aussi ce site qui permet de faire des CRON gratuitement http://www.cronjobonline.com
cron.jpg
A+

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 21:36
par Javier
La solution a été modifié dans le fichier php.ini de mon hébergement, la valeur:
max_execution_time = 60
la nouvelle valeur (6000)

Ce est maintenant le tableau complété :D

Maintenant, je dois mettre une cronjob dans l'hébergement pour exécuter le fichier Autresdata.php à intervalle régulier.

Muchas gracias por tu ayuda :D

Re: Créer une table avec les heures ensoleillement

Posté : 14 janv. 2015, 22:00
par muchistic
Merci beaucoup pour le super tuto :D . la table c'est bien crée et les données y sont :)
un petit soucis tout de même ou plutôt la peur de faire une boulette, j'ai regardé sur KréativMédia et j'ai un peu de mal pour créer un Cron, un peu d'aide serait la bienvenue :)
cron.JPG