Skip to content

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

@andreas-grafberger

Description

@andreas-grafberger

What happened?

Some datasets, in particular reforecasts and climatology-style products, use the MARS metadata key hdate to indicate the start time for which a forecast is issued. In these datasets, the date key instead represents the model version or the time at which the reforecast was run, which is a different concept.

At the moment, covjsonkit always uses the date key when encoding the time axis, and ignores hdate. When requests are coming via polytope, this leads to incorrect time axes for datasets where hdate is the intended forecast reference time.

This makes it currently impossible to use covjsonkit (via polytope-mars) correctly for climatology and reforecast datasets that rely on hdate.

When hdate is present in the MARS request or response metadata, covjsonkit should be able to use it as the forecast reference time so that hdate, not date, controls the time axis in the resulting CovJSON.

Ideally, this would work transparently for different polytope features, such as timeseries and polygons.

request = {
    "class": "ce",
    "stream": "efcl",
    "type": "sfo",
    "model": "lisflood",
    "date": "20230101",   # model version
    "hdate": "20250911", # this should control the time dimension in the covjson output
    "time": "1200",
    "levtype": "sfc",
    "expver": "8888",
    "domain": "g",
    "param": "240023",
    "step": "6",
    "origin" : "ecmf",
    "feature": {
        # Should also work for other requests like polygons etc.
        "type": "timeseries",
        "points": [[50.73746373267438, 7.107723168102066]],
        "axes": ["latitude", "longitude"],
        "time_axis": "step",
    },
}

Related issue in earthkit-data: ecmwf/earthkit-data#714

What are the steps to reproduce the bug?

Version

develop

Platform (OS and architecture)

macos,atos

Relevant log output

Accompanying data

No response

Organisation

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions