HydrologicEngineeringCenter / HydrologicEngineeringCenter/cwms-python

store_timeseries fails if version datetime has unspecified timezone

Open
#186 0 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

If a timeseries version is not a datetime object that has a specified timezone, the store will fail because there is no "Z" at the end.

May want to consider putting a check in the timeseries_df_to_json function that checks if the datetime object has a timezone specified and throw an error or assume UTC.

https://github.com/HydrologicEngineeringCenter/cwms-python/blob/509ae4050d592631942c03e564dd85e8bd22810b/cwms/timeseries/timeseries.py#L250C1-L253C32

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 in cwms/timeseries/timeseries.py at the timeseries_df_to_json function around lines 250-253. Reproduce store_timeseries with a version datetime that has no timezone, then determine and document whether the completed behavior should reject it or assume UTC. Done means the store no longer fails silently because the serialized version lacks the expected timezone marker.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.