Skip to content
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

Update on NHD to convert byte string to normal string #728

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/troute-network/troute/nhd_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ def get_obs_from_timeslices(
df = crosswalk_df.reset_index()
df[crosswalk_gage_field] = np.asarray(df[crosswalk_gage_field]).astype('<U15')
df = df.set_index(crosswalk_gage_field)

df.index = df.index.str.strip()
# join crosswalk data with timeslice data, indexed on crosswalk destination field
observation_df = (df.join(timeslice_obs_df).
reset_index().
Expand Down
2 changes: 1 addition & 1 deletion src/troute-network/troute/nhd_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def gage_mapping(segment_gage_df, gage_col="gages"):
gage_list = list(map(bytes.strip, segment_gage_df[gage_col].values))
gage_mask = list(map(bytes.isalnum, gage_list))
segment_gage_df = segment_gage_df.loc[gage_mask, [gage_col]]
segment_gage_df[gage_col] = segment_gage_df[gage_col].map(bytes.strip)
segment_gage_df[gage_col] = segment_gage_df[gage_col].apply(lambda x: x.decode('utf-8'))
gage_map = segment_gage_df.to_dict()
return gage_map

Expand Down