From 13ab9cf21d31211f2d583e68efac62f6e068f332 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 29 Nov 2022 15:34:10 -0300 Subject: [PATCH 1/3] ensure the slice is an array --- gsw/geostrophy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsw/geostrophy.py b/gsw/geostrophy.py index 42e2328..ecbab8f 100644 --- a/gsw/geostrophy.py +++ b/gsw/geostrophy.py @@ -78,7 +78,7 @@ def geo_strf_dyn_height(SA, CT, p, p_ref=0, axis=0, max_dp=1.0, except AttributeError: order = 'C' # e.g., xarray DataArray doesn't have flags for ind in indexer(SA.shape, axis, order=order): - igood = goodmask[ind] + igood = np.array(goodmask[ind]) # If p_ref is below the deepest value, skip the profile. pgood = p[ind][igood] if len(pgood) > 1 and pgood[-1] >= p_ref: From b38d6210c26282a402cdef6fda9483dc30684a80 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 29 Nov 2022 16:10:37 -0300 Subject: [PATCH 2/3] review actions --- gsw/geostrophy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gsw/geostrophy.py b/gsw/geostrophy.py index ecbab8f..33038da 100644 --- a/gsw/geostrophy.py +++ b/gsw/geostrophy.py @@ -78,7 +78,8 @@ def geo_strf_dyn_height(SA, CT, p, p_ref=0, axis=0, max_dp=1.0, except AttributeError: order = 'C' # e.g., xarray DataArray doesn't have flags for ind in indexer(SA.shape, axis, order=order): - igood = np.array(goodmask[ind]) + # this is needed to support xarray inputs for numpy < 1.23 + igood = np.asanyarray(goodmask[ind]) # If p_ref is below the deepest value, skip the profile. pgood = p[ind][igood] if len(pgood) > 1 and pgood[-1] >= p_ref: From 99e6337f2324099ba531ab907ce445b9fdf9babb Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 29 Nov 2022 16:41:18 -0300 Subject: [PATCH 3/3] asarray --- gsw/geostrophy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsw/geostrophy.py b/gsw/geostrophy.py index 33038da..53c0a52 100644 --- a/gsw/geostrophy.py +++ b/gsw/geostrophy.py @@ -79,7 +79,7 @@ def geo_strf_dyn_height(SA, CT, p, p_ref=0, axis=0, max_dp=1.0, order = 'C' # e.g., xarray DataArray doesn't have flags for ind in indexer(SA.shape, axis, order=order): # this is needed to support xarray inputs for numpy < 1.23 - igood = np.asanyarray(goodmask[ind]) + igood = np.asarray(goodmask[ind]) # If p_ref is below the deepest value, skip the profile. pgood = p[ind][igood] if len(pgood) > 1 and pgood[-1] >= p_ref: