Ejemplo n.º 1
0
 def test_check_exception_is_raised(self):
     """
     Test that the expected results are returned for the bounds_pairing.
     """
     cube_name = "nonsense"
     cube_units = Unit("degreesC")
     msg = "The bounds_pairing_key"
     with self.assertRaisesRegex(KeyError, msg):
         get_bounds_of_distribution(cube_name, cube_units)
Ejemplo n.º 2
0
 def test_check_data(self):
     """
     Test that the expected results are returned for the bounds_pairing.
     """
     cube_name = "air_temperature"
     cube_units = Unit("degreesC")
     bounds_pairing = (-100, 60)
     result = (get_bounds_of_distribution(cube_name, cube_units))
     self.assertArrayAlmostEqual(result, bounds_pairing)
Ejemplo n.º 3
0
 def test_check_unit_conversion(self):
     """
     Test that the expected results are returned for the bounds_pairing,
     if the units of the bounds_pairings need to be converted to match
     the units of the forecast.
     """
     cube_name = "air_temperature"
     cube_units = Unit("fahrenheit")
     bounds_pairing = (-148, 140)  # In fahrenheit
     result = (get_bounds_of_distribution(cube_name, cube_units))
     self.assertArrayAlmostEqual(result, bounds_pairing)
Ejemplo n.º 4
0
 def test_basic(self):
     """Test that the result is a numpy array."""
     cube_name = "air_temperature"
     cube_units = Unit("degreesC")
     result = get_bounds_of_distribution(cube_name, cube_units)
     self.assertIsInstance(result, np.ndarray)