-
-
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
DataArray().drop_attrs(deep=False) doesn't do anything #10027
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
I see now that should have opened the issue from the issues tab. If required, I can close this and open a new issue using the template. |
My initial guess, that the dataarray attributes survived in a copy of itself, was wrong. I believe the answer is much simpler: I believe that in xarray/xarray/core/dataarray.py Line 7579 in 160cced
_to_temp_dataset() wraps the variable in a Dataset, consequently .drop_attrs() only drops the dataset, but not the dataarray attributes if deep=False - see Line 10931 in 160cced
|
I will leave it here because I can't think of a satisfying solution. Allowing the argument Changing Dataset().drop_attrs() to drop variable attributes, even with Using a new |
[Edit] I didn't see any issue templates because I took the route via opening an issue linked to a line of code, which seems to have failed anyway.
I tried to drop DataArray attributes without dropping the coordinate attributes. For this, I set
deep=False
in the dataarray's method.drop_attrs()
. This did not work.Environment
Minimal example to reproduce
results in
The attributes should have been dropped but they are still present.
my initial guess
[Edit] removed, was wrong, see below
The text was updated successfully, but these errors were encountered: