From 118a3b8b83369bcab9532f0b41c4e2b8a23bc635 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Tue, 11 Aug 2015 17:58:08 -0300 Subject: [PATCH] Fix get_surface() bug. --- tardis/tardis.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tardis/tardis.py b/tardis/tardis.py index 24025fa..525afea 100644 --- a/tardis/tardis.py +++ b/tardis/tardis.py @@ -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