def test_top_emissivity_outside_0_to_1_raises_value_error(self) -> None: ThermalEmission(top_emissivity=0.0) with self.assertRaises(ValueError): ThermalEmission(top_emissivity=np.nextafter(0, -1)) ThermalEmission(top_emissivity=1.0) with self.assertRaises(ValueError): ThermalEmission(top_emissivity=np.nextafter(1, 2)) with self.assertRaises(ValueError): ThermalEmission(top_emissivity=np.inf) with self.assertRaises(ValueError): ThermalEmission(top_emissivity=np.nan)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # New: I split the old "control" classes into additional classes that I think # are more accurately named and grouped. I think many of these variables in # DISORT are horribly named. For clarity, I included the "DISORT" name as the # variable name, and the name I prefer as the property # (i.e. fisot = isotropic_flux). There's really no reason to define any of these # variables here---you can just put them directly into the disort call---but I # thought it might be helpful. # Semi-new: another note, that many of these variables take a boolean or float # value. I made them optional, and use default values that disort_mulit uses incident_flux = IncidentFlux() fbeam = incident_flux.beam_flux fisot = incident_flux.isotropic_flux te = ThermalEmission() plank = te.thermal_emission btemp = te.bottom_temperature ttemp = te.top_temperature temis = te.top_emissivity mb = ModelBehavior() accur = mb.accuracy deltamplus = mb.delta_m_plus dopseudosphere = mb.do_pseudo_sphere header = mb.header ibcnd = mb.incidence_beam_conditions onlyfl = mb.only_fluxes prnt = mb.print_variables radius = mb.radius usrang = mb.user_angles
def test_infinite_top_temperature_raises_value_error(self) -> None: with self.assertRaises(ValueError): ThermalEmission(top_temperature=np.inf)
def test_list_top_temperature_raises_type_error(self) -> None: with self.assertRaises(TypeError): ThermalEmission(top_temperature=[100])
def test_str_top_temperature_raises_value_error(self) -> None: with self.assertRaises(ValueError): ThermalEmission(top_temperature='foo')
def test_nan_bottom_temperature_raises_value_error(self) -> None: with self.assertRaises(ValueError): ThermalEmission(bottom_temperature=np.nan)
def test_list_thermal_emission_returns_true(self) -> None: te = ThermalEmission(thermal_emission=[100]) self.assertTrue(te.thermal_emission)
def test_top_emissivity_is_read_only(self) -> None: te = ThermalEmission() with self.assertRaises(AttributeError): te.top_emissivity = 0
def test_top_emissivity_defaults_to_1(self) -> None: self.assertEqual(1, ThermalEmission().top_emissivity)
def test_top_emissivity_is_unchanged(self) -> None: te = ThermalEmission(top_emissivity=0.5) self.assertEqual(0.5, te.top_emissivity)
def test_top_temperature_is_read_only(self) -> None: te = ThermalEmission() with self.assertRaises(AttributeError): te.top_temperature = 0
def test_top_temperature_defaults_to_0(self) -> None: self.assertEqual(0, ThermalEmission().top_temperature)
def test_top_temperature_is_unchanged(self) -> None: te = ThermalEmission(top_temperature=200.0) self.assertEqual(200.0, te.top_temperature)
def test_top_emissivity_defaults_to_false(self) -> None: self.assertEqual(False, ThermalEmission().thermal_emission)
def test_thermal_emission_is_unchanged(self) -> None: te = ThermalEmission(thermal_emission=True) self.assertEqual(True, te.thermal_emission)