Skip to content

GRIB Data Example is broken #7892

Description

@mktippett

What is your issue?

The example at https://docs.xarray.dev/en/stable/examples/ERA5-GRIB-example.html fails with an error. The command that fails is

ds = xr.tutorial.load_dataset("era5-2mt-2019-03-uk.grib", engine="cfgrib")

And the error is

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[2], line 1
----> 1 ds = xr.tutorial.load_dataset("era5-2mt-2019-03-uk.grib", engine="cfgrib")

File ~/checkouts/readthedocs.org/user_builds/xray/checkouts/stable/xarray/tutorial.py:206, in load_dataset(*args, **kwargs)
    169 def load_dataset(*args, **kwargs) -> Dataset:
    170     """
    171     Open, load into memory, and close a dataset from the online repository
    172     (requires internet).
   (...)
    204     load_dataset
    205     """
--> 206     with open_dataset(*args, **kwargs) as ds:
    207         return ds.load()

File ~/checkouts/readthedocs.org/user_builds/xray/checkouts/stable/xarray/tutorial.py:161, in open_dataset(name, cache, cache_dir, engine, **kws)
    159 # retrieve the file
    160 filepath = pooch.retrieve(url=url, known_hash=None, path=cache_dir)
--> 161 ds = _open_dataset(filepath, engine=engine, **kws)
    162 if not cache:
    163     ds = ds.load()

File ~/checkouts/readthedocs.org/user_builds/xray/checkouts/stable/xarray/backends/api.py:552, in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs)
    549 if from_array_kwargs is None:
    550     from_array_kwargs = {}
--> 552 backend = plugins.get_backend(engine)
    554 decoders = _resolve_decoders_kwargs(
    555     decode_cf,
    556     open_backend_dataset_parameters=backend.open_dataset_parameters,
   (...)
    562     decode_coords=decode_coords,
    563 )
    565 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None)

File ~/checkouts/readthedocs.org/user_builds/xray/checkouts/stable/xarray/backends/plugins.py:205, in get_backend(engine)
    203     engines = list_engines()
    204     if engine not in engines:
--> 205         raise ValueError(
    206             f"unrecognized engine {engine} must be one of: {list(engines)}"
    207         )
    208     backend = engines[engine]
    209 elif isinstance(engine, type) and issubclass(engine, BackendEntrypoint):

ValueError: unrecognized engine cfgrib must be one of: ['netcdf4', 'h5netcdf', 'scipy', 'store', 'zarr']

Correct behavior here https://github.com/pydata/xarray/blob/main/doc/examples/ERA5-GRIB-example.ipynb

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions