id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 394423623,MDU6SXNzdWUzOTQ0MjM2MjM=,2634,Opening a file with open_mfdataset fails if dask is not installed: ModuleNotFoundError: No module named 'dask.base',226037,closed,0,,,3,2018-12-27T15:33:27Z,2023-12-05T21:43:15Z,2023-12-05T21:43:15Z,MEMBER,,,,"#### Problem description Opening a file with `open_mfdataset` fails if *dask* is not installed: ``` >>> xr.open_mfdataset('tests/sample-data/era5-levels-members.nc') --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) ~/devel/MPY/xarray/xarray/backends/api.py in open_mfdataset(paths, chunks, concat_dim, compat, preprocess, engine, lock, data_vars, coords, autoclose, parallel, **kwargs) 626 --> 627 datasets = [open_(p, **open_kwargs) for p in paths] 628 file_objs = [getattr_(ds, '_file_obj') for ds in datasets] 629 if preprocess is not None: ~/devel/MPY/xarray/xarray/backends/api.py in open_dataset(filename_or_obj, group, decode_cf, mask_and_scale, decode_times, autoclose, concat_characters, decode_coords, engine, chunks, lock, cache, drop_variables, backend_kwargs) 340 341 with close_on_error(store): --> 342 return maybe_decode_store(store) 343 else: 344 if engine is not None and engine != 'scipy': ~/devel/MPY/xarray/xarray/backends/api.py in maybe_decode_store(store, lock) 276 277 if chunks is not None: --> 278 from dask.base import tokenize 279 # if passed an actual file path, augment the token with 280 # the file modification time ModuleNotFoundError: No module named 'dask.base' ``` #### Reason The reason is that the test in `maybe_decode_store` is for `None` but `open_mfdataset` in line 614 sets `chunks` to `{}` if it evaluates to `False`. In fact setting line https://github.com/pydata/xarray/blob/master/xarray/backends/api.py#L614 as follows solves the problem: ``` open_kwargs = dict(engine=engine, chunks=chunks, lock=lock, autoclose=autoclose, **kwargs) ``` I could not run the tests to see what breaks with this change as running `pytest` without *dask* fails with: ``` ../cpython3/lib/python3.7/site-packages/py/_path/local.py:668: in pyimport __import__(modname) xarray/tests/__init__.py:105: in if LooseVersion(dask.__version__) < '0.18': E AttributeError: module 'dask' has no attribute '__version__' ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2634/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,not_planned,13221727,issue 1215082284,I_kwDOAMm_X85IbK8s,6514,plugins.py:98: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.,226037,closed,0,,,4,2022-04-25T21:49:20Z,2022-04-27T01:07:50Z,2022-04-27T01:07:50Z,MEMBER,,,,"### What happened? The plugin interface warns with `DeprecationWarning` in python 3.10. ### What did you expect to happen? No warning to be issued. ### Minimal Complete Verifiable Example ```Python Running `pytest` on any *Xarray* importing test. ``` ### Relevant log output ```Python .../python3.10/site-packages/xarray/backends/plugins.py:98: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select. entrypoints = entry_points().get(""xarray.backends"", ()) ``` ### Anything else we need to know? According to the *Compatibity note* in: https://docs.python.org/3/library/importlib.metadata.html#entry-points the new API is `entry_points(group='xarray.backends')` ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:42:03) [Clang 12.0.1 ] python-bits: 64 OS: Darwin OS-release: 21.3.0 machine: arm64 processor: arm byteorder: little LC_ALL: None LANG: None LOCALE: (None, 'UTF-8') libhdf5: None libnetcdf: None xarray: 2022.3.0 pandas: 1.4.2 numpy: 1.22.3 scipy: 1.8.0 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: 2.11.3 cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.10 cfgrib: None iris: None bottleneck: None dask: 2022.04.1 distributed: 2022.4.1 matplotlib: 3.5.1 cartopy: None seaborn: None numbagg: None fsspec: 2022.3.0 cupy: None pint: None sparse: None setuptools: 62.1.0 pip: 22.0.4 conda: 4.12.0 pytest: 7.1.2 IPython: 8.2.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6514/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 852256995,MDU6SXNzdWU4NTIyNTY5OTU=,5125,Add `BackendEntrypoint` to an easier to find location,226037,closed,0,,,3,2021-04-07T10:21:16Z,2021-04-11T18:53:03Z,2021-04-11T18:53:03Z,MEMBER,,,,"**Is your feature request related to a problem? Please describe.** I started implementing a few backend plugins following the documentation so I noticed a few easily fixable quirks: http://xarray.pydata.org/en/latest/internals/how-to-add-new-backend.html The main one is the `BackendEntrypoint` is found deep into `xarray.backends.common`. **Describe the solution you'd like** I suggest to add an easier to find reference: * `xarray.backends.BackendEntrypoint` would do * but maybe even `xarray.BackendEntrypoint`. **Additional context** For the simplest plugins `BackendEntrypoint` would be the only import to connect to *xarray*. See this dummy GDAL plugin: https://github.com/bopen/xarray-gdal/blob/main/xarray_gdal/xarray_plugin.py But also the *rioxarray* plugin in this PR: corteva/rioxarray/pull/281","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5125/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 850231277,MDU6SXNzdWU4NTAyMzEyNzc=,5111,Rename of LazilyOuterIndexedArray to LazilyIndexedArray breaks rioxarray,226037,closed,0,,,0,2021-04-05T09:25:16Z,2021-04-06T09:18:49Z,2021-04-06T09:18:49Z,MEMBER,,,,"**What happened**: With current xarray `master` the `rioxarray.open_rasterio` crashes. **What you expected to happen**: With the released version 0.17.0 of xarray the open works as expected. **Minimal Complete Verifiable Example**: ```python >>> import rioxarray >>> rioxarray.open_rasterio(""myfile.tif"") --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in ----> 1 da = rioxarray.open_rasterio(""../../../FLAIR-PROC/rome-lockdown-2020/georeferenced/20200309+0130+417_VV-20200109-20200115-EPSG:32632-5.human-activity.tif"") 2 da /usr/local/Caskroom/miniconda/base/envs/BOP/lib/python3.8/site-packages/rioxarray/_io.py in open_rasterio(filename, parse_coordinates, chunks, cache, lock, masked, mask_and_scale, variable, group, default_name, **open_kwargs) 820 821 da_name = attrs.pop(""NETCDF_VARNAME"", default_name) --> 822 data = indexing.LazilyOuterIndexedArray( 823 RasterioArrayWrapper( 824 manager, AttributeError: module 'xarray.core.indexing' has no attribute 'LazilyOuterIndexedArray' ``` **Anything else we need to know?**: `LazilyOuterIndexedArray` was recently renamed to `LazilyIndexedArray` by @aurghs in https://github.com/pydata/xarray/pull/4810 after a suggestion from @shoyer https://github.com/pydata/xarray/pull/4810#discussion_r586754165 Adding an alias would make the transition easier.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5111/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 708459047,MDU6SXNzdWU3MDg0NTkwNDc=,4457,Silently ignoring user passed `engine` key in some cases when opening file objects,226037,closed,0,,,0,2020-09-24T20:37:37Z,2020-09-28T15:42:01Z,2020-09-28T15:42:01Z,MEMBER,,,,"**What happened**: When I `open()` a netCDF4 file and pass the file object to `xr.open_dataset` with `engine='scipy'` xarray silently ignores the value of the `engine` keyword and opens the file with `h5netcdf`. When opening an netCDF3 file with `engine='h5netcdf'` the `scipy` engine is used instead without warning. **What you expected to happen**: Silent autodetection of the engine is fine when passing `engine=None`, but it is very surprising when passing a value explicitly. I would have expected an exception or at least a warning. **Minimal Complete Verifiable Example**: ```python >>> xr.open_dataset('netCDF4.nc', engine='scipy') --------------------------------------------------------------------------- KeyError Traceback (most recent call last) [...] TypeError: Error: netCDF4.nc is not a valid NetCDF 3 file If this is a NetCDF4 file, you may need to install the netcdf4 library, e.g., $ pip install netcdf4 >>> fp = open('netCDF4.nc') >>> xr.open_dataset(fp, engine='scipy') Dimensions: (line: 41587, pixel: 17751) Coordinates: * line (line) int64 0 1 2 3 4 5 ... 41582 41583 41584 41585 41586 * pixel (pixel) int64 0 1 2 3 4 5 ... 17746 17747 17748 17749 17750 Data variables: phase (line, pixel) float32 ... Attributes: Conventions: CF-1.7 [...] ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4457/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 368003448,MDU6SXNzdWUzNjgwMDM0NDg=,2475,Please add support for GRIB files via ECMWF cfgrib / ecCodes,226037,closed,0,,,2,2018-10-09T01:04:24Z,2018-10-17T17:17:36Z,2018-10-17T17:14:21Z,MEMBER,,,,"The [*cfgrib* project](https://pypi.org/project/cfgrib/) offers to open a GRIB file as an `xarray.Dataset`: ``` >>> import cfgrib >>> cfgrib.open_dataset('era5-levels-members.grib') Dimensions: (air_pressure: 2, latitude: 61, longitude: 120, number: 10, time: 4) Coordinates: * number (number) int64 0 1 2 3 4 5 6 7 8 9 * time (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00 step timedelta64[ns] ... * air_pressure (air_pressure) float64 850.0 500.0 * latitude (latitude) float64 90.0 87.0 84.0 81.0 ... -84.0 -87.0 -90.0 * longitude (longitude) float64 0.0 3.0 6.0 9.0 ... 351.0 354.0 357.0 valid_time (time) datetime64[ns] ... Data variables: z (number, time, air_pressure, latitude, longitude) float32 ... t (number, time, air_pressure, latitude, longitude) float32 ... Attributes: GRIB_edition: 1 GRIB_centre: ecmf GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts GRIB_subCentre: 0 history: GRIB to CDM+CF via cfgrib-0.9.../ecCodes-2... ``` It would be very helpful to have a backend for it distributed with *xarray* to be selected via the `engine` keyword argument: ``` >>> import xarray as xr >>> xr.open_dataset('era5-levels-members.grib', engine='cfgrib') Dimensions: (air_pressure: 2, latitude: 61, longitude: 120, number: 10, time: 4) Coordinates: * number (number) int64 0 1 2 3 4 5 6 7 8 9 * time (time) datetime64[ns] 2017-01-01 ... 2017-01-02T12:00:00 step timedelta64[ns] ... * air_pressure (air_pressure) float64 850.0 500.0 * latitude (latitude) float64 90.0 87.0 84.0 81.0 ... -84.0 -87.0 -90.0 * longitude (longitude) float64 0.0 3.0 6.0 9.0 ... 351.0 354.0 357.0 valid_time (time) datetime64[ns] ... Data variables: z (number, time, air_pressure, latitude, longitude) float32 ... t (number, time, air_pressure, latitude, longitude) float32 ... Attributes: GRIB_edition: 1 GRIB_centre: ecmf GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts GRIB_subCentre: 0 history: GRIB to CDM+CF via cfgrib-0.9.../ecCodes-2... ``` cc @StephanSiemen @iainrussell","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2475/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue