Beispiel #1
0
def test_us76_approx_rad_profile_ckd_sigma_s(mode_ckd):
    """
    Scattering coefficient evaluation methods return pint.Quantity object.
    """
    p = US76ApproxRadProfile()

    spectral_ctx = SpectralContext.new()

    assert isinstance(p.eval_sigma_s_ckd(spectral_ctx.bindex), ureg.Quantity)
Beispiel #2
0
def test_us76_approx_rad_profile(mode_mono,
                                 us76_approx_test_absorption_data_set):
    """
    Collision coefficient evaluation methods return pint.Quantity objects.
    """
    p = US76ApproxRadProfile(
        absorption_data_set=us76_approx_test_absorption_data_set)

    spectral_ctx = SpectralContext.new()
    for field in ["sigma_a", "sigma_s", "sigma_t", "albedo"]:
        x = getattr(p, f"eval_{field}")(spectral_ctx)
        assert isinstance(x, ureg.Quantity)
Beispiel #3
0
def test_us76_approx_rad_profile_has_scattering_default(
        mode_mono, us76_approx_test_absorption_data_set):
    """
    Default value for 'has_scattering' is True, hence the scattering
    coefficient is computed and is not zero everywhere at 550 nm.
    """
    p = US76ApproxRadProfile(
        absorption_data_set=us76_approx_test_absorption_data_set)
    assert p.has_scattering
    spectral_ctx = SpectralContext.new(wavelength=550.0)
    ds = p.eval_dataset(spectral_ctx)
    assert (ds.sigma_s.values != 0.0).any()
Beispiel #4
0
def test_us76_approx_rad_profile_has_scattering_false(
        mode_mono, us76_approx_test_absorption_data_set):
    """
    When 'has_scattering' is False, the scattering coefficient is not
    computed and is zero everywhere.
    """
    p = US76ApproxRadProfile(
        has_scattering=False,
        absorption_data_set=us76_approx_test_absorption_data_set)
    assert not p.has_scattering
    spectral_ctx = SpectralContext.new(wavelength=550.0)
    ds = p.eval_dataset(spectral_ctx)
    assert (ds.sigma_s.values == 0.0).all()
Beispiel #5
0
def test_us76_approx_rad_profile_has_absorption_true(
        mode_mono, us76_approx_test_absorption_data_set):
    """
    When 'has_absorption' is True, the absorption coefficient is computed
    and is not zero everywhere at 1650 nm.
    """
    p = US76ApproxRadProfile(
        has_absorption=True,
        absorption_data_set=us76_approx_test_absorption_data_set)
    assert p.has_absorption
    spectral_ctx = SpectralContext.new(wavelength=1650.0)
    ds = p.eval_dataset(spectral_ctx)
    assert (ds.sigma_a.values != 0.0).any()
Beispiel #6
0
def test_us76_approx_rad_profile_levels(mode_mono,
                                        us76_approx_test_absorption_data_set):
    """
    Collision coefficients' shape match altitude levels shape.
    """
    p = US76ApproxRadProfile(
        thermoprops=dict(levels=ureg.Quantity(np.linspace(0, 120, 121), "km")),
        absorption_data_set=us76_approx_test_absorption_data_set,
    )

    spectral_ctx = SpectralContext.new()
    for field in ["sigma_a", "sigma_s", "sigma_t", "albedo"]:
        x = getattr(p, f"eval_{field}")(spectral_ctx)
        assert x.shape == (120, )