Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support datetime expressions in weather-sp output templates#536

Open
zeel2104 wants to merge 1 commit intogoogle:maingoogle/weather-tools:mainfrom
zeel2104:fix-weather-sp-datetime-template-535zeel2104/weather-tools:fix-weather-sp-datetime-template-535Copy head branch name to clipboard
Open

Support datetime expressions in weather-sp output templates#536
zeel2104 wants to merge 1 commit intogoogle:maingoogle/weather-tools:mainfrom
zeel2104:fix-weather-sp-datetime-template-535zeel2104/weather-tools:fix-weather-sp-datetime-template-535Copy head branch name to clipboard

Conversation

@zeel2104
Copy link
Copy Markdown

@zeel2104 zeel2104 commented May 2, 2026

Summary

Fixes #535.

Adds support for richer Python-style expressions in weather-sp output templates, including datetime formatting expressions like {datetime.strptime(f"{time}", "%H%M").strftime("%H:%M:%S")}.

This allows an output template such as:

gs://test-output/splits/test-file_{date}-{datetime.strptime(f"{time}", "%H%M").strftime("%H:%M:%S")}.grib

to produce:

gs://test-output/splits/test-file_20200101-12:00:00.grib

Changes

  • Added expression-aware output template parsing/evaluation in OutFileInfo.
  • Updated split-dimension detection so variables used inside expressions, such as time, are included.
  • Adjusted GribSplitterV2 to use raw split-dimension temp filenames for grib_copy, then apply the richer Python formatter during upload.
  • Added tests for datetime expression formatting and split-dimension extraction.

Testing

Manual validation passed:

['date', 'time']

gs://test-output/splits/test-file_20200101-12:00:00.grib

Full pytest was not run locally because this Windows Python 3.14 environment is missing pygrib/ecCodes support.

@mahrsee1997 mahrsee1997 self-requested a review May 3, 2026 08:03
@mahrsee1997
Copy link
Copy Markdown
Collaborator

@zeel2104, can you please fix lint issue, thanks!

@mahrsee1997 mahrsee1997 requested a review from Piyush-Ingale May 6, 2026 08:10
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

Successfully merging this pull request may close these issues.

[weather-sp] : better formatting of date & time in output template

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.