HydrologicEngineeringCenter / HydrologicEngineeringCenter/cwms-python

get_level_as_timeseries not creating correct time series for seasonal levels

Open
#286 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
16
Forks
11
Avg merge
4d 6h
Merged PRs (30d)
8

Description

I have a script that was computing incorrect values and traced the issue back to get_level_as_timeseries not creating correct time series for seasonal levels.

For example, given this seasonal level, it creates this time series. As you can see, the 15 Apr value is getting applied on 1 Apr rather than being interpolated to the time window provided.

Seasonal level
Date             Time      Storage
31-Dec-24       24:00	16,160.00
1-Apr-25         5:00	16,160.00
15-Apr-25        5:00   20,226.00
15-Oct-25        5:00	20,226.00
1-Nov-25	     5:00	16,160.00
30-Dec-25       24:00	16,160.00
31-Dec-25       24:00	16,160.00
Resulting Time Series
Date               Time     Storage
4/1/2026	08:00:00+00:00	16160
4/1/2026	08:30:00+00:00	16160
4/1/2026	09:00:00+00:00	16160
4/1/2026	09:30:00+00:00	16160
4/1/2026	10:00:00+00:00	16160
4/1/2026	10:30:00+00:00	17176.5
4/1/2026	11:00:00+00:00	18193
4/1/2026	11:30:00+00:00	19209.5
4/1/2026	12:00:00+00:00	20226

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating get_level_as_timeseries and reproduce the seasonal-level example from the issue, focusing on how the requested time window is handled around 1 Apr and 15 Apr. Compare the generated values with the expected interpolation shown in the report, then add or update a regression test covering seasonal levels and confirm the resulting time series uses the correct dates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.