Skip to content

Commit 95f26d6

Browse files
Fix USGS and Style
1 parent 1ce0974 commit 95f26d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

searvey/usgs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ def normalize_usgs_station_data(df: pd.DataFrame) -> pd.DataFrame:
230230
df["output_id"] = df.output_id.str.removesuffix("_cd")
231231
df = df.set_index(list(USGS_DATA_MULTIIDX))
232232

233+
# Drop should happen based on time and station as well, not
234+
# just based on 'value' and 'qualifier'
233235
df = (
234236
pd.merge(
235237
df.drop(columns="qualifier")[~df.isqual],
@@ -238,10 +240,10 @@ def normalize_usgs_station_data(df: pd.DataFrame) -> pd.DataFrame:
238240
right_index=True,
239241
how="left",
240242
)
241-
.drop_duplicates()
242243
.drop(columns=["output_id", "isqual"])
244+
.reset_index()
245+
.drop_duplicates(subset=["site_no", "datetime", "code", "option", "qualifier"])
243246
)
244-
df = df.reset_index()
245247

246248
df_parm = _get_usgs_output_info().set_index("parameter_cd")
247249
df = df[df.code.isin(df_parm.index)]

0 commit comments

Comments
 (0)