What happened?
Passing chunks=None to xr.open_dataset/open_mfdataset is supposed to avoid using dask at all, returning lazily-indexed numpy arrays even if dask is installed. However chunks=None doesn't currently work for xr.open_mfdataset as it gets silently coerced internally to chunks={}, which creates dask chunks aligned with the on-disk files.
Offending line of code:
|
open_kwargs = dict(engine=engine, chunks=chunks or {}, **kwargs) |
What did you expect to happen?
Passing chunks=None to open_mfdataset should return lazily-indexed numpy arrays, like open_dataset does.
Minimal Complete Verifiable Example
ds = xr.tutorial.open_dataset("air_temperature")
ds1 = ds.isel(time=slice(None, 1000))
ds2 = ds.isel(time=slice(1000, None))
ds1.to_netcdf('air1.nc')
ds2.to_netcdf('air2.nc')
combined = xr.open_mfdataset(['air1.nc', 'air2.nc'], chunks=None)
print(type(combined['air'].data))
MVCE confirmation
Relevant log output
Anything else we need to know?
As the default is None, changing this without changing the default would be a breaking change. But the current behaviour is also not intended.
Environment
main
What happened?
Passing
chunks=Nonetoxr.open_dataset/open_mfdatasetis supposed to avoid using dask at all, returning lazily-indexed numpy arrays even if dask is installed. Howeverchunks=Nonedoesn't currently work forxr.open_mfdatasetas it gets silently coerced internally tochunks={}, which creates dask chunks aligned with the on-disk files.Offending line of code:
xarray/xarray/backends/api.py
Line 1040 in 12123be
What did you expect to happen?
Passing
chunks=Nonetoopen_mfdatasetshould return lazily-indexed numpy arrays, likeopen_datasetdoes.Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
As the default is
None, changing this without changing the default would be a breaking change. But the current behaviour is also not intended.Environment
main