# -*- coding: utf-8 -*-
#
# test_input_shapes.py
#
# purpose:  Test gpan with various input shapes.
# author:   Filipe P. A. Fernandes
# e-mail:   ocefpaf@gmail
# web:      http://ocefpaf.github.io/
# created:  06-Aug-2013
# modified: Tue 06 Aug 2013 09:54:30 AM BRT
#
# obs:
#

import numpy as np
import seawater as sw

# Load data.
with np.load('shapes.npz') as shapes:
    cp = shapes['cp']
    lon = shapes['lon']
    lat = shapes['lat']
    dens = shapes['dens']
    depth = shapes['depth']
    s_mean = shapes['s_mean']
    t_mean = shapes['t_mean']
    pt_mean = shapes['pt_mean']
    steric_height = shapes['steric_height']


# 1D.
steric_height_new = sw.gpan(s_mean[:, 0, 0], t_mean[:, 0, 0], depth)
np.testing.assert_array_almost_equal(steric_height[:, 0, 0], steric_height_new)

# 2D.
steric_height_new = sw.gpan(s_mean[..., 1], t_mean[..., 1],
                            depth[..., None])
np.testing.assert_array_almost_equal(steric_height[..., 1], steric_height_new)

# 3D.
steric_height_new = sw.gpan(s_mean, t_mean, depth[..., None, None])
np.testing.assert_array_almost_equal(steric_height, steric_height_new)

@@ -236,30 +236,30 @@
 Tue 
-06 Aug
+14 Oct
  201
-3 09:54:30 A
+4 01:49:09 P
 M BR
@@ -276,63 +276,261 @@
 %0A#%0A%0A
-import numpy as np%0Aimport seawater as sw%0A%0A# Load data.%0A
+from __future__ import division%0A%0Aimport os%0Aimport unittest%0A%0Aimport numpy as np%0Aimport seawater as sw%0A%0Arootpath = os.path.dirname(__file__)%0Afname = os.path.join(rootpath, 'shapes.npz')%0A%0A%0Aclass InputShapes(unittest.TestCase):%0A    def setUp(self):%0A        
 with
@@ -538,28 +538,21 @@
 np.load(
-'shapes.npz'
+fname
 ) as sha
@@ -560,16 +560,29 @@
 es:%0A    
+        self.
 cp = sha
@@ -595,16 +595,29 @@
 p'%5D%0A    
+        self.
 lon = sh
@@ -632,16 +632,29 @@
 n'%5D%0A    
+        self.
 lat = sh
@@ -669,16 +669,29 @@
 t'%5D%0A    
+        self.
 dens = s
@@ -704,24 +704,37 @@
 'dens'%5D%0A    
+        self.
 depth = shap
@@ -749,16 +749,29 @@
 h'%5D%0A    
+        self.
 s_mean =
@@ -792,16 +792,29 @@
 n'%5D%0A    
+        self.
 t_mean =
@@ -835,16 +835,29 @@
 n'%5D%0A    
+        self.
 pt_mean 
@@ -880,16 +880,29 @@
 n'%5D%0A    
+        self.
 steric_h
@@ -938,15 +938,105 @@
 '%5D%0A%0A
-%0A# 1D.%0A
+    def tearDown(self):%0A        unittest.TestCase.tearDown(self)%0A%0A    def test_1D(self):%0A        
 ster
@@ -1055,24 +1055,29 @@
 w = sw.gpan(
+self.
 s_mean%5B:, 0,
@@ -1081,16 +1081,21 @@
  0, 0%5D, 
+self.
 t_mean%5B:
@@ -1106,16 +1106,65 @@
  0%5D,
- depth)%0A
+%0A                                    self.depth)%0A        
 np.t
@@ -1188,32 +1188,37 @@
 ay_almost_equal(
+self.
 steric_height%5B:,
@@ -1228,35 +1228,105 @@
  0%5D,
- steric_height_new)%0A%0A# 2D.%0A
+%0A                                             steric_height_new)%0A%0A    def test_2D(self):%0A        
 ster
@@ -1345,24 +1345,29 @@
 w = sw.gpan(
+self.
 s_mean%5B..., 
@@ -1370,16 +1370,21 @@
 .., 1%5D, 
+self.
 t_mean%5B.
@@ -1419,16 +1419,29 @@
         
+        self.
 depth%5B..
@@ -1442,32 +1442,40 @@
 pth%5B..., None%5D)%0A
+        
 np.testing.asser
@@ -1487,32 +1487,37 @@
 ay_almost_equal(
+self.
 steric_height%5B..
@@ -1526,35 +1526,105 @@
  1%5D,
- steric_height_new)%0A%0A# 3D.%0A
+%0A                                             steric_height_new)%0A%0A    def test_3D(self):%0A        
 ster
@@ -1651,16 +1651,21 @@
 pan(
+self.
 s_mean, 
 t_me
@@ -1664,16 +1664,62 @@
 an, 
+self.
 t_mean,
- 
+%0A                                    self.
 dept
@@ -1738,16 +1738,24 @@
  None%5D)%0A
+        
 np.testi
@@ -1783,16 +1783,21 @@
 t_equal(
+self.
 steric_h
@@ -1802,16 +1802,61 @@
 _height,
+%0A                                            
  steric_

Test correct input shape/result.