Skip to content

Commit

Permalink
Fix USGS and Style
Browse files Browse the repository at this point in the history
  • Loading branch information
SorooshMani-NOAA committed May 14, 2024
1 parent 1ce0974 commit 95f26d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions searvey/usgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ def normalize_usgs_station_data(df: pd.DataFrame) -> pd.DataFrame:
df["output_id"] = df.output_id.str.removesuffix("_cd")
df = df.set_index(list(USGS_DATA_MULTIIDX))

# Drop should happen based on time and station as well, not
# just based on 'value' and 'qualifier'
df = (
pd.merge(
df.drop(columns="qualifier")[~df.isqual],
Expand All @@ -238,10 +240,10 @@ def normalize_usgs_station_data(df: pd.DataFrame) -> pd.DataFrame:
right_index=True,
how="left",
)
.drop_duplicates()
.drop(columns=["output_id", "isqual"])
.reset_index()
.drop_duplicates(subset=["site_no", "datetime", "code", "option", "qualifier"])
)
df = df.reset_index()

df_parm = _get_usgs_output_info().set_index("parameter_cd")
df = df[df.code.isin(df_parm.index)]
Expand Down

0 comments on commit 95f26d6

Please sign in to comment.