示例#1
0
 def test_basic(self):
     """
     Test that the plugin returns an iris.cube.Cube, the cube has a
     realization coordinate and is correctly re-ordered to match the source
     realizations.
     """
     expected_data = self.raw_cube.data.copy()
     result = Plugin().process(self.post_processed_percentiles, self.raw_cube)
     self.assertIsInstance(result, Cube)
     self.assertTrue(result.coords("realization"))
     self.assertArrayEqual(result.coord("realization").points, [0, 1, 2])
     self.assertArrayAlmostEqual(result.data, expected_data)
示例#2
0
 def test_basic_masked_input_data_not_nans(self):
     """
     Test that the plugin returns an iris.cube.Cube, the cube has a
     realization coordinate with specific realization numbers and is
     correctly re-ordered to match the source realizations, when the
     input data is masked and the masked data is not a nan.
     """
     # Assuming input data and raw ensemble are masked in the same way.
     self.raw_cube.data[:, 0, 0] = 1000
     self.raw_cube.data = np.ma.masked_equal(self.raw_cube.data, 1000)
     self.post_processed_percentiles.data[:, 0, 0] = 1000
     self.post_processed_percentiles.data = np.ma.masked_equal(
         self.post_processed_percentiles.data, 1000)
     expected_data = self.raw_cube.data.copy()
     result = Plugin().process(self.post_processed_percentiles,
                               self.raw_cube)
     self.assertIsInstance(result, Cube)
     self.assertTrue(result.coords("realization"))
     self.assertEqual(result.coord("realization"),
                      self.raw_cube.coord("realization"))
     self.assertArrayAlmostEqual(result.data, expected_data)
     self.assertArrayEqual(result.data.mask, expected_data.mask)