diff --git a/tests/test_accessors.py b/tests/test_accessors.py index 4157b4e1..625ff0b2 100644 --- a/tests/test_accessors.py +++ b/tests/test_accessors.py @@ -108,10 +108,11 @@ def test_dataarray_destagger_with_postprocess(test_grid): # Check staggered to unstaggered dimension coordinate handling xr.testing.assert_allclose(destaggered['x'], postprocessed['x']) - # Check attributes are preserved + # Check attributes are preserved, other than those made invalid by destaggering assert set(destaggered.attrs.keys()) == set(data.attrs.keys()) - { 'stagger', } + assert 'c_grid_axis_shift' not in destaggered['x'].attrs @pytest.mark.parametrize('test_grid', ['lambert_conformal', 'mercator'], indirect=True) diff --git a/xwrf/destagger.py b/xwrf/destagger.py index 7e09d225..5750e076 100644 --- a/xwrf/destagger.py +++ b/xwrf/destagger.py @@ -69,7 +69,7 @@ def _destag_variable(datavar, stagger_dim=None, unstag_dim_name=None): return xr.Variable( dims=tuple(str(unstag_dim_name) if dim == stagger_dim else dim for dim in center_mean.dims), data=center_mean.data, - attrs=_drop_attrs(datavar.attrs, ('stagger',)), + attrs=_drop_attrs(datavar.attrs, ('stagger', 'c_grid_axis_shift')), encoding=datavar.encoding, fastpath=True, )