Rain total calculation?

511 views
Skip to first unread message

Jonis Maurin Ceará

unread,
Sep 17, 2018, 8:26:24 AM9/17/18
to weewx-user
Hi.
Is possible to automatically calculate rain total?!

I'm using generic cheap instruments (sold on ebay) with GrooveWeather Pi ( https://github.com/switchdoclabs/SDL_Pi_GroveWeatherPi ).
I'm writing values to text file and reading in weewx using file driver (customized).

Rain rate looks working fine:
f.write('rainRate=' + str((rain60Minutes/25.4)) + '\n')

The value looks correct (about 1.2mm/hour for now). But "Rain today" is always 0.
If I populate 'rain' field with total rain (calculated by GrooveWeatherPi), it's a bigger value.

Weewx page:
Rain Rate 0.2 mm/hr
Rain Today 8.0 mm

Data (written by grooveweathersensor):
rainRate=0.011
rain=0.0165


This doesn't look right :/ 
Weewx unit are set to US

More config:
[[StandardReport]]
        # See the customizing guide to change the units, plot types and line
        # colors, modify the fonts, display additional sensor data, and other
        # customizations. Many of those changes can be made here by overriding
        # parameters, or by modifying templates within the skin itself.

        # The StandardReport uses the 'Standard' skin, which contains the
        # images, templates and plots for the report.
        skin = Seasons
        [[[Units]]]
            [[[[Groups]]]]
                group_altitude = meter
                group_speed2 = meter_per_second2
                group_pressure = mbar
                group_rain = mm
                group_rainrate = mm_per_hour
                group_temperature = degree_C
                group_degree_day = degree_C_day
                group_speed = meter_per_second



[StdWXCalculate]

    [[Calculations]]
        # Derived quantities are calculated by this service. Possible values are:
        #  hardware        - use the value provided by hardware
        #  software        - use the value calculated by weewx
        #  prefer_hardware - use value provide by hardware if available,
        #                      otherwise use value calculated by weewx

        pressure = prefer_hardware
        barometer = prefer_hardware
        altimeter = prefer_hardware
        windchill = prefer_hardware
        heatindex = prefer_hardware
        dewpoint = prefer_hardware
        inDewpoint = prefer_hardware
        rainRate = prefer_hardware


Andrew Milner

unread,
Sep 17, 2018, 9:55:28 AM9/17/18
to weewx-user
You are not telling us enough information.

The archive field 'rain' should be the amount of rainfall in the archive period.  What is your archive period?  How often do you read the text file?  What data is in the text file?  Weewx does not use a rain value for 60 minutes.  If the data from the text file is the daily accumulation then the driver needs to calculate the difference between two successive readings to determine the rainfall for the archive period.

The 'weewx page' can display whatever you want!!  It is updated every archive interval.  Rainrate will be the rain rate for the last archive period recorded, and the total will be an accumunlation of the rain column for all the daily archive records (and will probably actually be taken from the daily summary table).

You need to be much more precise in your questions, and ideally you should tell us what data you have actually got in the database compared to what you expect to have.  

Jonis Maurin Ceará

unread,
Sep 17, 2018, 10:15:43 AM9/17/18
to weewx-user
That's why I'm asking about calculation, because i just don't know how weewx works (until your answer).

I'm using FileParser driver with pool interval of 10 seconds. My "script" grooveweather also generate this text file every 10 seconds and rain information is cummulative from the entire day (I'm guessing, looking for the code). You said that weewx doesn't use rain value for 60 minutes......but using this data (rain in the last 60 minuts, from my driver) in rainRate looks right on report page (again, I'm not sure because I can't test/measure).

My archive time is set to 300 seconds (5 minutes). Since my 'driver' generates report every 10 second's, I can't see how I would out rain for the last 5 minutes and then reset this data. The problem is not coding, but the syncronization between '5 minutes' from weewx archive and '5 minutes' in driver code :(

Thomas Keffer

unread,
Sep 17, 2018, 10:25:55 AM9/17/18
to weewx-user
How rain works is in the documentation. Be sure to read the section Porting to new hardware in the Customizing Guide.

Regarding the last paragraph in your note: if I understand you correctly, don't worry about emitting archive records. Just emit a LOOP packet (or file) every few seconds (sounds like 10 seconds in your case). Let WeeWX compile them into archive records. Or, perhaps I don't understand what you're doing.

-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.
For more options, visit https://groups.google.com/d/optout.

Jonis Maurin Ceará

unread,
Sep 17, 2018, 3:14:57 PM9/17/18
to weewx-user
I think I got this working.

In the grooveweather software (who get's/calculate data from hardware), in save_data loop (every 10 seconds), I've added a local variable to calculate totalRain and if totalRain is different from last (old) value, just get the difference and put on data file (which is read by weewx), but only once! In the next reading, this value is not added anymore (unless is different from previsous).
I've made some tests and the value in database (and report page) looks good now!
I'm using rainRate from sensor too, since it's already calculated by software.



Em segunda-feira, 17 de setembro de 2018 09:26:24 UTC-3, Jonis Maurin Ceará escreveu:

Sébastien F4GQK

unread,
Oct 8, 2020, 3:33:47 AM10/8/20
to weewx-user
Hello,

I have the same problem could you give me the code for your variable so i can do the same. I have the same worries as you

thanks

Sebastien
Reply all
Reply to author
Forward
0 new messages