Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alternate monthly mean calculations for tipping bucket stations #215

Open
corviday opened this issue Apr 15, 2024 · 1 comment · May be fixed by #217
Open

Support alternate monthly mean calculations for tipping bucket stations #215

corviday opened this issue Apr 15, 2024 · 1 comment · May be fixed by #217
Assignees

Comments

@corviday
Copy link
Contributor

corviday commented Apr 15, 2024

Stations with the network_variable_name of cum_pcpn_amt seem to measure precipitation by accumulation - that is, they report how much total precipitation has fallen since the last time the instrument reset on an hourly basis, instead of reporting how much precipitation has fallen that hour. Here are a couple representative graphs:

tip
tip2
tip3

Physically it seems likely these are "tippng bucket" stations, measuring rainfall via a bucket that accumulates water until it is full, and tips out to reset.

In order to calculate monthly precipitation observed at these stations, we do not want to average hourly or daily reported values; this leads to months where, in the case of the second graph, every day or hour sees 1600 mm of precipitation! I believe the right calculation goes something like:

month_max = maximum value recorded during month
month_min = smallest value recorded during month
month_last = last value recorded during month
month_first = first value recorded during month

if month_max > month_last: #bucket "tipped" this month
   return (month_last - month_min) + (month_max - month_first)
else: bucket did not "tip" this month
    return month_last - month_first

In order for the back end to calculate this special case reasonably quickly, we need a new materialized view with month_max, month_min, month_last, and month_first for each station and month using the cum_pcpn_amt variable, as well as the earliest and latest days each month for which data is available so we can prorate it if there is less than a full month's data in the database.

@corviday corviday self-assigned this Apr 15, 2024
@corviday corviday changed the title Support alternate monthly mean calculations for tippng bucket stations Support alternate monthly mean calculations for tipping bucket stations Apr 16, 2024
@corviday
Copy link
Contributor Author

Currently trying a different approach to this problem, see #216

@corviday corviday linked a pull request Jul 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant