Streamflow DA bug fix (negative values) #521
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Further testing of t-routes DA scheme at CONUS scale revealed some issues that were not observed at smaller development scales. In particular, there were negative and -Inf values appearing at gage locations. As it turns out, the DA-decay method had but in it. Specifically, the DA weight value is:
da_weight = exp(time_since_lastobs/ decay_coeff)
, wheretime_since_lastobs
is the number of minutes since the last quality observation was taken at the gage. Per this, equationtime_since_lastobs
should not be a negative value, but the existing code was simulating as such.Elaborating a bit more with some context. The DA weight is weight that a simulated value is given relative to the last observation. When the last observation occurred very recently, the weight on the simulated value should be minimal because it is unlikely that actual (observed) streamflow underwent a large change in a brief amount of time. On the other hand, when it has been a while since the last quality observation, then the DA weight should be large. In either case, the DA weight value should never be greater than 1. The only way to make this happen is if the
time_since_lastobs
is always a positive value.Regardless of the math and logic, the implemented changes in this PR do away with negative and -Inf values appearing in the streamflow simulations at gage locations.
Additions
time_since_lastobs
insimple_da.pyx
Removals
Changes
Testing
06400875
and09386950
) where CONUS testing was showing negative values in the simulated streamflow record. Confirmed the results observed at CONUS scale. Confirmed that the requested changed here ameliorated these issues.