Пример #1
0
 def test_collapse(self):
     shape = (1, 2, 1)
     data = np.empty(shape)
     levels = np.array([123])
     result = create_cube(self.cube, data, levels)
     expected = _make_cube(data, aux_coord=False, dim_coord=False)[0]
     vcoord = _make_vcoord(levels)
     expected.add_aux_coord(vcoord)
     self.assertEqual(result, expected)
Пример #2
0
 def test_non_monotonic(self):
     shape = (2, 2, 1)
     data = np.empty(shape)
     levels = np.array([10, 10])
     result = create_cube(self.cube, data, levels)
     expected = _make_cube(data, aux_coord=False, dim_coord=False)
     vcoord = _make_vcoord(levels)
     expected.add_aux_coord(vcoord, 0)
     self.assertEqual(result, expected)
Пример #3
0
 def test(self):
     shape = (2, 2, 1)
     data = np.empty(shape)
     levels = np.array([10, 20])
     result = create_cube(self.cube, data,
                          self.cube.coord(axis='z', dim_coords=True),
                          levels)
     expected = _make_cube(data, aux_coord=False, dim_coord=False)
     vcoord = _make_vcoord(levels)
     expected.add_dim_coord(vcoord, 0)
     self.assertEqual(result, expected)
Пример #4
0
 def test_invalid_shape__data_mismatch_with_levels(self):
     levels = np.array([0, 1])
     emsg = 'Mismatch between data and levels'
     with self.assertRaisesRegex(ValueError, emsg):
         create_cube(self.cube, self.cube.data, levels)