Skip to content

If hdate in tree use hdate instead of date#108

Draft
awarde96 wants to merge 15 commits intomainfrom
feature/hdate_reanalysis_data
Draft

If hdate in tree use hdate instead of date#108
awarde96 wants to merge 15 commits intomainfrom
feature/hdate_reanalysis_data

Conversation

@awarde96
Copy link
Copy Markdown
Collaborator

@awarde96 awarde96 commented Mar 17, 2026

Description

Fundamental Questions

These are some of the open questions/issues we found after starting the work on the TimeSeries encoder. They partly also apply to other encoders but we'll focus on them first and hopefully solve this for other encoders at the same time.

  • Coverage merging for hdate: Multiple hdate values currently produce one coverage each. For reanalysis, all hdate(+time)+step combinations for the same point should be merged into a single coverage with an expanded t-axis.
  • Metadata cleanup for hdate coverages: Replace "Forecast date" and "hdate" with "date" (the model version date). If merging multiple hdates into one coverage, either drop "Forecast date" entirely or make it a list of the hdate+time values.
  • Wrong "hdate" in mars metadata: For requests that return multiple coverages, it appears that each coverage has an hdate key in the mars:metadata section (which we likely don't want anyway) is simply a copy of the last hdate. So for the first few coverages, this key is wrong.
  • "date" keyword missing in mars metadata: The mars:metadata section does not contain the date key associated with the model version / reforecast reference date. This is not a big issue but if there's a quick fix, that would be nice.

Encoders

  • TimeSeries
  • BoundingBox
  • Circle
  • Frame
  • Grid
  • Path
  • Position
  • Shapefile
  • VerticalProfile
  • Wkt

Decoders

At the minimum, the existing decoders should know how to deal with the coveragejsons generated by the updated encoders and return correct results. Any further work on compacting multiple coverages e.g. into MultiPointSeries or more efficient representations should be left to #109 as a follow-up.

  • BoundingBox
  • Circle
  • Frame
  • Grid
  • Path
  • Position
  • Shapefile
  • TimeSeries
  • VerticalProfile
  • Wkt

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@andreas-grafberger andreas-grafberger force-pushed the feature/hdate_reanalysis_data branch from 43a8c27 to d25fb01 Compare April 8, 2026 13:20
}

assert "Forecast date" not in cov["mars:metadata"]
assert cov["mars:metadata"] == EXPECTED_REANALYSIS_METADATA
Copy link
Copy Markdown

@andreas-grafberger andreas-grafberger Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awarde96 In this scenario of test_hdate_multiple_times, is it just outside of the current design to return a single coverage containing both timestamps? Or is that something that should generally be possible?

andreas-grafberger and others added 7 commits April 9, 2026 07:23
Since support for our hdate-based reanalysis data does seem to be a rare
(and soon outdated) use case, this changes the tests and implementation
to only focus on reforecast data in general. Users for old efas
reanalysis data now just will not profit from automatic merging of hdate
+ time + step axis into a single dimension, as this could easily break
reforecast retrieval patterns.

Each hdate is an independent forecast initialisation, so one coverage
per (point × hdate) is the correct reforecast semantic. Fix test
expectations to match (coverage counts, per-coverage Forecast date),
rename helpers for clarity, and add test_multiple_hdates_and_steps.
- Add from_polytope_reforecast to Encoder ABC
- Remove inline hdate hacks from from_polytope in all 8 encoders that had them
- Implement from_polytope_reforecast on all 9 non-TimeSeries encoders by
delegating to from_polytope(result, date_key="hdate")
- Add from_polytope regression tests for all 10 encoder types
- Add from_polytope_reforecast tests for all 10 encoder types
- Extract shared test helpers into tests/conftest.py
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.

Support "hdate" metadata field instead of "date" for reforecast datasets

2 participants