-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
Since "2025.11.0", xarray's default for keep_attrs is now True. When we call ds.cf.add_bounds(...) the attributes from the coordinate are copied over to the created bounds, which is incorrect and breaks cf-xarray as the new bounds are now also detected as a coordinate.
Example:
import cf_xarray as cfxr
import xarray as xr
ds = xr.tutorial.open_dataset('air_temperature')
dsb = ds.cf.add_bounds('longitude')ds.cf:
Coordinates:
CF Axes: * X: ['lon']
* Y: ['lat']
* T: ['time']
Z: n/a
CF Coordinates: * longitude: ['lon']
* latitude: ['lat']
* time: ['time']
vertical: n/a
[...]
dsb.cf:
Coordinates:
CF Axes: X: ['lon', 'lon_bounds']
* Y: ['lat']
* T: ['time']
Z: n/a
CF Coordinates: longitude: ['lon', 'lon_bounds']
* latitude: ['lat']
* time: ['time']
vertical: n/a
lon_bounds should not be there.
I can suggest a PR.
Metadata
Metadata
Assignees
Labels
No labels