KWB-R / dwc.wells

An R Package for Condition Predictions for Drinking Water Wells
https://kwb-r.github.io/dwc.wells
MIT License
0 stars 0 forks source link

Aggregate abstraction volume #22

Closed mrustl closed 3 years ago

mrustl commented 3 years ago

First output (shown here for first three wells) for discussion (see: https://github.com/KWB-R/dwc.wells/blob/13a597ee29d9a06e20120aab3367abcde5212360/inst/extdata/scripts/aggregate_abstraction_volumes.R):

To be removed if days_available_percent < 100% ??

well_id last_rehab.date days_missing days_available days_available_percent total_abstraction
162 1970-12-15 1 0 0.0000000 0.0000
162 1994-01-30 8448 0 0.0000000 0.0000
162 2000-05-10 2293 0 0.0000000 0.0000
162 2005-11-30 601 1430 70.4086657 2012015.0000
162 2013-07-22 0 2793 100.0000000 3719665.0000
162 2018-11-05 615 1317 68.1677019 928982.1000
162 NA 7 0 0.0000000 0.0000
166 1994-06-02 2 0 0.0000000 0.0000
166 2000-06-17 2208 0 0.0000000 0.0000
166 2005-12-17 563 1447 71.9900498 2354198.0000
166 2010-05-12 0 1608 100.0000000 2494331.0000
166 2015-05-02 0 1817 100.0000000 2501414.1000
166 2020-03-25 1121 668 37.3392957 929558.4000
166 NA 5 0 0.0000000 0.0000
167 1994-06-02 2 0 0.0000000 0.0000
167 2000-06-17 2208 0 0.0000000 0.0000
167 2005-12-11 563 1441 71.9061876 1770881.0000
167 2010-08-28 0 1721 100.0000000 1106256.0000
167 NA 0 10 100.0000000 306.0000
168 1994-05-16 2 0 0.0000000 0.0000
168 2000-07-07 2245 0 0.0000000 0.0000
168 2005-12-12 543 1442 72.6448363 1921446.0000
168 2010-04-28 0 1599 100.0000000 1288750.0000
168 2015-03-28 0 1796 100.0000000 1255949.7000
168 2018-10-14 593 703 54.2438272 564828.7000
168 NA 5 0 0.0000000 0.0000
169 1994-05-09 3 0 0.0000000 0.0000
169 2000-01-23 2088 0 0.0000000 0.0000
169 2005-12-14 709 1444 67.0692058 1894158.0000
169 2010-09-22 0 1744 100.0000000 1949781.0000
169 2015-02-25 0 1618 100.0000000 1707739.9000
169 2018-11-30 640 734 53.4206696 578767.7000
169 NA 6 0 0.0000000 0.0000

This change is Reviewable

mriech commented 3 years ago

Hi @mrustl, thanks. However, I think at the moment, data is only aggregated between the different rehab.dates but not between date and rehab.date, isn't it?

For well_id 162, as an example, we would need for each row the volume abstracted between date and last_rehab.date (and eventually also between date_and operational_start.date, as an extra). If volume data is incomplete for a time interval, there should be an NA.

well_id date last_rehab.date operational_start.date key Qs_rel
162 1970-12-15 1970-12-15 1970-12-15 operational_start 1.000
162 1994-02-14 1994-01-30 1970-12-15 pump_test_2 0.978
162 2000-04-10 1994-01-30 1970-12-15 pump_test_1 0.751
162 2000-06-08 2000-05-10 1970-12-15 pump_test_2 0.785
162 2005-11-28 2000-05-10 1970-12-15 pump_test_1 0.522
162 2005-12-01 2005-11-30 1970-12-15 pump_test_2 0.612
162 2013-03-21 2005-11-30 1970-12-15 pump_test_1 0.315
162 2013-11-21 2013-07-22 1970-12-15 pump_test_2 0.272
162 2015-02-17 2013-07-22 1970-12-15 pump_test_1 0.207
162 2018-10-29 2013-07-22 1970-12-15 pump_test_1 0.163
162 2018-11-12 2018-11-05 1970-12-15 pump_test_2 0.224

What do you think?