def test_basic(self): """Test that the plugin returns an Iris.cube.Cube with the expected name""" result = Plugin()._probabilities_to_percentiles( self.cube, self.percentiles, self.bounds_pairing ) self.assertIsInstance(result, Cube) self.assertEqual(result.name(), "air_temperature")
def test_metadata(self): """Test name and cell methods are updated as expected after conversion""" threshold_coord = find_threshold_coordinate(self.cube) expected_name = threshold_coord.name() expected_units = threshold_coord.units # add a cell method indicating "max in period" for the underlying data self.cube.add_cell_method( CellMethod("max", coords="time", comments=f"of {expected_name}")) expected_cell_method = CellMethod("max", coords="time") result = Plugin().process(self.cube) self.assertEqual(result.name(), expected_name) self.assertEqual(result.units, expected_units) self.assertEqual(result.cell_methods[0], expected_cell_method)
def test_vicinity_metadata(self): """Test vicinity cube name is correctly regenerated after processing""" self.cube.rename("probability_of_air_temperature_in_vicinity_above_threshold") result = Plugin().process(self.cube) self.assertEqual(result.name(), "air_temperature_in_vicinity")