-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DataTree attribute-like access bug #9928
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Thank you for this bug report! That definitely shouldn't be happening. I suspect that it's going wrong in the |
I am not sure if this is the case, but could this indicate a possible memory error? With large datasets, it seems that the dataset is not overwritten, but both versions are stored. In situations where memory is constrained, this can be undesirable. However, I am not certain if this is truly an issue, as I have not encountered memory errors due to this. I will stick to the issue at hand, but this was just a thought. |
I just tried a similar operation with a >>> ds1.variable1 = ds1.variable1.sel(x=slice(1, 5)) This results in an
I think the same behavior should apply to I don't have a full solution yet, but I thought it was interesting to check the |
I don't think so - your example reproduces the error with a very small variable.
Yes! That's what supposed to happen here. in https://docs.xarray.dev/en/stable/user-guide/data-structures.html#dataset-contents it says
That's the behaviour we also want for The bug is somewhere in the implementation of this class https://github.com/pydata/xarray/blob/main/xarray/core/common.py#L370 @owenlittlejohns I remember we had some issues integrating the |
I'm not certain, but could this be caused by the presence of Edit: see #9068 |
Oh good catch @keewis ! So the question now is how we can get rid of |
Change the mixin from |
Looks like @keewis beat me to mentioning this issue: #9068. Just swapping out the |
What happened?
I have a datatree with a dataset in a group. I tried to filter this dataset and store in the datatree. The dataset showed the filtered dataset and the unfiltered dataset, depending on the method to get the group.
dt.variable1
ordt['variable1']
.What did you expect to happen?
I expect that both datasets are equal.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.13.1 | packaged by Anaconda, Inc. | (main, Dec 11 2024, 17:02:46) [MSC v.1929 64 bit (AMD64)]
python-bits: 64
OS: Windows
OS-release: 11
machine: AMD64
processor: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('English_United States', '1252')
libhdf5: None
libnetcdf: None
xarray: 2025.1.0
pandas: 2.2.3
numpy: 2.2.1
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
zarr: None
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 75.1.0
pip: 24.2
conda: None
pytest: None
mypy: None
IPython: None
sphinx: None
The text was updated successfully, but these errors were encountered: