You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to download USGS data using dataretrieval, and subsequently write it to DSS.
What I Tried
from dataretrieval import nwis
import pyhecdss
df, meta = nwis.get_iv('11455495', '2021-06-01', parameterCd='00095')
ts = df['00095_lower-4 ft from bed'].tz_convert('America/Los_Angeles').tz_localize(None)
with pyhecdss.DSSFile('usgs.dss', create_new=True) as f:
f.write_its('/A/B/EC//IR-MONTH/USGS/', ts, 'mmhos','INST-VAL')
Notes
The above code fails silently - no error just a blank dss file. The silent error is caused by trying to write more than one value with the same timestamp (tz_convert includes daylight savings). If you try to write the data in UTC, pandas throws an error from line 710 of pyhecdss.py: TypeError:Timestamp subtraction must have the same timezones or no timezones.
Description
Trying to download USGS data using dataretrieval, and subsequently write it to DSS.
What I Tried
Notes
The above code fails silently - no error just a blank dss file. The silent error is caused by trying to write more than one value with the same timestamp (tz_convert includes daylight savings). If you try to write the data in UTC, pandas throws an error from line 710 of pyhecdss.py: TypeError: Timestamp subtraction must have the same timezones or no timezones.
End-user fix
Possible Improvements
len(df.index) == len(df.index.unique())
before trying to write to dss.The text was updated successfully, but these errors were encountered: