Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reading zarr from google cloud storage #413

Open
sandorkertesz opened this issue Jul 3, 2024 · 0 comments
Open

Add support for reading zarr from google cloud storage #413

sandorkertesz opened this issue Jul 3, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sandorkertesz
Copy link
Collaborator

sandorkertesz commented Jul 3, 2024

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

@sandorkertesz sandorkertesz added the enhancement New feature or request label Jul 3, 2024
@sandorkertesz sandorkertesz self-assigned this Jul 3, 2024
@sandorkertesz sandorkertesz changed the title Add support for reading zarr from google cloud services Add support for reading zarr from google cloud storage Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant