earthkit-data
earthkit-data copied to clipboard
Add support for reading zarr from google cloud storage
Is your feature request related to a problem? Please describe.
At the moment, we can read zarr from google cloud storage using the following code:
import earthkit.data
import xarray as xr
a = xr.open_zarr("gs://weatherbench2/datasets/era5-forecasts/2020-1440x721.zarr")
ds = earthkit.data.from_object(a)
len(a)
589992
The task is to find the right API to read it straight as a source.
A possible option is to add the "xarray" source:
from earthkit.data import from_source
path = "gs://weatherbench2/datasets/era5-forecasts/2020-1440x721.zarr"
ds = from_source("xarray", path)
However, "xarray" in this case is not a source but rather an opener/reader. So maybe we should use something like this:
ds = from_source("gs", path, opener="xarray", download=False)
and implement a reader for it. The options indicate not to download the source but directly open it with "xarray", then create a fieldlist from it. We need an option like download=False
because in theory we could download the data and open it with xarray from disk. Please note some sources also has a stream=True
option when we read the data as a stream. Another thing to consider is that we may want to open zarr data with other packages than xarray e.g. with zarr, that is why the opener
option is needed.
Please note that there is already a similar source "s3" in development.
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response
Organisation
ECMWF