Is it possible to get this info from weewx? Has anyone done this? I have read a fair amount of the docs and wiki and haven't found anything yet. Please feel free to point me in the right direction bearing in mind I don't know python (simple BASH scripts are about my limit).Temp. C Humidity % Pressure hPa Rain mm Wind km/h UV max min avg max min avg max min avg fall rate avg max dir 2015/03/11 20 24.7 23.4 24.0 25% 23% 24% 1021 1021 1021 0.0 0.0 0.0 2.5 E - 2015/03/11 19 29.6 25.6 27.7 22% 15% 18% 1020 1020 1020 0.0 0.0 3.7 14.8 S - 2015/03/11 18 31.1 30.0 30.6 15% 12% 14% 1020 1019 1019 0.0 0.0 10.1 24.5 SSW - 2015/03/11 17 31.7 31.0 31.3 13% 12% 12% 1020 1019 1019 0.0 0.0 13.0 28.1 SW - 2015/03/11 16 32.7 31.4 32.0 13% 11% 12% 1020 1020 1020 0.0 0.0 11.2 30.6 WSW -
Is it possible to get this info from weewx? Has anyone done this? I have read a fair amount of the docs and wiki and haven't found anything yet. Please feel free to point me in the right direction bearing in mind I don't know python (simple BASH scripts are about my limit).
Why do I need daily summaries? I am a farmer. When I spray herbicides or pesticides I am legally required to record the weather conditions at the beginning and end of the spraying run (temp, humidity, wind speed, wind max and direction).
Wow - what an interesting use of a weather station.What you're asking for is almost certainly in your weewx data, but I sounds like you want something notionally like the NOAA reports (only hourly, not daily). Has to be doable.
#!/bin/bash# of course pass this inday="2015-03-11"for (( num=0; num<=23; num++ ))do# secs since epoch for start/stop of hour
t1=`date +%s -d "$day $num:00:00"`t2=`date +%s -d "$day $num:59:59"`# uncomment to print seconds since epoch for that hour of the day# echo "$day $num start=$t1 stop=$t2"# print min/max outTemp during that time period
# prettying it up is an exercise for the reader
echo "select datetime(min(dateTime),'unixepoch','localtime'),min(outTemp),max(outTemp) from archive where dateTime>=$t1 and dateTime<=$t2;" | sqlite3 weewx.sdbdone
2015-03-11 00:00:00|42.0551975560537|46.64533321483312015-03-11 01:00:00|47.0762391691158|51.86258061261242015-03-11 02:00:00|52.2965302510594|56.95289621970212015-03-11 03:00:00|57.360316591589|61.56938343962332015-03-11 04:00:00|61.9225095199|65.39743629744442015-03-11 05:00:00|65.6722031273085|68.17617931706122015-03-11 06:00:00|68.3538619911312|69.71624575377682015-03-11 07:00:00|69.7847354914492|69.99924345253752015-03-11 08:00:00|68.7521030826112|69.86731196384632015-03-11 09:00:00|66.3135987044488|68.59596395819282015-03-11 10:00:00|62.7633495340748|66.05733174007182015-03-11 11:00:00|58.3432991853859|62.42441889986032015-03-11 12:00:00|53.3546667851669|57.94480244394632015-03-11 13:00:00|48.1374193873876|52.92376083088432015-03-11 14:00:00|43.0471037802979|47.70346974894062015-03-11 15:00:00|38.4306165603767|42.63968340841112015-03-11 16:00:00|34.6025637025556|38.07749048012015-03-11 17:00:00|31.8238206829388|34.32779687269152015-03-11 18:00:00|30.2837542462232|31.64613800886892015-03-11 19:00:00|30.0007565474626|30.21526450855082015-03-11 20:00:00|30.1326880361536|31.24789691738882015-03-11 21:00:00|31.4040360418072|33.68640129555122015-03-11 22:00:00|33.9426682599282|37.23665046592522015-03-11 23:00:00|37.5755811001397|41.6567008146141
Thanks for that vince. That certainly gives me something to work from.
I haven't looked at the structure of weewx yet, I wonder could you or anybody point me to the section of code that creates the monthly summary. This produces a nice table of figures for a selected month on a day by day basis. I wonder could I modifiy this to produce figures for a selected day on an hour by hour basis. If that worked then I would want to be able to select any date in the past that I had records for.
the easiest thing would be to iterate over the hours using the $day tag. unfortunately, the $day tag is not yet iterable :(
however, you might be able to use the hours_ago tag instead (see the 'aggregation periods' section of the guide)
On Thursday, March 12, 2015 at 7:38:58 PM UTC-7, mwall wrote:I did take a brief look at hours_ago to try to have cheetah do the heavy lifting, but I thought that it would be tough to retroactively calculate the hourly info for a day in the distant past, especially since even the brute-force method I did as a quickie ran so quickly. Also looked at the tags.py code to try to extend it with something like hour_of_day(day_here,hour_here) or the like, but ran out of energy mentally.
And....I'm not in the US and it just occurred to me - I also need to convert the database query into metric :P...it's rapidly getting too hard for me :)
So my understanding is that even though it is a reasonably simple database query to get the info I need, the problem is that there are no tags within Weewx (yet) that can get that particular query from the database (to put it very simply)? And any past selectable dates need to be converted to Unix epoch obviously? I'll see if I can blunder my way through tags.py and figure out anything. Thanks again.
#!/bin/bash# of course pass this inday="2015-03-11"
database="/home/weewx/archive/weewx.sdb"
for (( num=0; num<=23; num++ ))do# secs since epoch for start/stop of hourt1=`date +%s -d "$day $num:00:00"`t2=`date +%s -d "$day $num:59:59"`# uncomment to print seconds since epoch for that hour of the day# echo "$day $num start=$t1 stop=$t2"# print min/max outTemp during that time period# prettying it up is an exercise for the reader
echo "select datetime(min(dateTime),'unixepoch','localtime') \,max(outTemp),min(outTemp),avg(outTemp) \,max(outHumidity),min(outHumidity),avg(outHumidity) \,max(pressure),min(pressure),avg(pressure) \,total(rain),max(rainRate) \,avg(windSpeed), max(windGust), avg(windDir) \from archive where dateTime>=$t1 and dateTime<=$t2;" | sqlite3 $databasedone
Can you run the script above and see if the units look right for what you want to do ?
<html>
<body>
<table border="0" cellspacing="10">
<tr>
<td align="center">Time</td>
<td align="center">Temp C</td>
<td align="center">Pressure hPa</td>
<td align="center">Humidity %</td>
<td align="center">Average<br>Wind Speed km/h</td>
<td align="center">Average<br> Wind Gust km/h</td>
<td align="center">Average<br> Wind Direction deg</td>
<td align="center">Total rain mm</td>
</tr>
<?php
//Open the weewx database
$db = new SQLite3('/var/lib/weewx/weewx.sdb');
date_default_timezone_set('Australia/NSW');
// find the unix timestamp for a given date
$unixtime = strtotime('2015/03/28');
// set the unix timestamp start and end times for each hour of the day and then advance 1 hour (3600 seconds)
for($t=0;$t<=23;$t++)
{
$starttime = $unixtime + ($t*3600);
$endtime = $unixtime + 3600 + ($t*3600);
//then make the query
$results = $db->query("SELECT datetime(min(dateTime), 'unixepoch', 'localtime'), avg(outTemp), avg(pressure), avg(outHumidity), avg(windSpeed), avg(windGust), avg(windDir), total(rain) FROM archive WHERE dateTime>= $starttime and dateTime<= $endtime;");
//get the row of results and put it in an array
$row = $results->fetchArray();
//convert the US values to metric if necessary and round to one or zero decimal places then print
echo "<tr><td align=\"center\"> $row[0]</td>";
$metTemp = round(($row[1] -32)*5/9, 1);
echo "<td align=\"center\">$metTemp</td>";
$metPress = round($row[2]*33.86389+25.3, 1);
echo "<td align=\"center\">$metPress</td>";
$humid = round($row[3], 1);
echo "<td align=\"center\">$humid</td>";
$metWind = round($row[4]*1.60934, 1);
echo "<td align=\"center\">$metWind</td>";
$metGust = round($row[5]*1.60934, 1);
echo "<td align=\"center\">$metGust</td>";
$windDir = round($row[6], 0);
echo "<td align=\"center\">$windDir</td>"; //wind direction degrees
$metRain = round($row[7]*25.4, 0);
echo "<td align=\"center\">$metRain</td></tr>";
}
?>
</table>
</body>
</html>
// find the unix timestamp for a given date
$unixtime = strtotime('2015/03/28');
// set the unix timestamp start and end times for each hour of the day and then advance 1 hour (3600 seconds)
for($t=0;$t<=23;$t++)
{
$starttime = $unixtime + ($t*3600);
$endtime = $unixtime + 3600 + ($t*3600);
//then make the query
$results = $db->query("SELECT
datetime(min(dateTime), 'unixepoch', 'localtime'), avg(outTemp),
avg(pressure), avg(outHumidity), avg(windSpeed), avg(windGust),
avg(windDir), total(rain) FROM archive WHERE dateTime>= $starttime
and dateTime<= $endtime;");
Here's what it looks like if anyone's interested:
Hi All,
I have weewx up and running for testing with a Fine Offset station (soon to be updated to Davis). It seems like a good stable system and I would like to move permanently to weewx but I need a daily summary of my weather records with hourly (or more) records similar to the weewx monthly or annual summaries. For example (from my wfrog setup):Temp. C Humidity % Pressure hPa Rain mm Wind km/h UV max min avg max min avg max min avg fall rate avg max dir 2015/03/11 20 24.7 23.4 24.0 25% 23% 24% 1021 1021 1021 0.0 0.0 0.0 2.5 E - 2015/03/11 19 29.6 25.6 27.7 22% 15% 18% 1020 1020 1020 0.0 0.0 3.7 14.8 S - 2015/03/11 18 31.1 30.0 30.6 15% 12% 14% 1020 1019 1019 0.0 0.0 10.1 24.5 SSW - 2015/03/11 17 31.7 31.0 31.3 13% 12% 12% 1020 1019 1019 0.0 0.0 13.0 28.1 SW - 2015/03/11 16 32.7 31.4 32.0 13% 11% 12% 1020 1020 1020 0.0 0.0 11.2 30.6 WSW -
Is it possible to get this info from weewx? Has anyone done this? I have read a fair amount of the docs and wiki and haven't found anything yet. Please feel free to point me in the right direction bearing in mind I don't know python (simple BASH scripts are about my limit).
Why do I need daily summaries? I am a farmer. When I spray herbicides or pesticides I am legally required to record the weather conditions at the beginning and end of the spraying run (temp, humidity, wind speed, wind max and direction). It would be great if I could get weewx to provide that info. Thanks for your help.
Peter
$results = $db->query("SELECT
datetime(min(dateTime), 'unixepoch', 'localtime'), avg(outTemp),
avg(pressure), avg(outHumidity), avg(windSpeed), avg(windGust),
avg(windDir), total(rain) FROM archive WHERE dateTime> $starttime
and dateTime<= $endtime;");
dateTime>= $starttime
.Hi All,
I have weewx up and running for testing with a Fine Offset station (soon to be updated to Davis). It seems like a good stable system and I would like to move permanently to weewx but I need a daily summary of my weather records with hourly (or more) records similar to the weewx monthly or annual summaries. For example (from my wfrog setup):Is it possible to get this info from weewx? Has anyone done this? I have read a fair amount of the docs and wiki and haven't found anything yet. Please feel free to point me in the right direction bearing in mind I don't know python (simple BASH scripts are about my limit).Temp. C Humidity % Pressure hPa Rain mm Wind km/h UV max min avg max min avg max min avg fall rate avg max dir 2015/03/11 20 24.7 23.4 24.0 25% 23% 24% 1021 1021 1021 0.0 0.0 0.0 2.5 E - 2015/03/11 19 29.6 25.6 27.7 22% 15% 18% 1020 1020 1020 0.0 0.0 3.7 14.8 S - 2015/03/11 18 31.1 30.0 30.6 15% 12% 14% 1020 1019 1019 0.0 0.0 10.1 24.5 SSW - 2015/03/11 17 31.7 31.0 31.3 13% 12% 12% 1020 1019 1019 0.0 0.0 13.0 28.1 SW - 2015/03/11 16 32.7 31.4 32.0 13% 11% 12% 1020 1020 1020 0.0 0.0 11.2 30.6 WSW -
Why do I need daily summaries? I am a farmer. When I spray herbicides or pesticides I am legally required to record the weather conditions at the beginning and end of the spraying run (temp, humidity, wind speed, wind max and direction). It would be great if I could get weewx to provide that info. Thanks for your help.
Peter
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/cEAzvxv3T6Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAAraAzgbV0fC_6v5BYXd40WnhRzPf7N5DqpKz5t8XfJ7MuXFWg%40mail.gmail.com.
Have a look at wxobs.
I based that on Powerin's work (they started this thread)
https://github.com/glennmckechnie/weewx-wxobs
On 03/09/2020, Mikael Fredriksson <plig...@gmail.com> wrote:
> were there ever shared a script for this?
> /Mikael
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAAraAziKtCfEpC_bGY0%2B1JeXDMfWGx6KCjUrHJTuzw%3DL%2BEcrHA%40mail.gmail.com.
I did the change and moved those lines to weewx.conf, then I restarted Weewx.
But this doesn't change the values unit. It's still in US unit (F).
I hope that it was clear that I meant the values, not the labels.
I looked at the section How options work in the Customizing Guide that TK pointed at but I can't figure out if that could help me... I feel that it is a little too advanced for me at this point.
This is how it looks in weewx.conf after the change.
[[wxobs]]
HTML_ROOT = /var/www/html/weewx/wxobs
skin = wxobs
report_timing = 0 * * * *
[[[Units]]]
[[[[Groups]]]]
group_rain = mm
group_temperature = degree_C
group_speed = km_per_hour
What else can I provide to get help to sort this out?
/Mikael
I did a test and changed the NTC to FtoC around the 207 line in index.php. And that changed the values in the tables.
Had no idea why the change in skin.conf didn't hit the tables but I now think I know what it was after I looked at the syslog!
These lines,
6 20:29:18 raspberrypi wee_reports[10137] ERROR weewx.reportengine: Failed to read skin configuration file /etc/weewx/skins/wxobs/skin.conf for report 'wxobs': Invalid line (u' Only for the one/s you need.') (matched as neither section nor keyword) at line 207.
Sep 6 20:29:18 raspberrypi wee_reports[10137] ERROR weewx.reportengine: Syntax error: Invalid line (u' Only for the one/s you need.') (matched as neither section nor keyword) at line 207.
Sep 6 20:29:18 raspberrypi wee_reports[10137] ERROR weewx.reportengine: **** Report ignored
...pointed me to a line in skin.conf where I had removed the # in that line.
I think that everything is ok now, I did a test and manually change back the FtoC to NTC and see if they change again at the archive run and they did.
So Glenn, I'm sorry that I missed this and you had to do all that writing, I will definitely first look at my syslog when things don't turn out the way they're expected to do!
Case closed.
/Mikael