Closed jds485 closed 1 year ago
@jds485 in the ifelse statement here, what is the purpose of the "+10^-digits"? TIs this in case the threshold is zero for a 'low' threshold type?
data$event <- dplyr::do(dplyr::group_by(data, groups), {find_events(.$discharge, threshold = ifelse(type == 'high', NE_flow, NE_flow + 10^-digits), type = type)})$event
Sorry - I should have specified that is in the prep_data function in calc_FDC.R
I implemented the +10^-digits
so that the threshold value is considered as <= threshold for low flows and > threshold for high flows. Also helps with that edge case of 0 flow for low flows.
We can talk about this at the meeting later but before I get into coding this event description the way we talked about last week, I want to make sure I am envisioning it correctly. I think the way we decided to define an event was that it had to have a rising and falling limb that crossed the threshold and had a maximum that was lower than the next higher threshold.
In this plot below, the horizontal lines are the 0.5, 0.75, and 0.95 quantiles. I've colored the flows that would be considered events within their respective ranges - so there are 2 (red) events in the 0.75 - 0.95 range and 3 blue events in the 0.95 and above range.
Is this plot correct? Or should those smaller bumps between day 8-22 also be considered events even though they don't cross that lower threshold at all?
There are going to be a lot of high flow days that won't be counted as an event because they are on the rising or falling limb that is below the threshold but can't be considered a different event (like days 26 - 31).
This plot is also how I was envisioning it. We can talk more in the meeting later
Can chat about this at the meeting. I still need to test out some things within the calc_FDC function, but I have recoded the find_events function for high and low thresholds. Here is an example of how high threshold events are defined (gray lines are thresholds at 0.5, 0.75, and 0.95 quantiles)
And here is an example of how low threshold events are be defined ( gray lines are thresholds at 0.1, 0.25, and 0.5th percentiles - wasn't sure which quantiles to use for low thresholds)
That looks good! I'm wondering if the gap in the record at the end of the low flow plot will be labelled as an NA event after (in this case). I think that was part of further EFlowStats processing that I also adopted before and after gaps.
That gap is not real, I accidentally subsetted the red dots to a slightly longer period than the black dots.
Requires edits to how events are defined in EflowStats functions. Recommend adding an argument to compute events only within a specified percentile range.
Use case would be when we aggregate quantiles (50-70, > 70) we can enforce no overlapping events in those aggregated groups