You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Preserve attributes by default in all operations
This change modifies xarray's default behavior to preserve attributes (`attrs`) across all operations, including computational, binary, and data manipulation functions. Previously, attributes were dropped by default unless `keep_attrs=True` was explicitly set. This new default aligns xarray with common scientific workflows where metadata preservation is crucial.
The `keep_attrs` option now defaults to `True` for most operations. For binary operations, attributes are preserved from the left-hand operand.
Users can revert to the previous behavior (dropping attributes) by:
- Setting `xr.set_options(keep_attrs=False)` globally.
- Passing `keep_attrs=False` to specific operations.
- Using `with xr.set_options(keep_attrs=False):` for a code block.
- Calling `.drop_attrs()` after an operation.
This is a breaking change for users who relied on attributes being dropped by default.
Co-authored-by: Claude <[email protected]>
0 commit comments