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

Handle irregular time series input #51

Open
aufdenkampe opened this issue Apr 28, 2021 · 0 comments
Open

Handle irregular time series input #51

aufdenkampe opened this issue Apr 28, 2021 · 0 comments

Comments

@aufdenkampe
Copy link
Collaborator

Presently, HSP2 can not handle irregular time series as inputs.

Although irregular time series inputs are not common for HSPF, @bcous has found a historical set of WDM files where the input time series started at 1 hour intervals and then switched to 15 minute intervals. HSPF resamples all inputs to the model time step immediately prior to a run, so everything works fine in HSPF.

With the recent successful Rewrite readWDM.py to read by data group & block #21, we can properly read these and all other tested WDM. However, as @ptomasula commented (LimnoTech#21 (comment)), running HSP2 on those inputs will throw an error if tsfreq == None:

~/Documents/Python/limno.HSPsquared/HSP2/utilities.py in transform(ts, name, how, siminfo)
     78         pass
     79     elif tsfreq == None:     # Sparse time base, frequency not defined
---> 80         ts = ts.reindex(siminfo['tbase']).ffill().bfill()
     81     elif how == 'SAME':
     82         ts = ts.resample(freq).ffill()  # tsfreq >= freq assumed, or bad user choice

KeyError: 'tbase'

We have several options to fix this:

  1. Drop higher frequency data
  2. Fill entire time series to highest frequency, but how?
    • Fill options: NaN (or -999.0), previous value, interpolated value
  3. Split into two time series
  4. Modify HSP2.utilties.py code to handle it

We'll do option 1 in the short term (probably "manually"), but option 4 is probably the best long term fix.

This issue will track progress on option 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant