Functions like marsEventCombinedPlot want the ability to check/capture the fact that the water level was not increasing (due to rain) before the event. For 'marsEventCombinedPlot, it uses the following code to detect if the water level is constant before the event provided by the marsFetchMonitoringData`:
|
# make sure we capture at least three points before the water level response |
|
level_data <- mon_data$`Level Data` |
|
level_data$lvl_lag <- c(diff(level_data$level_ft, 3),0,0,0) |
|
level_data <- level_data %>% dplyr::mutate(lageql = abs(level_ft - lvl_lag)) %>% |
|
dplyr::mutate(isevent = !is.na(level_data[,event_col])) %>% |
|
dplyr::filter(lageql != 0 | isevent) %>% |
|
#remove columns no longer used |
|
dplyr::select(-lvl_lag, -lageql,-isevent) |
This doesn't seem to work for a variety of reasons, with the biggest one being the fact that the precision is down to 4-digits so noise will make sure it's non-zero. Even if we round it to something that disregards noise, it will still capture values when isEvent is FALSE (not listed as being in a rain event).
This brings a few questions:
- Should this be a check (currently just a filter)?
- Should this be handled by the app/downstream function or a function like
marsFetchRainEventData?
- What is the threshold for pre-event? Should it be constant or also include decreasing for systems that drain down slowly?
Functions like
marsEventCombinedPlotwant the ability to check/capture the fact that the water level was not increasing (due to rain) before the event. For 'marsEventCombinedPlot, it uses the following code to detect if the water level is constant before the event provided by themarsFetchMonitoringData`:pwdgsi/R/mars_plotting_functions.R
Lines 958 to 965 in 63bc69b
This doesn't seem to work for a variety of reasons, with the biggest one being the fact that the precision is down to 4-digits so noise will make sure it's non-zero. Even if we round it to something that disregards noise, it will still capture values when isEvent is FALSE (not listed as being in a rain event).
This brings a few questions:
marsFetchRainEventData?