Skip to content

Commit

Permalink
fixes MITgcm#224
Browse files Browse the repository at this point in the history
  • Loading branch information
rabernat committed Nov 12, 2020
1 parent d58802d commit 8ad8267
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions xmitgcm/llcreader/llcmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ def _get_1d_chunk(store, varname, klevels, nz, dtype):
buffer = file.read(read_length)
data = np.frombuffer(buffer,dtype=dtype)

# now subset: is this line broken?
return data[klevels]

class BaseLLCModel:
Expand Down Expand Up @@ -533,12 +532,12 @@ def _get_kp1_levels(self,k_levels):
# determine kp1 levels
# get borders to all k (center) levels
# ki used to get Zu, Zl later
ku = np.concatenate([k_levels[1:],[k_levels[-1]+1]])
ku = k_levels[1:] + [k_levels[-1] + 1 ]
kp1 = []
ki=[]
for i,(x,y) in enumerate(zip(k_levels,ku)):
kp1+= [x] if x not in kp1 else []
kp1+= [y] if y-x==1 else [x+1]
kp1 += [x] if x not in kp1 else []
kp1 += [y] if y-x==1 else [x+1]


kp1=np.array(kp1)
Expand Down Expand Up @@ -711,7 +710,7 @@ def _if_not_none(a, b):
if type=='latlon':
ds = _faces_coords_to_latlon(ds)

k_levels = k_levels or np.arange(self.nz)
k_levels = k_levels or list(range(self.nz))
kp1_levels = self._get_kp1_levels(k_levels)

ds = ds.sel(k=k_levels, k_l=k_levels, k_u=k_levels, k_p1=kp1_levels)
Expand Down

0 comments on commit 8ad8267

Please sign in to comment.