Fix timezone handling and midnight rounding issues in forecasts#330
Fix timezone handling and midnight rounding issues in forecasts#330CodeVishal-17 wants to merge 3 commits intoopenclimatefix:mainfrom
Conversation
|
Heads up: the failing CI appears unrelated to the timezone changes in this PR. The errors are coming from API unit tests failing with: Happy to pin the dependency or update the mocks if that’s desired — let me know what you prefer. |
|
CI is still failing with:
This looks unrelated to the timezone changes in this PR and appears to be due I pinned Happy to: — let me know what you’d prefer. |
Description
This PR fixes issues with timestamp handling in the forecasting pipeline, particularly around
timezone-aware inputs and rounding behavior close to midnight.
Specifically:
run_forecast, ensuring all downstream logic receivesa timezone-aware UTC timestamp.
to be UTC with a deprecation warning).
predict_tryolabswhere timestamps close to midnight couldproduce inconsistent
start_dateandstart_timevalues.This avoids subtle bugs and errors when using timezone-aware datetimes or when forecasts are
run close to day boundaries.
Fixes #320
How Has This Been Tested?
Manually tested
predict_tryolabswith timestamps close to midnight (e.g.23:40,23:55)to ensure
start_dateandstart_timeare derived from the same rounded timestamp.Verified that timezone-aware timestamps (non-UTC) are accepted and handled correctly.
Verified that timezone-naive timestamps continue to work and emit a deprecation warning.
Checked that behavior for typical daytime timestamps remains unchanged.
Yes
If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?
Checklist: