Skip to content

Commit

Permalink
altering rename_cmip6 to retain coord info instead of dropping (#345)
Browse files Browse the repository at this point in the history
* altering rename_cmip6 to retain coord info instead of dropping

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
emmomp and pre-commit-ci[bot] authored Apr 11, 2024
1 parent c1fac31 commit 479f2e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xmip/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def _maybe_rename_dims(da, rdict):
if di in candidates:
da = da.swap_dims({di: target})
if di in da.coords:
da = da.drop_vars(di)
if not di == target:
da = da.rename({di: target}).set_xindex(target)
return da

# first take care of the dims and reconstruct a clean ds
Expand Down

0 comments on commit 479f2e7

Please sign in to comment.