-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
empty attributes silently change #6970
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
Comments
A less invasive change would be to pass Lines 746 to 751 in b018442
(and similarly in all the other but lets see what @crusaderky thinks. These are strictly different, but the difference should not matter for the user. |
It is not an easy fix since we do not simply want to return None, and returning an empty dict in this case without overwriting the internal one would break things like Maybe the solution from @dcherian is the best for now. |
I think the bug here is the use of |
What happened?
When
attrs
are not specified in a new Dataset/DataArray, they're changed to{}
whenever they are used.Because of that, an object can slightly change silently.
What did you expect to happen?
In the example below, the tokens should be identical.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
I thought we could store
{}
since the very beginning, adding the following here:But a few tests failed, so it's probably the wrong way to fix this:
Environment
INSTALLED VERSIONS
commit: None
python: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:43:44) [Clang 13.0.1 ]
python-bits: 64
OS: Darwin
OS-release: 21.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: (None, 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.8.1
xarray: 2022.6.0
pandas: 1.4.3
numpy: 1.23.2
scipy: None
netCDF4: 1.6.0
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.12.0
cftime: 1.6.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: 0.9.10.1
iris: None
bottleneck: None
dask: 2022.8.1
distributed: 2022.8.1
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: 2022.7.1
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 65.3.0
pip: 22.2.2
conda: None
pytest: 7.1.2
IPython: 8.4.0
sphinx: 5.1.1
The text was updated successfully, but these errors were encountered: