def test_basic(self): """Basic calculation of some enthalpy gradients.""" specific_heat = np.array([1089.5, 1174., 1258.5]) latent_heat = np.array([2531771., 2508371., 2484971.]) expected = [[21631.198581, 38569.575046, 52448.138051]] result = Utilities.calculate_d_enthalpy_dt( self.mixing_ratio.data, specific_heat, latent_heat, self.temperature.data) self.assertArrayAlmostEqual(result.data, expected)
def test_basic(self): """Basic calculation of some enthalpy gradients.""" specific_heat = self.pressure.copy(data=[1089.5, 1174., 1258.5]) specific_heat.units = 'J kg-1 K-1' latent_heat = self.pressure.copy(data=[2531771., 2508371., 2484971.]) latent_heat.units = 'J kg-1' expected = [21631.19827498, 38569.57448917, 52448.13601681] result = Utilities.calculate_d_enthalpy_dt(self.mixing_ratio, specific_heat, latent_heat, self.temperature) self.assertArrayAlmostEqual(result.data, expected) self.assertEqual(result.units, Unit('J kg-1 K-1'))