-
Notifications
You must be signed in to change notification settings - Fork 50
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
simple fix for empty lastobs_df when streamnudging unknowingly turned on while no usgs data is available #732
simple fix for empty lastobs_df when streamnudging unknowingly turned on while no usgs data is available #732
Conversation
if streamflow_da_parameters: | ||
if streamflow_da_parameters.get('streamflow_nudging', False): | ||
self._last_obs_df = new_lastobs(run_results, time_increment) | ||
if not run_results[0][3][0].size == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this check needs to be modified. This only checks if the first object in run_results
has no gage information. But this varies for each object:
(Pdb) [rr[3][0].size for rr in run_results]
[2,2,0,2,0,1,0,0,3,0,17,1,1,4,3,1,0,0,0,2,0,1,2,0,0,0,1,0,3,1,2,1,1,0,1,1,0,1,0,1,3,0,0,0,0,0,0,0,3,1,0,11,0,2,0,0,3,1,0,0,0,2,4,0,0,3,0,0,0,0]
(Pdb)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about checking self._last_obs_df? If it is empty in the first place, then we expect nothing will come out for lastobs values from mc_reach.pyx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we say something like:
for rr in range(len(run_results[0][3])):
if not run_results[0][3][rr].size == 0:
self._last_obs_df = new_lastobs(run_results, time_increment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion.
…to downstream and revised filling up missing topobathy data
position_upstream_mainstem_segment = position_mainstem_segment | ||
while temp_df.empty: | ||
try: | ||
position_upstream_mainstem_segment = position_upstream_mainstem_segment - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you decrease it by 1 here? Are the IDs always consecutive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does not decreasing flowpath ID number but the position of stream segment in the mainstem segment list that has aligned the list from upstream to downstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True that's correct. Just a very small suggestion, its more readable to write it like position_upstream_mainstem_segment -= 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks and updated.
This fix provides a solution when lastobs_df is empty because no usgs data is available while stream nudging is unknowingly activated in the config file. More solid solution will be provided soon. Also, in diffusive_routing mainstem_list now has a list of stream segments aligned in order from upstream to downstream. Moreover, missing topobathy data for a stream segment get filled in by looking up the newly aligned list.
Additionns
AbstractRouting.py
DataAssimilation.py
output.py
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support
Accessibility
Other