Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use swap_dims and set_index to rename xarray dims
The xarray team is currently deprecating how the xarray.DataArray.rename() method works. Specifcally, renaming an xarray.DataArray no longer creates an indexed coordinate. Using the rename() method will generate the following warning for a given dimesion: 580: UserWarning: rename 't' to 't' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate. return xarr.rename(dim_map) This commit uses swap_dims() with set_index() to swap the dimensions (i.e. rename them) and then reassert the indexed coordinates.
- Loading branch information