ecmwf / earthkit-regrid

3 stars 0 forks source link

Add xarray support #38

Open sandorkertesz opened 2 months ago

sandorkertesz commented 2 months ago

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

The goal is to add the same (limited) support to xarray that is currently available for GRIB fieldlists.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Organisation

ECMW

HCookie commented 2 months ago

First pass with quite manual usage implemented in https://github.com/ecmwf/earthkit-regrid/tree/feature/xarray_interpolator

sandorkertesz commented 1 month ago

@HCookie , if the Xarray is generated by earthkit-data (develop) you can get the input gridspec for interpolate() like this:

>>> import earthkit.data as ekd
>>> ds_ek = ekd.from_source("sample", "pl.grib")
>>> r = ds_ek.to_xarray()
>>> r["t"].earthkit.metadata.gridspec
GridSpec({'type': 'regular_ll',  ....