-
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
mask output #806
mask output #806
Conversation
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.
Tested and approve.
3fe9c46
to
58a55cf
Compare
|
||
def crosswalk_nex_flowpath_poi(self, flowpaths, nexus): | ||
|
||
mask_flowpaths = flowpaths['toid'].str.startswith('nex-') |
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 you add toid
s that start with tnex-
as well? We should capture these terminal nexus points as well.
@@ -414,7 +416,15 @@ def preprocess_network(self, flowpaths, nexus): | |||
# Location information will be used to advertise tailwater locations of diffusive domains | |||
# to the model engine/coastal models | |||
self._nexus_latlon = nexus | |||
|
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 you add this space back? Just for aesthetics.
if 'poi_id' in nexus.columns: | ||
self._poi_nex_dict = nexus.groupby('poi_id')['id'].apply(list).to_dict() | ||
else: | ||
self._poi_nex_dict = None |
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 you add a space between functions. Just for aesthetics.
src/troute-network/troute/nhd_io.py
Outdated
if nex_id: | ||
for nex_key, nex_val in nex_id.items(): | ||
new_index = pd.MultiIndex.from_tuples([(nex_key, 'nex')], names=['featureID', 'Type']) | ||
flowveldepth_nex = flowveldepth[create_mask(nex_val)] | ||
|
||
if not flowveldepth_nex.empty: | ||
if len(flowveldepth_nex.index) > 1: | ||
summed_data = flowveldepth_nex.sum() | ||
new_data = pd.DataFrame([summed_data], index=new_index) | ||
new_data.loc[(nex_key, 'nex'), filtered_v_columns] = np.nan | ||
new_data.loc[(nex_key, 'nex'), filtered_d_columns] = flowveldepth_nex[filtered_d_columns].mean() | ||
else: | ||
new_data = flowveldepth_nex.copy() | ||
new_data.index = new_index | ||
|
||
nex_data_list.append(new_data) | ||
|
||
all_nex_data = pd.concat(nex_data_list) if nex_data_list else pd.DataFrame() | ||
else: | ||
all_nex_data = pd.DataFrame() |
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 chunk seems quite slow if 9999 is included. I wonder if this could be sped up by adding a column to flowveldepth
that is the toid
for each wb-
featureID
. These would obviously be nex-
IDs, then you could just group by the toid
column and sum? Something like that.
This PR user can define some specific nexus points or flowpaths and based on that results will be filtered. It creates a crosswalk between nexus points and flowpaths and if there are more than one flowpaths going to a nexus points it add up the flowrate and average the waterdepth.
reading POI capability will be added soon (waiting for final version of gpkg)
Additions
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support
Accessibility
Other