def process(self): """ Create a saturated vapour pressure lookup table by calling the Utilities.saturation_vapour_pressure_goff_gratch function in psychrometric_calculations.Utilities. Returns: svp : iris.cube.Cube A cube of saturated vapour pressure values at temperature points defined by t_min, t_max, and t_increment (defined above). """ temperatures = np.arange(self.t_min, self.t_max + 0.5*self.t_increment, self.t_increment) temperature = iris.cube.Cube(temperatures, 'air_temperature', units='K') svp = Utilities.saturation_vapour_pressure_goff_gratch(temperature) temperature_coord = iris.coords.DimCoord( temperature.data, 'air_temperature', units='K') svp.add_dim_coord(temperature_coord, 0) svp.attributes['minimum_temperature'] = self.t_min svp.attributes['maximum_temperature'] = self.t_max svp.attributes['temperature_increment'] = self.t_increment return svp
def test_basic(self): """Basic calculation of some saturated vapour pressures.""" result = Utilities.saturation_vapour_pressure_goff_gratch( self.temperature) expected = [195.64190713, 469.67078994, 990.94206073] np.testing.assert_allclose(result.data, expected, rtol=1.e-5) self.assertEqual(result.units, Unit('Pa'))