def test_molecular_atmosphere_switches(mode_mono): # Absorption can be deactivated atmosphere = MolecularAtmosphere(has_absorption=False) ctx = KernelDictContext() assert np.all(atmosphere.eval_radprops(ctx.spectral_ctx).sigma_a == 0.0) # Scattering can be deactivated atmosphere = MolecularAtmosphere(has_scattering=False) ctx = KernelDictContext() assert np.all(atmosphere.eval_radprops(ctx.spectral_ctx).sigma_s == 0.0) # At least one must be active with pytest.raises(ValueError): MolecularAtmosphere(has_absorption=False, has_scattering=False)
def test_molecular_atmosphere_default(mode_mono, tmpdir, ussa76_approx_test_absorption_data_set): """Default MolecularAtmosphere constructor produces a valid kernel dictionary.""" spectral_ctx = SpectralContext.new(wavelength=550.0) ctx = KernelDictContext(spectral_ctx=spectral_ctx) atmosphere = MolecularAtmosphere(absorption_data_sets=dict( us76_u86_4=ussa76_approx_test_absorption_data_set)) assert KernelDict.from_elements(atmosphere, ctx=ctx).load() is not None
def test_molecular_atmosphere_scale(mode_mono): ctx = KernelDictContext() d = MolecularAtmosphere(scale=2.0).kernel_dict(ctx) assert d["medium_atmosphere"]["scale"] == 2.0 assert d.load()