How is calculated rainrate if no rain data before sudden rain.

119 views
Skip to first unread message

wysiwyg

unread,
Jul 28, 2021, 8:10:21 AM7/28/21
to weewx-user
Hi !

I have a situation where I'm not sure about weewx behavior and how to deal with it :-).

I have made my own rain sensors: It reports rain every 2min30 and reports 0mm when there's no rain.
Rainrate calculation is not done and not emitted by the sensor: Weewx has to handle it.

Now come a situation: My sensor crashed yesterday and did not reported anything over the night (it was raining).
I rebooted it a few minutes ago, without power cycle, so I don't loose the rain counter of the night => the sensor sent 21.8mm from the whole night in one shot.

I would expect that the rainrate shall not be calculated...or maybe shall be calculate with a time span between last and previous sample (yesterday before it crashed).

it seems not working this way as weewx reported:
- 34.9mm/h at next report following the 21.8mm record.
- 87.2mm/h the following report 5min later.

I assume maybe weewx consider "not rain data" = "0 mm of rain" ?

I have a couple of questions:
- Is this behavior expected or maybe it's something that could be improved ?
- Can I delete those rainrate sample from database ?
of course my daily rain graph is a bit weird, but I want to keep the 21.8mm (so monthly or yearly records are ok), but I don't want to have my yearly/alltime max rainrate using this wrong data.

best regards,





wysiwyg

unread,
Jul 28, 2021, 8:25:52 AM7/28/21
to weewx-user
I would like to add more data about what weewx reports shows:

data are 5minutes reports (rain is daily sum)
sample 0: just before I reboot my sensor
sample 1: after it received this 21.8mm rain from last night.

Sample:    0  1     2     3     4     5
Rain:      0  21.8  21.8  21.8  21.8  21.8
Rain rate: 0  34.9  87.2  87.2  58.1  0

gjr80

unread,
Jul 28, 2021, 8:30:52 AM7/28/21
to weewx-user
WeeWX calculates rainRate by summing the rain seen in the last 900 seconds (15 minutes) and scales this to a per hour figure by multiplying by 3600/900. So your 21.8 mm appearing in one packet/record would have resulted in 21.8. * 4 = 87.2mm/hr; exactly what you saw. Due to the 900 second window being used the 87.2 mm/hr value would have persisted for up to 15 minutes. The 34.9 value may have been the result of when the 21.8mm value arrived, impossible to say without seeing the exact loop packet/archive record history. You can change the 900 second window to some other value, say 600 seconds (10 minutes) and WeeWX would then take the rainfall seen in the last 10 minutes and scale that figure to a per hour figure (in that case multiply by 3600/600).

This is covered in the [[RainRater]] stanza in the User’s Guide. Note the Userks Guide states that 1800 seconds (30 minutes) is used by default for the window but the code actually uses 900 seconds. Must fix the documentation.

Gary

michael.k...@gmx.at

unread,
Aug 6, 2021, 3:47:40 PM8/6/21
to weewx-user
Thanks Gary. Do you have an explanation for this:

I got hit by a Super Cell thunderstorm some weeks ago which delivered ~25mm in about 15 mins. Max rain rate for this month was those 25mm:

archive_day_rainrate
dateTime    min  mintime          max    maxtime     sum               count  wsum                  sumtime
1624312800  0.0  1624312803       25.28  1624395078  376.134682539682  288    112840.404761905      86400

select datetime, rain, rainrate from archive where datetime between 1624384800 and 1624399200 ORDER by datetime DESC
dateTime    rain                rainRate
1624393200  0.0                 25.02
1624392900  0.0                 25.02
1624392600  1.03199999999924    24.737
1624392300  6.19200000000092    21.512
1624392000  17.2860000000001    8.48545454545454
1624391700  0.515999999997803   0.076
1624391400  0.0                 0.0

gjr80

unread,
Aug 6, 2021, 9:41:49 PM8/6/21
to weewx-user
I believe the answer will depend on your WeeWX configuration and the station/driver you use. A default WeeWX install is set to obtain rainRate from the driver but if the driver does not provide rainRate then WeeWX will calculate it (rainRate = prefer_hardware under [StdWXCalculate] [[Calculations]] in weewx.conf). I see in a previous thread you referred to 'your WS28xx' - if you are still using the WS28xx then the answer is likely in the WS28xx driver as the WS28xx driver is one of the few that does provide rainRate. I had a brief look at the WS28xx driver and it is not evident to me how it derives rainRate, but it is clear it does not use the same algorithm as WeeWX - that is also evident in the archive data you presented.

If you wanted to use the WeeWX algorithm then you could change the rainRate = prefer_hardware to rainRate = software, I'm not saying the WS28xx is wrong, it just appears to use a different algorithm. On the face of it I don't really see anything wrong with your figures, though granted the 25.02 values are quite high given there was no rainfall for at least five minutes for the second 25.02 value, that could be because the WS28xx tapers the rainRate at a different rate to WeeWX.

Gary

michael.k...@gmx.at

unread,
Aug 8, 2021, 1:22:17 PM8/8/21
to weewx-user
Yes, the station in question is still the WS28xx, yes, there is a rainRate = prefer_hardware setting in the config. Thanks, that explains it.
My best guess how the WS28xx driver calculates the rainRate is in some kind "hour-based rolling average": the Super Cell event brought about 25mm in one hour, a couple of weeks later another event brought ~38mm in one hour:

dateTime    rain              rainRate
1626545100  4.12799999999879  37.173
1626544800  3.09599999999955  36.3272727272727
1626544500  7.48199999999997  32.737
1626544200  3.8700000000008   27.9744444444444
1626543900  2.83799999999974  25.2572727272727
1626543600  3.86999999999898  22.004
1626543300  3.8700000000008   17.978
1626543000  1.29000000000087  15.296
1626542700  1.54800000000068  13.953
1626542400  1.03199999999924  12.716
1626542100  3.09599999999955  10.96
1626541800  2.57999999999993  8.253

gjr80

unread,
Aug 8, 2021, 4:52:59 PM8/8/21
to weewx-user
When I looked at the ws28xx driver code I see the likes of data._Rain1H used in the rainRate calculation so that lends weight to the use of one hour rainfall data. If you are a glutton for punishment search the forums (weewx-user I think, but could be weewx-development) for calculation of rainRate - a few years ago we were revising the rainRate calculation in StdWXCalculate (or were we pulling the calculation out of some drivers, I cannot remember) and there was quite a thread on it. There are various methods of calculation each with their own pluses and minuses, eg reducing the ‘window’ used reduces the taper period, using a simple rain in the last hour based calculation can give a non-zero rainRate for up to one hour after the last rain fell.

Gary
Reply all
Reply to author
Forward
0 new messages