Beispiel #1
0
    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)
Beispiel #2
0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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
Beispiel #3
0
 def test_infinite_top_temperature_raises_value_error(self) -> None:
     with self.assertRaises(ValueError):
         ThermalEmission(top_temperature=np.inf)
Beispiel #4
0
 def test_list_top_temperature_raises_type_error(self) -> None:
     with self.assertRaises(TypeError):
         ThermalEmission(top_temperature=[100])
Beispiel #5
0
 def test_str_top_temperature_raises_value_error(self) -> None:
     with self.assertRaises(ValueError):
         ThermalEmission(top_temperature='foo')
Beispiel #6
0
 def test_nan_bottom_temperature_raises_value_error(self) -> None:
     with self.assertRaises(ValueError):
         ThermalEmission(bottom_temperature=np.nan)
Beispiel #7
0
 def test_list_thermal_emission_returns_true(self) -> None:
     te = ThermalEmission(thermal_emission=[100])
     self.assertTrue(te.thermal_emission)
Beispiel #8
0
 def test_top_emissivity_is_read_only(self) -> None:
     te = ThermalEmission()
     with self.assertRaises(AttributeError):
         te.top_emissivity = 0
Beispiel #9
0
 def test_top_emissivity_defaults_to_1(self) -> None:
     self.assertEqual(1, ThermalEmission().top_emissivity)
Beispiel #10
0
 def test_top_emissivity_is_unchanged(self) -> None:
     te = ThermalEmission(top_emissivity=0.5)
     self.assertEqual(0.5, te.top_emissivity)
Beispiel #11
0
 def test_top_temperature_is_read_only(self) -> None:
     te = ThermalEmission()
     with self.assertRaises(AttributeError):
         te.top_temperature = 0
Beispiel #12
0
 def test_top_temperature_defaults_to_0(self) -> None:
     self.assertEqual(0, ThermalEmission().top_temperature)
Beispiel #13
0
 def test_top_temperature_is_unchanged(self) -> None:
     te = ThermalEmission(top_temperature=200.0)
     self.assertEqual(200.0, te.top_temperature)
Beispiel #14
0
 def test_top_emissivity_defaults_to_false(self) -> None:
     self.assertEqual(False, ThermalEmission().thermal_emission)
Beispiel #15
0
 def test_thermal_emission_is_unchanged(self) -> None:
     te = ThermalEmission(thermal_emission=True)
     self.assertEqual(True, te.thermal_emission)