예제 #1
0
 def test_numpy_scalar_coord(self):
     value = 1
     points = np.array(value)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 2)
     expected = np.array(value).reshape(1, 1)
     self.assertArrayEqual(result, expected)
예제 #2
0
 def test_numpy_scalar_coord(self):
     value = 1
     points = np.array(value)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 2)
     expected = np.array(value).reshape(1, 1)
     self.assertArrayEqual(result, expected)
예제 #3
0
 def test_lazy_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = as_lazy_data(raw_points, raw_points.shape)
     coord = AuxCoord(points)
     self.assertTrue(is_lazy_data(coord.core_points()))
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertTrue(is_lazy_data(coord.core_points()))
     self.assertTrue(is_lazy_data(result))
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #4
0
 def test_biggus_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = biggus.NumpyArrayAdapter(raw_points)
     coord = iris.coords.AuxCoord(points)
     self.assertIsInstance(coord._points, biggus.Array)
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertIsInstance(coord._points, biggus.Array)
     self.assertIsInstance(result, biggus.Array)
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #5
0
 def test_lazy_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = as_lazy_data(raw_points, raw_points.shape)
     coord = AuxCoord(points)
     self.assertTrue(is_lazy_data(coord.core_points()))
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertTrue(is_lazy_data(coord.core_points()))
     self.assertTrue(is_lazy_data(result))
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
 def test_biggus_complex(self):
     raw_points = np.arange(12).reshape(4, 3)
     points = biggus.NumpyArrayAdapter(raw_points)
     coord = iris.coords.AuxCoord(points)
     self.assertIsInstance(coord._points, biggus.Array)
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     # Check we haven't triggered the loading of the coordinate values.
     self.assertIsInstance(coord._points, biggus.Array)
     self.assertIsInstance(result, biggus.Array)
     expected = raw_points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #7
0
 def test_numpy_complex(self):
     points = np.arange(12).reshape(4, 3)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     expected = points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #8
0
 def test_numpy_simple(self):
     points = np.arange(12).reshape(4, 3)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (0, 1), 2)
     expected = points
     self.assertArrayEqual(result, expected)
예제 #9
0
 def test_numpy_scalar_coord__zero_ndim(self):
     points = np.array(1)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 0)
     expected = np.array([1])
     self.assertArrayEqual(result, expected)
예제 #10
0
 def test_numpy_complex(self):
     points = np.arange(12).reshape(4, 3)
     coord = iris.coords.AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (3, 2), 5)
     expected = points.T[np.newaxis, np.newaxis, ..., np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #11
0
 def test_numpy_simple(self):
     points = np.arange(12).reshape(4, 3)
     coord = iris.coords.AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (0, 1), 2)
     expected = points
     self.assertArrayEqual(result, expected)
예제 #12
0
 def test_numpy_scalar_cooord(self):
     points = np.arange(1)
     coord = iris.coords.AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 2)
     expected = points[np.newaxis]
     self.assertArrayEqual(result, expected)
예제 #13
0
 def test_numpy_scalar_coord__zero_ndim(self):
     points = np.array(1)
     coord = AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 0)
     expected = np.array([1])
     self.assertArrayEqual(result, expected)
예제 #14
0
 def test_numpy_scalar_cooord(self):
     points = np.arange(1)
     coord = iris.coords.AuxCoord(points)
     result = AuxCoordFactory._nd_points(coord, (), 2)
     expected = points[np.newaxis]
     self.assertArrayEqual(result, expected)