Skip to content

Commit

Permalink
Update on NHD to convert byte string to normal string (NOAA-OWP#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
AminTorabi-NOAA authored Jan 24, 2024
1 parent 2a8593c commit 1cbef75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 1cbef75

Please sign in to comment.