Deltares / xugrid

Xarray and unstructured grids
https://deltares.github.io/xugrid/
MIT License
58 stars 8 forks source link

Resolve `Dataset.dims` FutureWarning #190

Closed veenstrajelmer closed 1 month ago

veenstrajelmer commented 8 months ago

The below code gives a FutureWarning with xarray 2023.12.0:

import xugrid as xu
import dfm_tools as dfmt
file_nc = dfmt.data.fm_curvedbend_map(return_filepath=True)
uds = xu.open_dataset(file_nc)

"[...]\site-packages\xarray\core\utils.py:494: FutureWarning: The return type ofDataset.dimswill be changed to return a set of dimension names in future, in order to be more consistent withDataArray.dims. To access a mapping from dimension names to lengths, please useDataset.sizes."

The used netcdf file is also available on opendap.

Also happens in: C:\DATA\xugrid\xugrid\ugrid\partitioning.py:384: FutureWarning: The return type ofDataset.dimswill be changed to return a set of dimension names in future, in order to be more consistent withDataArray.dims. To access a mapping from dimension names to lengths, please useDataset.sizes. chunks[dim] = (merged.dims[dim],)

JoerivanEngelen commented 6 months ago

Relevant xarray issue: https://github.com/pydata/xarray/issues/8496