Skip to content

ds = xr.tutorial.load_dataset("air_temperature") with 0.18 needs engine argument #43

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

Closed
scottyhq opened this issue May 11, 2021 · 1 comment

Comments

@scottyhq
Copy link
Contributor

Many notebooks out there start with the line ds = xr.tutorial.load_dataset("air_temperature"). That now gives an error traceback with xarray>=0.18:

Traceback (most recent call last):
  File "/Users/scott/GitHub/zarrdata/./create_zarr.py", line 6, in <module>
    ds = xr.tutorial.load_dataset("air_temperature")
  File "/Users/scott/miniconda3/envs/zarrdata/lib/python3.9/site-packages/xarray/tutorial.py", line 179, in load_dataset
    with open_dataset(*args, **kwargs) as ds:
  File "/Users/scott/miniconda3/envs/zarrdata/lib/python3.9/site-packages/xarray/tutorial.py", line 100, in open_dataset
    ds = _open_dataset(filepath, **kws)
  File "/Users/scott/miniconda3/envs/zarrdata/lib/python3.9/site-packages/xarray/backends/api.py", line 485, in open_dataset
    engine = plugins.guess_engine(filename_or_obj)
  File "/Users/scott/miniconda3/envs/zarrdata/lib/python3.9/site-packages/xarray/backends/plugins.py", line 112, in guess_engine
    raise ValueError("cannot guess the engine, try passing one explicitly")
ValueError: cannot guess the engine, try passing one explicitly

It's an easy fix though, just add ds = xr.tutorial.load_dataset("air_temperature", engine="netcdf4"), new users might be thrown by that though. Also a note that unless the netcdf4 library is explicitly put into the software environment, even adding the engine=netcdf4 can result in an error: "ValueError: unrecognized engine netcdf4 must be one of: ['store', 'zarr']", so I think a minimal environment definition to run would be:

name: xarray-tutorial
channels:
  - conda-forge
dependencies:
  - xarray=0.18
  - pooch=1.3
  - netcdf4=1.5
  - zarr=2.8
@keewis
Copy link
Contributor

keewis commented May 11, 2021

thanks for the report, @scottyhq. Please note that while the module is called xarray.tutorial (the same as this repository), it is actually implemented in the main repository. I'll close this and re-open on the main repository. Feel free to continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants