-
Notifications
You must be signed in to change notification settings - Fork 41
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
CF coordinates get forgotten after operation modifying coordinates #396
Comments
Hi @angus-g ! The correct CF coordinates are defined through attributes of the DataArray. I believe this would work: d.mean('time', keep_attrs=True).cf.coordinates Xarray drops the attributes after most operations, as the old attributes might not be applicable anymore. You can also override this behaviour globally with : import xarray as xr
xr.set_options(keep_attrs=True) |
Looking at that notebook, I see you have I'm beginning to think the choice to look in Maybe cf-xarray should provide a function that copies "interpretable" attributes from |
@dcherian I have struggled with the invisibility of |
Might another option be to adopt something like |
I have a DataArray that's similar, but not quite the same as the
popds
example dataset (the axes aren't labelled, and it has a time dimension):And of course, the coordinates get correctly decoded:
But if I take the time mean of this dataset, the correct coordinates get forgotten:
The text was updated successfully, but these errors were encountered: