Daily Rain

218 views
Skip to first unread message

Craig Young

unread,
Sep 29, 2023, 7:37:58 PM9/29/23
to weewx-user
My station (hardware) sends both rain (amount since last report) and daily rain (accumulates rain).  Currently I am mapping rain to rain in the database and daily rain to signal3 in the database because I could not find any 'dayRain' field.  When I run weewx the Season report shows the correct rain, as reported by the station, but sets Rain Today the same as rain.
If I want the Seasons report to show the correct daily rain (from the hardware) where should I place it in the DB and do I need to change weewx.conf or skin.conf to use the value?

Craig

Tom Keffer

unread,
Sep 29, 2023, 8:28:27 PM9/29/23
to weewx...@googlegroups.com
I don't know exactly what you mean when you say your rain is the "amount since last report." The field "rain" should be the amount of rain that fell during the archive period, so perhaps that's what you're already doing.

You say, "... the Season report shows the correct rain, as reported by the station, but sets Rain Today the same as rain." 

I'm not sure what you mean by that. The "Rain Today" is the sum of rain since midnight, not the rain during the current archive period. If what you mean is that it's not the same as what is being emitted by your hardware as "signal3" (aka "dayRain"), it should be. If not, there's something wrong in the calculation that derives the field "rain" from "signal3".

Nevertheless, if you want to display exactly what is being emitted by your hardware, that's simple enough. Just use $current.signal3. But, be sure your hardware is emitting what you think it's emitting. Is it "rain since midnight"? Or, "rain over the last 24 hours"? 

Final comment: to avoid confusing yourself, why not just use the field name "dayRain" instead of "signal3"? I know it's not in the database, but new fields are super easy to add:

wee_database --add-column=dayRain

-tk

--
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/05844ab4-75a0-435a-a2dd-d85a5ec95d02n%40googlegroups.com.

gjr80

unread,
Sep 29, 2023, 8:57:19 PM9/29/23
to weewx-user
Given a number of previous threads by the OP related to writing a driver, this could be a report issue or a driver issue. Tom covered off the report issue, but if it is a driver issue then it could be a case of garbage in = garbage out. Your driver should be emitting loop packets and the rain field in each loop packet must be the rainfall seen by the station since the last loop packet. Provided you do this WeeWX will accumulate these loop packet rain values and emit the total rain for the archive period in an archive packet. This is the data you will see stored in the database (appropriately converted given the loop packet unit system and database unit system). Once you know your incoming data is good then I would be worrying about what is appearing in reports.

One other thing, if comparing WeeWX 'day rainfall' to a station provided equivalent remember that WeeWX calculates the 'day rainfall' value from the rain data it has seen on that day, so if you start WeeWX part way through the day and there was rainfall earlier in the day then the WeeWX calculated total will almost certainly be less than the station provided day rainfall value.

Gary

Craig Young

unread,
Sep 29, 2023, 11:13:16 PM9/29/23
to weewx-user
The 'rain' observation value passed in the loop packet is the amount of rain accumulated by the sensor since the last loop report.
Sensor: accumulated rain since last loop report) ---> Database: field 'rain'

The 'signal3' observation value passed in the loop packet is the amount of rain accumulated by the sensor since midnight (the 'midnight' of the data logger).
Sensor: accumulated rain since midnight ---> Database: field 'signal3'

Rain Rate is calculated in software: weewx.conf|[StdWXCalculate]|[[Calculations]]|rainRate = software

So on the Seasons report, Current conditions:

Rain Today: 0.0mm
Rain Rate: 0.0 mm/hr

There is a single record in the Database (due to testing and clearing after each test).  The fields have:

rain: 0.0
rainRate: 0.0
signal3: 17.87

This is because it was not raining during the testing period, but was raining early this morning.  That is why 0 for both rain and rainRate.  But signal3 has a value of 17.87 mm, the daily rain accumulated since midnight.  So on the seasons report it should look like this:

Rain Today: 17.87 mm
Rain Rate: 0.0 mm/hr

Reading through the documentation I saw several references to the term 'dayRain'.  So I assumed that was either a constant in weewx or a database field, whether hardware or software derived.  I could not find 'dayRain' in the database so I posted this query to make sure.  My question then is do I make one change to weewx.conf so that all reports will use signal3 as the daily rain amount, or do I need to go to each report and change them individually.

"Just use $current.signal3"
Do I put this in the weewx.conf file or in the Season skin.conf file?


Craig

gjr80

unread,
Sep 30, 2023, 12:22:20 AM9/30/23
to weewx-user
So if I understand correctly, WeeWX has not seen any rain so any rain or rain rate fields in the database are zero. This sounds correct. Your station/driver is passing through a field that contains the rain since midnight, that is being saved in WeeWX field signal3 and your site is displaying the correct value. Sounds like everything is operating as expected.

As an aside, I am not sure which documentation contained reference to 'dayRain', as far as I can tell the only occurrence of 'dayRain' in the WeeWX documentation is in the wee_import section of the Utilities Guide, and I hope you are not using wee_import to feed WeeWX.

Some stations/drivers may emit a field named dayRain that (usually) contains the rainfall seen by the station hardware (but not necessarily WeeWX) since midnight. Some stations also emit other cumulative rain fields such as monthRain, yearRain etc. If the driver passes such a field to WeeWX in a loop packet WeeWX will 'accumulate' the data and make the field available in archive records. The field in the current archive record is then available in reports via a tag something like $current.dayRain. Since the dayRain field is not in the database schema it is not saved to database (WeeWX rule of thumb: if a field exists in an archive record and the same field exists in the database WeeWX will automatically save the field to database, if either of these conditions is not met the field is not saved). In your case you have put the dayRain data in another field (signal3) that does exist in the database, so the data is saved to database albeit under a different name.

The reason that WeeWX does not have a field dayRain (or weekRain or monthRain etc) in the schema is because WeeWX rainfall data is saved in the field rain and saving both rain and dayRain (under any name) is really saving the same data twice. Some drivers may use the dayRain (or weekRain or monthRain etc) field to calculate the rain field (rain = the current dayRain value - the previous dayRain value) and some drivers will pass the dayRain value to WeeWX in a loop packet, but the norm is to not save dayRain to database.

If you use dayRain/signal3 you need to setup units groups/formats/unit labels for the field, alter the Seasons template to display your field and after the current day (where WeeWX did not see some earlier rainfall) you won't notice the difference. At the end of the day (no pun intended), what you choose to display on your site is personal choice, if it was me I would be using the standard Seasons skin and avoid looking at the page for the rest of the day :)

Gary

Reply all
Reply to author
Forward
0 new messages