Page 1 of 1

More rainfall data

Posted: Thu Nov 12, 2009 9:39 pm
by markhiseman
Hi Boris,

You've added some good WDL updates recently, especially the moon phase/rise/set feature.

Please could I ask for one more update: to add the following information to the clientrawextra.txt file:

Field #482: Days since last rain
Field #534: Yesterday rain (mm)

Info taken from the WDL parser at http://www.tnetweather.com/wd-parser.php

WD Live will display this information on the 'live' screen if it is provided.

It's about the only 'live' data that Meteohub does not currently provide, so it would be a good addition.

Many thanks as always,

Mark.

Re: More rainfall data

Posted: Wed Feb 02, 2011 4:45 pm
by markhiseman
Thank you Boris. I see that 4.7 includes the 'Yesterday's rain' feature.

'Days since last rain' does not seem to be implemented yet. Hopefully this can be added when you have time.

Mark.

Re: More rainfall data

Posted: Wed Feb 02, 2011 6:49 pm
by YJB
Not sure what you are trying to do, but this is the code that I'm using in my testtags.php script:

Code: Select all

// Fetch daily rain_array, this starts with yesterday
$rain_day_string = "[seqday1_rain0_total_mm]";
$rain_day_array = explode(" ", $rain_day_string);
// Need to insert todays rain at the start of the array
array_unshift($rain_day_array,"[day1_rain0_total_mm]");

// Now find the 1st non 0.00 day
while ($rain = current($rain_day_array)) {
    if ($rain != 0.00) break;
next ($rain_day_array);
 }
$dayswithnorain = key($rain_day_array);
//
//get timestamp for the last recorded rain
$rain_time = strtotime("-".$dayswithnorain." day");
//format the date using the timestamp generated
$dateoflastrainalways = date("d/m/Y", $rain_time);
Hope this helps,
Ysbrand