Skip to content

Commit

Permalink
Merge pull request #14 from ocefpaf/get_surface_bug
Browse files Browse the repository at this point in the history
get_surface_bug
  • Loading branch information
ocefpaf committed Aug 11, 2015
2 parents 0bd4d7f + 118a3b8 commit 808281b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tardis/tardis.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,17 @@ def get_surface(cube):
"""
z = z_coord(cube)
if z:
if np.argmin(z.shape) == 0 and z.ndim == 2:
points = z[:, 0].points
elif np.argmin(z.shape) == 1 and z.ndim == 2:
points = z[0, :].points
else:
points = z.points
positive = z.attributes.get('positive', None)
if positive == 'up':
idx = np.unique(z.points.argmax(axis=0))[0]
idx = np.unique(points.argmax(axis=0))[0]
else:
idx = np.unique(z.points.argmin(axis=0))[0]
idx = np.unique(points.argmin(axis=0))[0]
return cube[:, int(idx), ...]
else:
return cube
Expand Down

0 comments on commit 808281b

Please sign in to comment.