コード例 #1
0
def test_particle_layer_eval_ckd_absorbing_only(mode_ckd, tmpdir, absorbing_only, bins):
    """eval methods return expected values for an absorbing-only layer."""
    layer = ParticleLayer(dataset=absorbing_only)
    spectral_config = CKDMeasureSpectralConfig(bin_set="10nm", bins=bins)
    spectral_ctx = spectral_config.spectral_ctxs()[0]
    assert np.all(layer.eval_sigma_s(spectral_ctx).magnitude == 0.0)
    assert np.all(layer.eval_sigma_a(spectral_ctx).magnitude > 0.0)
    assert np.all(layer.eval_albedo(spectral_ctx).magnitude == 0.0)

    ctx = KernelDictContext(spectral_ctx=spectral_ctx)
    assert layer.eval_width(ctx).magnitude > 0.0
コード例 #2
0
def test_particle_layer_eval_mono_absorbing_only(
    mode_mono, tmpdir, absorbing_only, wavelength
):
    """eval methods return expected values for an absorbing-only layer."""
    layer = ParticleLayer(dataset=absorbing_only)
    spectral_ctx = MonoSpectralContext(wavelength=wavelength)
    assert np.all(layer.eval_sigma_s(spectral_ctx).magnitude == 0.0)
    assert np.all(layer.eval_sigma_a(spectral_ctx).magnitude > 0.0)
    assert np.all(layer.eval_albedo(spectral_ctx).magnitude == 0.0)

    ctx = KernelDictContext(spectral_ctx=spectral_ctx)
    assert layer.eval_width(ctx).magnitude > 0.0
コード例 #3
0
def test_particle_layer_eval_ckd(mode_ckd, tmpdir, test_particles_dataset, bins):
    """eval methods return expected values for a scattering-only layer."""
    layer = ParticleLayer(
        dataset=test_particles_dataset,
        n_layers=1,
        tau_550=1.0,
        bottom=0.0 * ureg.km,
        top=1.0 * ureg.km,
    )
    spectral_config = CKDMeasureSpectralConfig(bin_set="10nm", bins=bins)
    spectral_ctx = spectral_config.spectral_ctxs()[0]
    assert np.isclose(layer.eval_sigma_t(spectral_ctx), 1.0 / ureg.km)
    assert np.isclose(layer.eval_sigma_s(spectral_ctx), 0.8 / ureg.km)
    assert np.isclose(layer.eval_sigma_a(spectral_ctx), 0.2 / ureg.km)
    assert np.isclose(layer.eval_albedo(spectral_ctx).magnitude, 0.8)

    ctx = KernelDictContext(spectral_ctx=spectral_ctx)
    assert layer.eval_width(ctx) == 12.5 * ureg.km
コード例 #4
0
def test_particle_layer_eval_mono(
    mode_mono, tmpdir, test_particles_dataset, wavelength
):
    """eval methods return expected values for a scattering-only layer."""
    layer = ParticleLayer(
        dataset=test_particles_dataset,
        n_layers=1,
        tau_550=1.0,
        bottom=0.0 * ureg.km,
        top=1.0 * ureg.km,
    )
    spectral_ctx = MonoSpectralContext(wavelength=wavelength)
    assert np.isclose(layer.eval_sigma_t(spectral_ctx), 1.0 / ureg.km)
    assert np.isclose(layer.eval_sigma_s(spectral_ctx), 0.8 / ureg.km)
    assert np.isclose(layer.eval_sigma_a(spectral_ctx), 0.2 / ureg.km)
    assert np.isclose(layer.eval_albedo(spectral_ctx).magnitude, 0.8)

    ctx = KernelDictContext(spectral_ctx=spectral_ctx)
    assert layer.eval_width(ctx) == 12.5 * ureg.km