Skip to content

Support multiple time variable formats when extracting valid time#22

Open
mkavulich wants to merge 2 commits into
mainfrom
time_variable_logic
Open

Support multiple time variable formats when extracting valid time#22
mkavulich wants to merge 2 commits into
mainfrom
time_variable_logic

Conversation

@mkavulich

@mkavulich mkavulich commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Add get_timestrings() helper that tries three methods for determining the time of MPAS data in order:

  1. xtime character array (standard MPAS history files)
  2. CF-compliant Time variable with "X since YYYY-MM-DD HH:MM:SS" units
  3. Datetime parsed from filename (e.g. diag.2025-06-07_00.00.00.nc)

Finally, it falls back to a dummy time value if all methods fail (the previous behavior)

This code was generated with the help of Claude Code Sonnet 4.6, with all lines reviewed by me.

Add get_timestrings() helper that tries three methods in order:
1. xtime character array (standard MPAS history files)
2. CF-compliant Time variable with "X since YYYY-MM-DD HH:MM:SS" units
3. Datetime parsed from filename (e.g. diag.2025-06-07_00.00.00.nc)
Falls back to a dummy time value if all methods fail.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@mkavulich mkavulich force-pushed the time_variable_logic branch from 2049d22 to 049ec5c Compare June 26, 2026 23:26
Move time-solving logic into open_ux_subset() so each file's time is
extracted before concatenation, when the per-file path is still available.
Synthesizes xtime from CF Time variable or filename for files that lack it,
ensuring downstream code always finds xtime populated correctly for every
time step. Dummy fallback now generates unique timestamps per file to
prevent output overwrites.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant