-
Notifications
You must be signed in to change notification settings - Fork 51
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
Fix NHD issues related to gage byte strings #742
Conversation
…existed for creating reservoir_usgs_df
I got an error in Some general improvement : in |
I'm not sure where in the code this comment is referring to. Can you make
comments specific to parts of the code?
…On Mon, Feb 26, 2024 at 11:20 AM Amin Torabi ***@***.***> wrote:
I got an error in compute.py that says KeyError: "None of
[Index([5194634], dtype='int32', name='lake_id')] are in the [index]"
seems like this line below and previous change on L139 won't run because
from_file is True
self._usgs_df = _reindex_link_to_lake_id(self._usgs_df,
network.link_lake_crosswalk)
*Some general improvement :* in compute.py it happens that
usgs_wbodies_sub is empty so reservoir_usgs_df.loc[usgs_wbodies_sub]
would be empty there is no need to calculate those. We should skip the
empty ones
—
Reply to this email directly, view it on GitHub
<#742 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AYSH2PPD2RTPUV6EQZMEQETYVTG6JAVCNFSM6AAAAABDXB2C5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRUHAZDSMBTGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@@ -344,6 +342,8 @@ def __init__(self, network, from_files, value_dict, da_run=[]): | |||
set_index('usgs_lake_id') | |||
) | |||
|
|||
self._usgs_df = _reindex_link_to_lake_id(self._usgs_df, network.link_lake_crosswalk) |
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.
This part of the code is not running while from_files
(L295) is True
usgs_df = network.link_gage_df.reset_index().set_index('gages').join(usgs_df).set_index('link').sort_index() | ||
|
||
self._usgs_df = _reindex_link_to_lake_id(usgs_df, network.link_lake_crosswalk) | ||
self._usgs_df = network.link_gage_df.reset_index().set_index('gages').join(usgs_df).set_index('link').sort_index() |
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.
This part of the code is not running while from_files
(L100) is True
There was inconsistent handling of converting USGS gage IDs from byte strings to character strings. This resulted in link-gage-crosswalk and lake-gage-crosswalk having different character representations of the same gage IDs. The position where
_reindex_link_to_lake_id()
function was also caused issues as it replaced link IDs with lake IDs inusgs_df
before creatingreservoir_usgs_df
. This resulted in missing lake IDs/gage IDs inreservoir_usgs_df
.Additions
Removals
Changes
DataAssimilation.py
_reindex_link_to_lake_id()
NHDNetwork.py
reservoir_da
parameters to conform to config-module. This incorporates changes from PR update on NHD to read reservoir_persistence_usgs #737nhd_io.py
nhd_network.py
preprocess.py
_reindex_link_to_lake_id()
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support
Accessibility
Other