def test_basic(self):
     """Test that the wet bulb temperature integral returns a cube
     with the expected name."""
     wb_temp_int = WetBulbTemperatureIntegral().process(self.wet_bulb_temperature)
     self.assertIsInstance(wb_temp_int, iris.cube.Cube)
     self.assertEqual(wb_temp_int.name(), "wet_bulb_temperature_integral")
     self.assertEqual(str(wb_temp_int.units), "K m")
 def test_basic(self):
     """Test that the wet bulb temperature integral returns a cube
     with the expected name."""
     result = WetBulbTemperatureIntegral().process(
         self.temperature_cube, self.relative_humidity_cube,
         self.pressure_cube)
     self.assertIsInstance(result, iris.cube.Cube)
     self.assertEqual(result.name(), "wet_bulb_temperature_integral")
     self.assertEqual(result.units, Unit('K m'))
 def test_basic(self):
     """Test that the __repr__ returns the expected string."""
     result = str(WetBulbTemperatureIntegral())
     msg = ('<WetBulbTemperatureIntegral: <WetBulbTemperature: '
            'precision: 0.005>, <Integration: coord_name_to_integrate: '
            'height, start_point: None, end_point: None, '
            'direction_of_integration: negative>>')
     self.assertEqual(result, msg)
 def test_data(self):
     """Test that the wet bulb temperature integral returns a cube
     containing the expected data."""
     expected_wb_int = np.array(
         [[[0.0, 0.0, 608.1063]], [[0.0, 0.0, 912.1595]]], dtype=np.float32
     )
     wb_temp_int = WetBulbTemperatureIntegral().process(self.wet_bulb_temperature)
     self.assertIsInstance(wb_temp_int, iris.cube.Cube)
     self.assertArrayAlmostEqual(wb_temp_int.data, expected_wb_int)
 def test_data(self):
     """Test that the wet bulb temperature integral returns a cube
     containing the expected data."""
     expected = np.array([[0.0, 0.0, 608.106507], [0.0, 0.0, 912.159761]])
     result = WetBulbTemperatureIntegral().process(
         self.temperature_cube, self.relative_humidity_cube,
         self.pressure_cube)
     self.assertIsInstance(result, iris.cube.Cube)
     self.assertArrayAlmostEqual(result.data, expected)
 def test_data(self):
     """Test that the wet bulb temperature integral returns a cube
     containing the expected data."""
     expected = np.array([[1831.500000, 2598.830545, 3339.606507],
                          [2747.250000, 3898.245818, 5009.409761]])
     result = WetBulbTemperatureIntegral().process(
         self.temperature_cube, self.relative_humidity_cube,
         self.pressure_cube)
     self.assertIsInstance(result, iris.cube.Cube)
     self.assertArrayAlmostEqual(result.data, expected)
Esempio n. 7
0
 def test_data(self):
     """Test that the wet bulb temperature integral returns a cube
     containing the expected data."""
     expected_wb_int = np.array(
         [[0.0, 0.0, 608.106507],
          [0.0, 0.0, 912.159761]])
     expected_wb_temp = np.array(
         [[-90., -13.26694545, 60.81065074],
          [-90., -13.26694545, 60.81065074],
          [-90., -13.26694545, 60.81065074]])
     wb_temp, wb_temp_int = WetBulbTemperatureIntegral().process(
         self.temperature_cube, self.relative_humidity_cube,
         self.pressure_cube)
     self.assertIsInstance(wb_temp, iris.cube.Cube)
     self.assertIsInstance(wb_temp_int, iris.cube.Cube)
     self.assertArrayAlmostEqual(wb_temp_int.data, expected_wb_int)
     self.assertArrayAlmostEqual(wb_temp.data, expected_wb_temp)
def process(wet_bulb_temperature: cli.inputcube):
    """Module to calculate wet bulb temperature integral.

    Calculate the wet-bulb temperature integral using the input wet bulb
    temperature data. The integral will be calculated at the height levels on
    which the wet bulb temperatures are provided.

    Args:
        wet_bulb_temperature (iris.cube.Cube):
            Cube of wet bulb temperatures on height levels.

    Returns:
        iris.cube.Cube:
            Processed Cube of wet bulb integrals.
    """
    from improver.psychrometric_calculations.psychrometric_calculations import (
        WetBulbTemperatureIntegral, )

    return WetBulbTemperatureIntegral()(wet_bulb_temperature)