From 4214f91927e90a290b84759de595a020f5bb788e Mon Sep 17 00:00:00 2001 From: Tom Vo Date: Mon, 26 Sep 2022 16:18:26 -0700 Subject: [PATCH] Update `circular_index` to `index_with_360` --- xcdat/axis.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xcdat/axis.py b/xcdat/axis.py index 02733ec8..a608a1a5 100644 --- a/xcdat/axis.py +++ b/xcdat/axis.py @@ -338,9 +338,9 @@ def _swap_lon_axis(coords: xr.DataArray, to: Tuple[float, float]) -> xr.DataArra # value of 0 (360 % 360 is 0) back to 360. This case usually happens # if the coordinate are already on the (0, 360) axis orientation. # Example with 360 coords: [60, 150, 0] -> [60, 150, 360] - circular_index = np.where(coords == 360) + index_with_360 = np.where(coords == 360) - if len(circular_index) > 0: + if len(index_with_360) > 0: # Must load lazy, multidimensional Dask arrays into into eager, # in-memory NumPy arrays before manipulating its values. Otherwise, # it raises `NotImplementedError xarray can't set arrays with @@ -348,7 +348,7 @@ def _swap_lon_axis(coords: xr.DataArray, to: Tuple[float, float]) -> xr.DataArra if isinstance(new_coords.data, Array) and new_coords.ndim > 1: new_coords.load() - new_coords[circular_index] = 360 + new_coords[index_with_360] = 360 else: raise ValueError( "Currently, only (-180, 180) and (0, 360) are supported longitude axis "