problem with winddirection graph and mysqlweather.php

Forum for english speaking users
Répondre
grug

Message par grug »

i am having a problem draewing the wind direction graph, in each graph that is drawed there is only a circle indicating that the wind blew from each direction similarily?(although the measures tell something different)

and if i am trying to update the database via mysqlweather.php nothing happens.
if i truncate the table and run mysqlweather then, everything works fine and is written in the table. i am using the ws3600.
any hints/suggestions?
bye grug
Avatar de l’utilisateur
TiToine
Site Admin
Messages : 3356
Inscription : lun. mars 20, 2006 11:16 am
Localisation : Montréal
Contact :

Message par TiToine »

Hi,

Is your MySQL fields are the same as GW PHP requieres ?

Antoine.
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

Hi Grug,
There should be no limitation on the size of the history.dat file, but it must loaded in the database in the proper record date order, (oldest record first) because there is a checking on the date of the last uploaded record.
If your DB is already populated and you have missing records, i would suggest that you delete all the records. ( delete from ws3600 ) and reload this db.
*You must expect one hour loading for a 2 year history*

I worked on this a fairly long time ago so i don't remember too well the code i wrote, but as far as i remember it was simple.

I have also a small VB prog which loads the same db with a close to synchrone timing. You may try to access my ftp : ftp://meteozoir.-remove this-homeip.net.
If you find any difficulties, let me know by mail, thru this forum.
Rgds
Dernière modification par jturlier le mer. déc. 12, 2007 2:50 pm, modifié 1 fois.
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
Grug

Message par Grug »

Thanks for the fast help.
Right now i I am trying your hint, but it is most likely that you're right because there are already some orphaned datapieces in my history.dat.
i will write right back then and tell you if it worked.
grug
grug

Message par grug »

ok, i have tried it:
i resetted the ws3600, renamed the old history fild and created an new one.
then i uploaded te new history.dat after truncating the table, and everything was writte n into the db.
i then waited for an hour an uploaded a newer history with exactly one enty more (i write them hourly) and it didn't work.
the history.dat is read correctly(e.g. the number of the entries and the date of the first and last entry) but the database wasn't updated.
where could i search the problem, else?
i changed this line

Code : Tout sélectionner

 $date=date("YmdHi", $timest);            // il faut retransformer le format en recdate
to

Code : Tout sélectionner

 $date=date("YmdHis", $timest);            // il faut retransformer le format en recdate
because without the seconds appended thne script wouldn't create a proper graph.
could that cause the problem?
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

No that should not be the pb, except if you did not set the proper format for recdate in GraphWeather. %Y%m%d%H%M for the Mysql pluggin.
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
grug

Message par grug »

i think the problem has to be located somewhere in mysqlweather, hasn't it?

Code : Tout sélectionner

    $buffer=fread ($handle,8); // time stamp is double so read 8 bytes
is there really no problem when io change the timestamp?
in the originalscript de timestamp entries in the db were like

Code : Tout sélectionner

200709141200 (YYYYMMDDhhmm)
with that the graph.php couldn't draw a graph.
i changed mysqlweather so the timestamp was written in

Code : Tout sélectionner

20070914120000 (YYYYMMDDhhmmss)
format.

i just don't know where else to search the problem.
grug
grug

Message par grug »

ok, i found out some more:
with some echoes here:

Code : Tout sélectionner

    $buffer=fread($handle, 8);

                $date=unpack("d",$buffer);
echo $date;echo "|";
                $date=($date[1]-$DELPHI1970)*86400;
				echo $date;echo "|";
                $timest=(($date[1] -$DELPHI1970)*86400); // il faut retransformer le format en recdate
                $date=date("YmdHis", $timest);            // il faut retransformer le format en recdate
echo $date;echo "|";
                $RECORDS_TO_UPDATE++;
i get these interesting dates:
last entry in history.dat: 13/12/07 10:00:00 (correct)
last update of database: 13/12/01 21:45:52 (wrong, month and time are right, but day and year are wrong)
and my selfcreated echoes above say:

Code : Tout sélectionner

 Array|1197536400|19011213214552
as far as i can see there's something wrong with the date, because a date of 12 of January 1901 can't quite be?
where can i find the error that kills the correct date?
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

Good morning Grug,
Find herebelow a link to jpg showing parameters for ws3600 mysql table.
(provided by M. Valin (Boucher), I don't have a WS3600 station)
http://meteozoir.homeip.net/plugin.jpg
don't forget to set format with %Y%m%d%H%M
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

Grug,
Mysqlweather.php just loads the mysql table from history.dat to ws3600 table.
Data in mysql ws3600 table have a recdate (not a timestamp) formated YYYYMMDDHHmm. No seconds are recorded. When using the proper GraphWeather date format, there should be no pb drawing graph in the standard graphweather application.

This table is not supposed to be processed with graphweather.php which has hard coded timestamp format.

That means that if you whish use the php application, you will have to modify the output recdate format in mysqlweather.php.

Date of january 1901 means that date extracted from yr history.dat file is wrong.
You may have ONE missing bit in yr file.

I suggest you use the readhh exec to visualize this file available at :
ftp://meteozoir.homeip.net It should work today (I got a 12 hour ADSL down time yesterday)
Dernière modification par jturlier le jeu. déc. 13, 2007 10:43 am, modifié 1 fois.
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
grug

Message par grug »

perhaps we are talking at cross-purposes?
to avoid misunderstandinsg i tell you what i exactly want to do:
i am using the heavyweather-software to create my history.dat
i transfer that file via ftp to my webspace.
i want to write the data from history.dat into my sql-database using mysqlweather.php
then i want to create the graphs using graphweather.php and graph.php

ok, so far.
things that work:
(uploading the history.dat)
filling the empty sql-table
updating the table (although there are two problems: every row but the first one seems to be updated each time i run the script and the time is one hour differnet from my real time (gmt+1)
the graphs are plot nice, everythiung works here(despite the prevailling wind problem mentioned above).
i shall be happy with that if i get the gmt+1 problem done, and, probably find the script error that always fills the database from scratch except the first row.

but basically it works, so don't bother to find a solution, ylou helped me a lot anyway(although solutions are always welcome;-))

Grug
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

Did you checked in mysql pluggin page "la date inclut le changement d'heure" which means "daylite saving time" on or off ?
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
grug

Message par grug »

i am not using the program itself, but only running the mysqlweather script on my webspace. therefore i can't use that field.
i simply added a correction (-3600) to each function that handles the time and this works.(still the table is always completely updated)
Avatar de l’utilisateur
jturlier
Membre
Messages : 3149
Inscription : mar. août 22, 2006 8:38 am
Localisation : 34410 Sérignan - Languedoc
Contact :

Message par jturlier »

Ok I misread the fact that the date pb is in what is recorded in the table.
There is no time-correction between history.dat and the table maybe heavyweather writes using GMT.
You may apply yr correction on line 120
$timest=(($date[1] -$DELPHI1970)*86400);
by adding the number of seconds representing your time difference.
There is no reload of the table each time the srcipt runs, but it has to read each time the entire file from the beginning because file is sequential and i dont think that a solution exists to read a file from its end.
Jean

Station : VP2 Pro Console Vue + anémomètre à Ultra-sons
Logiciels : Cumulus 1.9.4 + Cumulus2SQL
Serveur local : Apache + MySQL +PHP
PC : W10
Support Audio : FR

http://meteoserignan.ddns.net
Image
"Aide-toi d'abord toi-même et les autres t'aideront ... peut-être"
grug

Message par grug »

ok, thank you so much, i will be running everything as is and look if it wokrs with larger files too.
grug
Répondre