Commit 70e9ba10 authored by Jan Klaus Rieck's avatar Jan Klaus Rieck

getbox(): do not try to remove halo-points from coordinates that do not exist

parent ab7c95c0
Pipeline #3617 failed with stage
in 50 seconds
......@@ -279,8 +279,11 @@ def getbox(dataset, time=None, depth=None, y=None, x=None, surf=False):
x = np.array(x) if x else np.array([-50, -80])
# make sure the halo points of the global ORCA grid are dropped
ds = dataset.isel(x_c=slice(1, len(dataset['x_c']) - 1),
x_r=slice(1, len(dataset['x_r']) - 1))
if 'x_c' in dataset:
dataset = dataset.isel(x_c=slice(1, len(dataset['x_c']) - 1))
elif 'x_r' in dataset:
dataset = dataset.isel(x_r=slice(1, len(dataset['x_r']) - 1))
ds = dataset
# extract the time slice
ds = ds.sel(t=slice(time[0], time[1]))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment