Skip to content

to_xarray(time_dim_mode="auto") #706

@EddyCMWF

Description

@EddyCMWF

Is your feature request related to a problem? Please describe.

It would be very useful to have an "auto" option for time_dim_mode to make conversion to xarray more generalisable. It should choose the appropriate time_dim_mode for the grib file provided. The logic to make the decision will be tricky.

Describe the solution you'd like

When using ek_ds.to_xarry(time_dim_mode="auto"), the conversion should identify and appropriate time_dim_mode for the data being converte. I would suggest using the value of the "stream" key in the grib files to make this decision, but this is very open for discussion. stepType is not recommended as the accumulated variables in ERA5 have stepType='fc' (forecast) despite them being more suited to a time_dim_mode="valid_time" representation.

The following stream to time_dim_mode could be used as an example to start:

  • oper, wave, enda, ewda -> time_dim_mode="valid_time"
  • mmsm, mmsa, mmsf -> time_dim_mode="forecast"

With the functionality in place, we may be able to use better "metadata matches" to make this automatic decision

Describe alternatives you've considered

Relying on user input works, but adds technical debt to simple examples

Additional context

Providing introductary examples of earthkit to the wider community

Organisation

ECMWF

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions