API Reference
Package Interface
pyRadtran — A complete Python wrapper for libRadtran radiative transfer.
- class pyradtran.AerosolModel(*, set_tau_at_wvl: tuple[float, float] | None=None, king_byrne: tuple[float, float, float] | None=None, modify: list[AerosolModifyEntry] = <factory>)[source]
Bases:
UvspecOptionAbstract base class for all aerosol configurations.
Subclasses implement mode-specific
to_uvspec_lines(). Common capabilities (set_tau_at_wvl, king_byrne, modify) are handled here.- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- modify: list[AerosolModifyEntry]
- class pyradtran.AerosolModifyEntry(*, variable: str, action: str, value: float)[source]
Bases:
UvspecOptionA single aerosol_modify directive.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_entry() AerosolModifyEntry[source]
- class pyradtran.CompositeAerosol(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, sources: ~typing.Annotated[list, ~annotated_types.MinLen(min_length=1)], wavelength_grid_um: ~typing.Annotated[list[float], ~annotated_types.MinLen(min_length=1)], altitude_grid_km: ~typing.Annotated[list[float], ~annotated_types.MinLen(min_length=2)], n_legendre: int = 32, output_dir: ~pathlib.Path | None = None)[source]
Bases:
AerosolModelTier 4: composite aerosol scene mixing multiple sources.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Generate
aerosol_file explicit <master>line.For single preset/external sources, delegates directly to their
to_uvspec_lines()to avoid the explicit-file overhead.
- validate_grids() CompositeAerosol[source]
- pyradtran.ExternalAerosol
alias of
ExternalFile
- class pyradtran.ExternalFile(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, files: ~typing.Annotated[list[tuple[str, str]], ~annotated_types.MinLen(min_length=1)])[source]
Bases:
AerosolModelExternal aerosol optical property files.
- files
List of (file_type, file_path) tuples. Types: “gg”, “ssa”, “tau”, “explicit”, “moments”, “ref”, “siz”.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_files() ExternalFile[source]
- class pyradtran.IntegrationConfig(*, n_radius_grid: int = 200, radius_min_um: float = 0.001, radius_max_um: float = 100.0)[source]
Bases:
BaseModelConfiguration for size-distribution numerical integration.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyradtran.LayerOptics(tau: ndarray[tuple[Any, ...], dtype[_ScalarT]], ssa: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]])[source]
Bases:
objectExtensive optical properties per layer.
- class pyradtran.LoadedSpecies(*, species: MieSpecies | PrecomputedSpecies | OPACSpecies, mass_profile_kg_m3: Annotated[list[float], MinLen(min_length=1)], altitude_km: Annotated[list[float], MinLen(min_length=2)], rh_profile: list[float] | None = None)[source]
Bases:
BaseModelTier 3: extensive in-atmosphere optical properties.
- evaluate(wl_um: ndarray, z_km: ndarray, n_legendre: int = 32) LayerOptics[source]
Evaluate optical properties on (wavelength, altitude) grid.
- Parameters:
wl_um – Wavelength grid in um, strictly ascending.
z_km – Altitude grid in km, strictly descending (layer centers or boundaries).
n_legendre – Number of Legendre moments.
- Returns:
LayerOptics with shape (n_wl, n_layer).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- species: MieSpecies | PrecomputedSpecies | OPACSpecies
- validate_profiles() LoadedSpecies[source]
- class pyradtran.MieSpecies(*, refractive_index: ~pyradtran.models.aerosol_composite.RefractiveIndex, size_distribution: ~pyradtran.models.aerosol_composite.SizeDistribution, particle_density_kg_m3: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)], integration_config: ~pyradtran.models.aerosol_composite.IntegrationConfig = <factory>)[source]
Bases:
BaseModelMie-computed species from refractive index + size distribution.
- integration_config: IntegrationConfig
- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Compute mass-normalized intensive optical properties.
- Parameters:
wl_um – Wavelengths in micrometers.
n_legendre – Number of Legendre moments to generate. Because the bhmie() path does not compute angular scattering by default, moments are derived from the Henyey-Greenstein phase function rather than a full Mie phase function.
- Returns:
SpeciesOptics with beta_ext_per_mass, ssa, g, and legendre_moments.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- refractive_index: RefractiveIndex
- size_distribution: SizeDistribution
- class pyradtran.OPACSpecies(*, netcdf_path: Annotated[str, MinLen(min_length=1)], wavelength_nm: float | None = None)[source]
Bases:
BaseModelOPAC species from a pre-computed libRadtran netCDF optical-property file.
The netCDF file is expected to contain
output_dtauc,output_ssalb, andoutput_pmomvariables (libRadtranwrite_optical_propertiesformat).- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Read netCDF and return intensive properties.
For a netCDF with
nlyrlayers, the returnedbeta_ext_per_massassumes the optical depth is distributed uniformly across layers for the purpose of SpeciesOptics (the actual layer geometry is applied later in LoadedSpecies).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyradtran.OpacCustom(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, species_file: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)], species_names: list[str] | None = None, library: str = 'OPAC')[source]
Bases:
AerosolModelOPAC custom species profile aerosol.
Uses a user-provided mass concentration profile file with the OPAC library.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_species() OpacCustom[source]
- class pyradtran.OpacPreset(*, set_tau_at_wvl: tuple[float, float] | None=None, king_byrne: tuple[float, float, float] | None=None, modify: list[AerosolModifyEntry] = <factory>, name: OpacPresetName, library: str = 'OPAC', species_names: list[str] | None = None)[source]
Bases:
AerosolModelOPAC preset mixture profile aerosol.
Uses pre-defined aerosol species mixture profiles from the OPAC library. The
nameselects from 10 predefined mixture profiles. Optionally filter to specific species viaspecies_names.- name
Preset mixture profile name.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: OpacPresetName
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_species() OpacPreset[source]
- class pyradtran.OpacPresetName(value)[source]
-
OPAC preset mixture profile names.
These correspond to files in data/aerosol/OPAC/standard_aerosol_files/.
- ANTARCTIC = 'antarctic'
- CONTINENTAL_AVERAGE = 'continental_average'
- CONTINENTAL_CLEAN = 'continental_clean'
- CONTINENTAL_POLLUTED = 'continental_polluted'
- DESERT = 'desert'
- DESERT_SPHEROIDS = 'desert_spheroids'
- MARITIME_CLEAN = 'maritime_clean'
- MARITIME_POLLUTED = 'maritime_polluted'
- MARITIME_TROPICAL = 'maritime_tropical'
- URBAN = 'urban'
- class pyradtran.ParticleOptics(*, wavelength_um: Annotated[list[float], MinLen(min_length=1)], radius_um: Annotated[list[float], MinLen(min_length=1)], Qext: ndarray[tuple[Any, ...], dtype[_ScalarT]], Qsca: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None)[source]
Bases:
BaseModelSingle-particle optical properties vs wavelength and radius.
- Qext: NDArray
- Qsca: NDArray
- classmethod from_aerosol3d(data) ParticleOptics[source]
Create ParticleOptics from Aerosol3D AerosolOpticsData.
Handles unit conversion (nm -> um, nm^2 -> um^2) and Legendre convention (prefers beta_l, falls back to k_l conversion).
- Parameters:
data – Object with wavelength_nm, C_ext, C_sca, g, r_eff_nm, n_legendre, legendre_moments_beta, legendre_moments fields.
- Returns:
ParticleOptics ready for use in PrecomputedSpecies.
- classmethod from_cross_sections(*, wavelength_um: list[float], radius_um: list[float], Cext_um2: ndarray[tuple[Any, ...], dtype[_ScalarT]], Csca_um2: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None) ParticleOptics[source]
Build from cross-sections (convert to Q-factors).
- g: NDArray
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_shapes() ParticleOptics[source]
- class pyradtran.PrecomputedSpecies(*, particle_optics: ~pyradtran.models.aerosol_composite.ParticleOptics, size_distribution: ~pyradtran.models.aerosol_composite.SizeDistribution, particle_density_kg_m3: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)], integration_config: ~pyradtran.models.aerosol_composite.IntegrationConfig = <factory>)[source]
Bases:
BaseModelSpecies from precomputed ParticleOptics + size distribution.
- integration_config: IntegrationConfig
- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Integrate precomputed Q-factors over size distribution.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- particle_optics: ParticleOptics
- size_distribution: SizeDistribution
- class pyradtran.RefractiveIndex(*, wavelength_um: Annotated[list[float], MinLen(min_length=2)], n_real: list[float], k_imag: Annotated[list[float], MinLen(min_length=1)])[source]
Bases:
BaseModelWavelength-dependent complex refractive index.
Interpolation is log-linear in wavelength.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_lengths_and_sorted() RefractiveIndex[source]
- class pyradtran.Runner[source]
Bases:
objectExecute uvspec simulations.
Usage:
result = Runner.execute(scene, data_path="/path/to/data") results = Runner.execute_many(scenes, max_workers=4)
Global defaults may be set once via
configure()so thatuvspec_exeanddata_pathdo not need to be repeated on every call:Runner.configure(uvspec_exe="/opt/libRadtran/bin/uvspec", data_path="/opt/libRadtran/data") result = Runner.execute(scene)
- classmethod configure(config: RunnerConfig | None = None, **kwargs) RunnerConfig[source]
Set global default configuration for all Runner executions.
- Parameters:
config – A complete
RunnerConfiginstance, orNone.**kwargs – Individual fields (e.g.
uvspec_exe=..., data_path=...).
- Returns:
The newly set configuration.
- static execute(scene: Scene, uvspec_exe: str | None = None, data_path: str | None = None, keep_temp: bool | None = None, timeout: int | None = None, config: RunnerConfig | None = None) xr.Dataset[source]
Execute a single uvspec simulation.
- Parameters:
scene – Configured Scene object.
uvspec_exe – Path to uvspec binary. Auto-detected if None.
data_path – Path to libRadtran data directory. Auto-detected if None.
keep_temp – Keep temporary files after execution.
timeout – Maximum execution time in seconds.
config – Optional
RunnerConfigoverriding global defaults for this call only.
- Returns:
xarray.Dataset with simulation results.
- static execute_many(scenes: list[Scene], uvspec_exe: str | None = None, data_path: str | None = None, max_workers: int | None = None, keep_temp: bool | None = None, timeout: int | None = None, config: RunnerConfig | None = None) list[xr.Dataset][source]
Execute multiple uvspec simulations in parallel.
- Parameters:
scenes – List of configured Scene objects.
uvspec_exe – Path to uvspec binary. Auto-detected if None.
data_path – Path to libRadtran data directory. Auto-detected if None.
max_workers – Maximum parallel workers.
keep_temp – Keep temporary files after execution.
timeout – Maximum execution time in seconds per scene.
config – Optional
RunnerConfigoverriding global defaults.
- Returns:
List of xarray.Dataset results, one per scene.
- class pyradtran.RunnerConfig(uvspec_exe: str | None = None, data_path: str | None = None, max_workers: int = 4, keep_temp: bool = False, timeout: int | None = None)[source]
Bases:
objectConfiguration for uvspec execution.
- class pyradtran.Scene(atmosphere: AtmosphereConfig | None = None, source: SourceConfig | None = None, wavelength: WavelengthConfig | None = None, solver: SolverConfig | None = None, output: OutputConfig | None = None, surface: SurfaceConfig | None = None, aerosol: AerosolModel | None = None, cloud: CloudConfig | None = None, mc: McConfig | None = None, sslidar: SslidarConfig | None = None, advanced: AdvancedConfig | None = None, three_d: ThreeDConfig | None = None, special: SpecialConfig | None = None, raw_keywords: list[tuple[str, str]] | None = None)[source]
Bases:
objectImmutable scene builder composing all uvspec configuration models.
Each set_*() method returns a new Scene via deepcopy. Use .clone() for an explicit copy.
Usage:
scene = ( Scene() .set_atmosphere(profile="us", altitude=2.663) .set_source_solar(sza=30.0) .set_wavelength(250.0, 1200.0) .set_solver(method="disort", streams=16) .set_output(quantities=["lambda", "edir"]) )
- build_input(data_files_path: str | None = None) str[source]
Build complete uvspec input text from this Scene.
- Raises:
ValueError – If required components are missing.
- set_aerosol(aerosol: AerosolModel) Scene[source]
Set aerosol configuration from an AerosolModel instance.
- set_aerosol_modify(variable: str, action: str, value: float) Scene[source]
Add an aerosol modification directive.
- Parameters:
variable – Property to modify (gg, ssa, tau, tau550).
action – Modification type (scale or set).
value – Numeric value.
- set_dynamic(method: str = 'dynamic_tenstream', iterations: int | None = None, **kwargs) Scene[source]
- class pyradtran.SizeDistribution(*, kind: Literal['lognormal', 'modified_gamma', 'discrete', 'monodisperse'], params: dict, number_density_per_m3: float = 1.0)[source]
Bases:
BaseModelAerosol particle size distribution.
- kind: Literal['lognormal', 'modified_gamma', 'discrete', 'monodisperse']
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_params() SizeDistribution[source]
- class pyradtran.SpeciesOptics(beta_ext_per_mass: ndarray[tuple[Any, ...], dtype[_ScalarT]], ssa: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None)[source]
Bases:
objectMass-normalized intensive optical properties of an aerosol species.
- class pyradtran.ThreeDConfig(*, atmosphere_file: str | None = None)[source]
Bases:
UvspecOption3D atmospheric field configuration.
Configures 3D atmospheric input fields for MYSTIC and dynamic tenstream solvers.
Note
3D cloud fields are specified through CloudConfig: scene.set_cloud(wc_file=(“3D”, “/path/to/cloud3d.nc”)) or scene.set_cloud(ic_file=(“3D”, “/path/to/ic3d.nc”)).
The ipa (independent pixel approximation) for 3D is enabled via McConfig.ipa=True or McConfig.tipa=”dir”/”dir3d”.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pyradtran.run_3d(atmosphere_file: str | None = None, profile: str = 'us', altitude: float = 0.0, sza: float = 30.0, wl_min: float = 300.0, wl_max: float = 2500.0, photons: int = 100000, ipa: bool = False, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run 3D Monte Carlo radiative transfer simulation.
- Parameters:
atmosphere_file – Path to 3D atmospheric field file.
profile – Standard atmosphere profile (for 1D fallback).
altitude – Surface altitude in km.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
photons – Number of Monte Carlo photons.
ipa – Use independent pixel approximation.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with 3D radiative transfer results.
- pyradtran.run_cloudy_scene(ic_properties: str = 'fu', ic_tau: float | None = None, ic_habit: str | None = None, wc_properties: str | None = None, wc_tau: float | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with cloud layer.
- Parameters:
ic_properties – Ice cloud parameterization (fu, yang, key, baum, etc.).
ic_tau – Ice cloud optical thickness (set via ic_modify).
ic_habit – Ice crystal habit type.
wc_properties – Water cloud parameterization (hu, echam4).
wc_tau – Water cloud optical thickness.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.run_lidar(area: float = 1.0, E0: float = 0.1, efficiency: float = 0.5, position: float = 0.0, range_bin: float = 0.1, n_ranges: int = 100, profile: str = 'us', altitude: float = 0.0, wl_min: float = 300.0, wl_max: float = 1100.0, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run single scattering lidar simulation.
- Parameters:
area – Telescope area in m^2.
E0 – Pulse energy in Joules.
efficiency – Detector efficiency.
position – Lidar position in km.
range_bin – Range bin width in km.
n_ranges – Number of range bins.
profile – Atmospheric profile.
altitude – Surface altitude in km.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with lidar signal vs range.
- pyradtran.run_polarized(profile: str = 'us', altitude: float = 0.0, sza: float = 30.0, wl_min: float = 250.0, wl_max: float = 1200.0, photons: int = 100000, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run polarized Monte Carlo simulation.
- Parameters:
profile – Atmospheric profile.
altitude – Surface altitude in km.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
photons – Number of Monte Carlo photons.
streams – Number of streams (for correlated-k).
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with polarized radiance.
- pyradtran.run_satellite(geometry: str = 'MPS', pixel: tuple[int, int] | None = None, profile: str = 'us', sza: float = 60.0, wl_min: float = 300.0, wl_max: float = 2500.0, solver: str = 'disort', streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run satellite-viewing radiative transfer simulation.
- Parameters:
geometry – Satellite geometry name (e.g., MPS, SENTINEL2A).
pixel – Optional (x, y) pixel coordinates for satellite_geometry file.
profile – Standard atmosphere profile.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
solver – RTE solver name.
streams – Number of angular streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with satellite-view radiance/irradiance.
- pyradtran.run_solar_radiance(sza: float = 30.0, airmass: float | None = None, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 250.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, solver: str = 'disort', uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate solar spectral radiance (direct + diffuse irradiance).
- Parameters:
sza – Solar zenith angle in degrees. Ignored if airmass is set.
airmass – Relative airmass. Overrides sza if provided.
profile – Atmospheric profile name.
altitude – Surface altitude in km, or a preset name.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
solver – RTE solver name.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength at TOA and surface.
- pyradtran.run_solar_transmittance(airmass: float = 1.0, pwv: float = 5.0, ozone: float = 300.0, profile: str = 'us', altitude: float | str = 0.0, wl_min: float = 250.0, wl_max: float = 1200.0, albedo: float = 0.0, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate solar spectral transmittance.
- Parameters:
airmass – Relative airmass (1.0 = zenith).
pwv – Precipitable water vapor in mm (mol_modify H2O).
ozone – Ozone column in DU (mol_modify O3).
profile – Atmospheric profile name (us, ms, mw, tp, ss, sw).
altitude – Surface altitude in km, or a preset name (“LSST”, “CTIO”).
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with transmittance vs wavelength.
- pyradtran.run_thermal_brightness(pwv: float = 10.0, profile: str = 'ms', altitude: float = 0.0, wl_min: float = 2500.0, wl_max: float = 50000.0, sur_temperature: float | None = None, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate thermal infrared brightness temperature.
- pyradtran.run_with_aerosol(aerosol_file_type: str = 'explicit', aerosol_file_path: str | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with external aerosol optical property file.
- Parameters:
aerosol_file_type – Type of aerosol file (explicit, gg, ssa, tau, moments).
aerosol_file_path – Path to the aerosol file.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.run_with_opac_custom(species_file: str, library: str = 'OPAC', species_names: list[str] | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with OPAC custom species profile.
- Parameters:
species_file – Path to an ASCII species mass concentration profile file.
library – OPAC library path or “OPAC” for default resolution.
species_names – Optional species filter.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.run_with_opac_preset(preset: str | OpacPresetName, library: str = 'OPAC', species_names: list[str] | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with OPAC preset mixture profile.
- Parameters:
preset – OPAC preset name (e.g. “continental_average”) or OpacPresetName enum.
library – OPAC library path or “OPAC” for default resolution.
species_names – Optional species filter (e.g. [“inso”, “soot”]).
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
Scene
Scene builder with immutable chain API.
Scene composes all Pydantic models into a complete uvspec configuration. Each set_*() method returns a NEW Scene via copy.deepcopy() to avoid mutability traps.
- class pyradtran.scene.Scene(atmosphere: AtmosphereConfig | None = None, source: SourceConfig | None = None, wavelength: WavelengthConfig | None = None, solver: SolverConfig | None = None, output: OutputConfig | None = None, surface: SurfaceConfig | None = None, aerosol: AerosolModel | None = None, cloud: CloudConfig | None = None, mc: McConfig | None = None, sslidar: SslidarConfig | None = None, advanced: AdvancedConfig | None = None, three_d: ThreeDConfig | None = None, special: SpecialConfig | None = None, raw_keywords: list[tuple[str, str]] | None = None)[source]
Bases:
objectImmutable scene builder composing all uvspec configuration models.
Each set_*() method returns a new Scene via deepcopy. Use .clone() for an explicit copy.
Usage:
scene = ( Scene() .set_atmosphere(profile="us", altitude=2.663) .set_source_solar(sza=30.0) .set_wavelength(250.0, 1200.0) .set_solver(method="disort", streams=16) .set_output(quantities=["lambda", "edir"]) )
- build_input(data_files_path: str | None = None) str[source]
Build complete uvspec input text from this Scene.
- Raises:
ValueError – If required components are missing.
- set_aerosol(aerosol: AerosolModel) Scene[source]
Set aerosol configuration from an AerosolModel instance.
- set_aerosol_modify(variable: str, action: str, value: float) Scene[source]
Add an aerosol modification directive.
- Parameters:
variable – Property to modify (gg, ssa, tau, tau550).
action – Modification type (scale or set).
value – Numeric value.
- set_dynamic(method: str = 'dynamic_tenstream', iterations: int | None = None, **kwargs) Scene[source]
Runner
Subprocess execution engine for uvspec.
Runner is decoupled from Scene. Scene holds configuration; Runner executes it by building input, running uvspec, and parsing output.
- class pyradtran.core.runner.Runner[source]
Bases:
objectExecute uvspec simulations.
Usage:
result = Runner.execute(scene, data_path="/path/to/data") results = Runner.execute_many(scenes, max_workers=4)
Global defaults may be set once via
configure()so thatuvspec_exeanddata_pathdo not need to be repeated on every call:Runner.configure(uvspec_exe="/opt/libRadtran/bin/uvspec", data_path="/opt/libRadtran/data") result = Runner.execute(scene)
- classmethod configure(config: RunnerConfig | None = None, **kwargs) RunnerConfig[source]
Set global default configuration for all Runner executions.
- Parameters:
config – A complete
RunnerConfiginstance, orNone.**kwargs – Individual fields (e.g.
uvspec_exe=..., data_path=...).
- Returns:
The newly set configuration.
- static execute(scene: Scene, uvspec_exe: str | None = None, data_path: str | None = None, keep_temp: bool | None = None, timeout: int | None = None, config: RunnerConfig | None = None) xr.Dataset[source]
Execute a single uvspec simulation.
- Parameters:
scene – Configured Scene object.
uvspec_exe – Path to uvspec binary. Auto-detected if None.
data_path – Path to libRadtran data directory. Auto-detected if None.
keep_temp – Keep temporary files after execution.
timeout – Maximum execution time in seconds.
config – Optional
RunnerConfigoverriding global defaults for this call only.
- Returns:
xarray.Dataset with simulation results.
- static execute_many(scenes: list[Scene], uvspec_exe: str | None = None, data_path: str | None = None, max_workers: int | None = None, keep_temp: bool | None = None, timeout: int | None = None, config: RunnerConfig | None = None) list[xr.Dataset][source]
Execute multiple uvspec simulations in parallel.
- Parameters:
scenes – List of configured Scene objects.
uvspec_exe – Path to uvspec binary. Auto-detected if None.
data_path – Path to libRadtran data directory. Auto-detected if None.
max_workers – Maximum parallel workers.
keep_temp – Keep temporary files after execution.
timeout – Maximum execution time in seconds per scene.
config – Optional
RunnerConfigoverriding global defaults.
- Returns:
List of xarray.Dataset results, one per scene.
Core Utilities
Serialize Scene configuration to uvspec input text.
- pyradtran.core.input_builder.build_input_text(atmosphere: AtmosphereConfig, source: SourceConfig, wavelength: WavelengthConfig, solver: SolverConfig, output: OutputConfig, surface: SurfaceConfig | None = None, aerosol: AerosolModel | None = None, cloud: CloudConfig | None = None, mc: McConfig | None = None, sslidar: SslidarConfig | None = None, advanced: AdvancedConfig | None = None, three_d: ThreeDConfig | None = None, raw_keywords: list[tuple[str, str]] | None = None, data_files_path: str | None = None, special: SpecialConfig | None = None) str[source]
Build a complete uvspec input string from configuration models.
Keywords are collected as (phase, line) pairs from each model’s
to_uvspec_items()method, then sorted by phase to guarantee correct uvspec keyword ordering.- Phase assignments:
0 - data_files_path, include directives 1 - atmosphere 2 - source 3 - wavelength 4 - scattering/absorption switches (no_absorption, no_scattering) 5 - aerosol 6 - cloud 7 - surface 8 - solver 9 - output 10 - mc, sslidar 11 - three_d 12 - advanced 13 - raw_keywords (user-supplied, always last)
Parse uvspec output files into xarray.Dataset.
Supports both ASCII (default DISORT 7-column and output_user custom) and NetCDF output formats.
- pyradtran.core.output_parser.parse_output(output_path: str | Path, format: str = 'netcdf', n_zout: int = 1, column_names: list[str] | None = None) Dataset[source]
Parse uvspec output file into xarray.Dataset.
- Parameters:
output_path – Path to uvspec output file.
format – Output format — “netcdf” or “ascii”.
n_zout – Number of zout levels in output (for ASCII multi-level).
column_names – Custom column names for output_user ASCII output.
- Returns:
xarray.Dataset with wavelength (and optionally zout) as coordinates.
Temporary file lifecycle management for uvspec data files.
- class pyradtran.core.tempfile_manager.TempFileManager(temp_dir: str | None = None, keep_temp: bool = False)[source]
Bases:
objectManage temporary data files for uvspec execution.
- Parameters:
temp_dir – Directory for temporary files. Defaults to system temp.
keep_temp – If True, don’t delete files on cleanup (for debugging).
Usage:
with TempFileManager() as mgr: path = mgr.write_array("extinction.dat", extinction_data) # files cleaned up on exit
Convenience Functions
High-level convenience functions for common radiative transfer tasks.
- pyradtran.convenience.run_3d(atmosphere_file: str | None = None, profile: str = 'us', altitude: float = 0.0, sza: float = 30.0, wl_min: float = 300.0, wl_max: float = 2500.0, photons: int = 100000, ipa: bool = False, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run 3D Monte Carlo radiative transfer simulation.
- Parameters:
atmosphere_file – Path to 3D atmospheric field file.
profile – Standard atmosphere profile (for 1D fallback).
altitude – Surface altitude in km.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
photons – Number of Monte Carlo photons.
ipa – Use independent pixel approximation.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with 3D radiative transfer results.
- pyradtran.convenience.run_cloudy_scene(ic_properties: str = 'fu', ic_tau: float | None = None, ic_habit: str | None = None, wc_properties: str | None = None, wc_tau: float | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with cloud layer.
- Parameters:
ic_properties – Ice cloud parameterization (fu, yang, key, baum, etc.).
ic_tau – Ice cloud optical thickness (set via ic_modify).
ic_habit – Ice crystal habit type.
wc_properties – Water cloud parameterization (hu, echam4).
wc_tau – Water cloud optical thickness.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.convenience.run_lidar(area: float = 1.0, E0: float = 0.1, efficiency: float = 0.5, position: float = 0.0, range_bin: float = 0.1, n_ranges: int = 100, profile: str = 'us', altitude: float = 0.0, wl_min: float = 300.0, wl_max: float = 1100.0, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run single scattering lidar simulation.
- Parameters:
area – Telescope area in m^2.
E0 – Pulse energy in Joules.
efficiency – Detector efficiency.
position – Lidar position in km.
range_bin – Range bin width in km.
n_ranges – Number of range bins.
profile – Atmospheric profile.
altitude – Surface altitude in km.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with lidar signal vs range.
- pyradtran.convenience.run_polarized(profile: str = 'us', altitude: float = 0.0, sza: float = 30.0, wl_min: float = 250.0, wl_max: float = 1200.0, photons: int = 100000, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run polarized Monte Carlo simulation.
- Parameters:
profile – Atmospheric profile.
altitude – Surface altitude in km.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
photons – Number of Monte Carlo photons.
streams – Number of streams (for correlated-k).
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with polarized radiance.
- pyradtran.convenience.run_satellite(geometry: str = 'MPS', pixel: tuple[int, int] | None = None, profile: str = 'us', sza: float = 60.0, wl_min: float = 300.0, wl_max: float = 2500.0, solver: str = 'disort', streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run satellite-viewing radiative transfer simulation.
- Parameters:
geometry – Satellite geometry name (e.g., MPS, SENTINEL2A).
pixel – Optional (x, y) pixel coordinates for satellite_geometry file.
profile – Standard atmosphere profile.
sza – Solar zenith angle in degrees.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
solver – RTE solver name.
streams – Number of angular streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with satellite-view radiance/irradiance.
- pyradtran.convenience.run_solar_radiance(sza: float = 30.0, airmass: float | None = None, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 250.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, solver: str = 'disort', uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate solar spectral radiance (direct + diffuse irradiance).
- Parameters:
sza – Solar zenith angle in degrees. Ignored if airmass is set.
airmass – Relative airmass. Overrides sza if provided.
profile – Atmospheric profile name.
altitude – Surface altitude in km, or a preset name.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
solver – RTE solver name.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength at TOA and surface.
- pyradtran.convenience.run_solar_transmittance(airmass: float = 1.0, pwv: float = 5.0, ozone: float = 300.0, profile: str = 'us', altitude: float | str = 0.0, wl_min: float = 250.0, wl_max: float = 1200.0, albedo: float = 0.0, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate solar spectral transmittance.
- Parameters:
airmass – Relative airmass (1.0 = zenith).
pwv – Precipitable water vapor in mm (mol_modify H2O).
ozone – Ozone column in DU (mol_modify O3).
profile – Atmospheric profile name (us, ms, mw, tp, ss, sw).
altitude – Surface altitude in km, or a preset name (“LSST”, “CTIO”).
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with transmittance vs wavelength.
- pyradtran.convenience.run_thermal_brightness(pwv: float = 10.0, profile: str = 'ms', altitude: float = 0.0, wl_min: float = 2500.0, wl_max: float = 50000.0, sur_temperature: float | None = None, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Calculate thermal infrared brightness temperature.
- pyradtran.convenience.run_with_aerosol(aerosol_file_type: str = 'explicit', aerosol_file_path: str | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with external aerosol optical property file.
- Parameters:
aerosol_file_type – Type of aerosol file (explicit, gg, ssa, tau, moments).
aerosol_file_path – Path to the aerosol file.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.convenience.run_with_opac_custom(species_file: str, library: str = 'OPAC', species_names: list[str] | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with OPAC custom species profile.
- Parameters:
species_file – Path to an ASCII species mass concentration profile file.
library – OPAC library path or “OPAC” for default resolution.
species_names – Optional species filter.
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
- pyradtran.convenience.run_with_opac_preset(preset: str | OpacPresetName, library: str = 'OPAC', species_names: list[str] | None = None, sza: float = 30.0, profile: str = 'us', altitude: float | str = 0.0, pwv: float = 5.0, ozone: float = 300.0, wl_min: float = 300.0, wl_max: float = 2500.0, albedo: float = 0.2, streams: int = 16, uvspec_exe: str | None = None, data_path: str | None = None) Dataset[source]
Run uvspec with OPAC preset mixture profile.
- Parameters:
preset – OPAC preset name (e.g. “continental_average”) or OpacPresetName enum.
library – OPAC library path or “OPAC” for default resolution.
species_names – Optional species filter (e.g. [“inso”, “soot”]).
sza – Solar zenith angle in degrees.
profile – Atmospheric profile name.
altitude – Surface altitude in km.
pwv – Precipitable water vapor in mm.
ozone – Ozone column in DU.
wl_min – Minimum wavelength in nm.
wl_max – Maximum wavelength in nm.
albedo – Surface albedo.
streams – Number of DISORT streams.
uvspec_exe – Path to uvspec binary.
data_path – Path to libRadtran data directory.
- Returns:
xarray.Dataset with irradiance vs wavelength.
Configuration Models
Base
Base class for all uvspec option models.
- class pyradtran.models.base.UvspecOption[source]
Bases:
BaseModelBase class for uvspec keyword group models.
All models are frozen (immutable) and reject extra fields to catch typos at the Python level rather than at uvspec runtime.
Subclasses must implement
to_uvspec_lines()to serialize their configuration to uvspec input file format.- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Atmosphere
Atmosphere configuration model.
Maps to uvspec keywords: atmosphere_file, altitude, pressure, mol_modify, mol_abs_param.
Reference: libRadtran src_py/molecular_options.py, src_py/surface_options.py
- class pyradtran.models.atmosphere.AtmosphereConfig(*, profile: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)], altitude: ~typing.Annotated[float, ~annotated_types.Ge(ge=-1000000.0), ~annotated_types.Le(le=1000000.0)] = 0.0, pressure: ~types.Annotated[float | None, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=1000000.0)] = None, mol_modify: list[tuple[str, float, str]] = <factory>, mol_abs_param: str | None = None, crs_model: dict[str, str] | list[dict[str, str]] | None = None, atm_z_grid: list[float] | None = None, radiosonde: bool = False, radiosonde_levels_only: bool = False, mol_file: list[dict[str, str]] | None = None, mol_tau_file: tuple[str, str] | None = None, rayleigh_depol: ~types.Annotated[float | None, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = None, raman: bool = False)[source]
Bases:
UvspecOptionAtmospheric profile and molecular absorption configuration.
- profile
Named AFGL atmosphere or path to custom atmosphere file. Shorthands: us, ms, mw, tp, ss, sw. Full names: US-standard, midlatitude_summer, midlatitude_winter, tropics, subarctic_summer, subarctic_winter.
- Type:
- mol_modify
List of (species, column_value, unit) tuples. Species: O3, O2, H2O, CO2, NO2, BRO, OCLO, HCHO, O4, SO2, CH4, N2O, CO, N2. Units: DU, CM_2, MM.
- mol_abs_param
Molecular absorption parameterization scheme string. Default is reptran coarse (handled by uvspec internally).
- Type:
str | None
- mol_file
List of molecular VMR profile files, each a dict with keys “species”, “file”, and optional “unit”.
- mol_tau_file
Molecular optical thickness file as (kind, filepath) tuple.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_crs_model() AtmosphereConfig[source]
- validate_mol_modify_entries() AtmosphereConfig[source]
- validate_radiosonde() AtmosphereConfig[source]
Source
Source configuration model.
Maps to uvspec keywords: source, sza, phi0, day_of_year, solar_flux_file, umu, phi, latitude, longitude, time, time_interpolate, time_interval, earth_radius, sza_file, isotropic_source_toa.
Reference: libRadtran src_py/geometry_options.py, src_py/spectral_options.py
- class pyradtran.models.source.SourceConfig(*, source: ~typing.Annotated[str, _PydanticGeneralMetadata(pattern='^(solar|thermal)$')], sza: ~types.Annotated[float | None, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=180.0)] = None, phi0: ~types.Annotated[float | None, ~annotated_types.Ge(ge=-360.0), ~annotated_types.Le(le=360.0)] = None, day_of_year: ~types.Annotated[int | None, ~annotated_types.Ge(ge=1), ~annotated_types.Le(le=366)] = None, solar_flux_file: str | None = None, umu: list[float] = <factory>, phi: list[float] = <factory>, satellite_geometry: str | None = None, satellite_pixel: tuple[int, int] | None = None, latitude: tuple[str, int, int, int] | None = None, longitude: tuple[str, int, int, int] | None = None, time: str | None = None, time_interpolate: bool = False, time_interval: tuple[str, str] | None = None, earth_radius: ~types.Annotated[float | None, ~annotated_types.Ge(ge=0.0)] = None, sza_file: str | None = None, isotropic_source_toa: bool = False)[source]
Bases:
UvspecOptionSolar or thermal radiation source configuration.
- sza
Solar zenith angle in degrees [0, 180]. Required for solar source (unless sza_file or isotropic_source_toa is set).
- Type:
float | None
- satellite_pixel
Pixel coordinates (x, y) for satellite pixel-based geometry.
- latitude
Geographic latitude as (hemisphere, degrees, minutes, seconds).
- longitude
Geographic longitude as (hemisphere, degrees, minutes, seconds).
- check_satellite_consistency() SourceConfig[source]
- check_sza_for_solar() SourceConfig[source]
- check_sza_mutual_exclusion() SourceConfig[source]
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
Wavelength
Wavelength configuration model.
Maps to uvspec keywords: wavelength, spline, filter_function_file, wavelength_grid_file, wavelength_index, slit_function_file, spline_file, fluorescence, fluorescence_file, thermal_bands_file, thermal_bandwidth.
Reference: libRadtran src_py/spectral_options.py
- class pyradtran.models.wavelength.WavelengthConfig(*, wavelength_min: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, wavelength_max: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, unit: Annotated[str, _PydanticGeneralMetadata(pattern='^(nm|cm-1)$')] = 'nm', spline: str | None = None, filter_function_file: str | None = None, wavelength_grid_file: str | None = None, wavelength_index: tuple[int, int] | None = None, slit_function_file: str | None = None, spline_file: str | None = None, fluorescence: bool = False, fluorescence_file: str | None = None, thermal_bands_file: str | None = None, thermal_bandwidth: tuple[float, str] | None = None)[source]
Bases:
UvspecOptionSpectral range configuration.
- wavelength_min
Shortest wavelength (nm or cm-1), or single wavelength when wavelength_max is not set.
- Type:
float | None
- wavelength_max
Longest wavelength (nm or cm-1). Optional; when None, wavelength_min is treated as a single wavelength value.
- Type:
float | None
- wavelength_grid_file
Path to wavelength grid file (alternative to wavelength_min).
- Type:
str | None
- wavelength_index
Tuple of (start_index, end_index) for wavelength subset.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_wavelength_set() WavelengthConfig[source]
Solver
Solver configuration model.
Maps to uvspec keywords: rte_solver, number_of_streams, pseudospherical, deltam.
Reference: libRadtran src_py/solver_options.py
- class pyradtran.models.solver.SolverConfig(*, method: str, streams: Annotated[int, Ge(ge=1)] = 6, pseudospherical: bool = False, deltam: bool = False, dynamic_iterations: Annotated[int | None, Ge(ge=0)] = None, dynamic_history: bool = False, dynamic_heat_unit: str | None = None, disort_intcor: str | None = None, disort_spherical_albedo: bool = False, schwarzschild_streams: Annotated[int | None, Ge(ge=1)] = None)[source]
Bases:
UvspecOptionRadiative transfer solver configuration.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_solver() SolverConfig[source]
Output
Output configuration model.
Maps to uvspec keywords: output_user, output_quantity, output_process, output_format, quiet, verbose, zout, output_file.
Reference: libRadtran src_py/output_options.py
- class pyradtran.models.output.OutputConfig(*, quantities: list[str] = <factory>, quantity: str | None = None, process: str | None = None, format: str = 'netcdf', quiet: bool = True, verbose: bool = False, zout: list[float | str] = <factory>, output_file: str | None = None, heating_rate: str | None = None, write_optical_properties: bool = False)[source]
Bases:
UvspecOptionOutput format and content configuration.
- zout
Output altitudes in km above ground level. Supports float values and special strings like “toa” and “boa”.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_output() OutputConfig[source]
Surface
Surface configuration model.
Maps to uvspec keywords: albedo, albedo_file, albedo_map, albedo_library, sur_temperature, brdf_ambrals, brdf_hapke, brdf_rpv, brdf_cam, bpdf_litvinov, bpdf_maignan, bpdf_tsang_u10.
Reference: libRadtran src/uvspec_lex.l (surface/BRDF options)
- class pyradtran.models.surface.SurfaceConfig(*, albedo: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, albedo_file: str | None = None, albedo_map: str | tuple[str, str] | None = None, albedo_library: str | None = None, sur_temperature: float | None = None, brdf_ambrals: dict[str, float] | None = None, brdf_hapke: dict[str, float] | None = None, brdf_rpv: dict[str, float] | None = None, brdf_cam: dict[str, float] | None = None, bpdf_litvinov: dict[str, float] | None = None, bpdf_maignan: dict[str, float] | None = None, bpdf_tsang_u10: Annotated[float | None, Ge(ge=0.0), Le(le=100.0)] = None, brdf_rossli_file: str | None = None, brdf_rossli_hotspot: bool = False, brdf_rpv_file: str | None = None, surface_type_map: str | None = None, surface_temperature_map: str | tuple[str, str, float] | None = None)[source]
Bases:
UvspecOptionSurface reflection and temperature configuration.
- albedo_map
Path to spatial albedo map NetCDF file, or tuple (path, variable).
- check_mutual_exclusion() SurfaceConfig[source]
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Cloud
Cloud configuration model (Phase 2).
Maps to uvspec keywords: ic_file, ic_properties, ic_habit, ic_habit_yang2013, ic_modify, wc_file, wc_properties, wc_modify, cloudcover, cloud_overlap.
Reference: libRadtran src/uvspec_lex.l (cloud options)
- class pyradtran.models.cloud.CloudConfig(*, ic_properties: str | None = None, ic_file: tuple[str, str] | None=None, ic_habit: str | None = None, ic_habit_roughness: str | None = None, ic_modify: list[CloudModifyEntry] = <factory>, wc_properties: str | None = None, wc_file: tuple[str, str] | None=None, wc_modify: list[CloudModifyEntry] = <factory>, modify: list[CloudModifyEntry] = <factory>, cloud_cover_type: str | None = None, cloud_cover: Annotated[float | None, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = None, cloud_overlap: str | None = None, interpolate: bool = False, cloud_fraction_file: str | None = None, cloud_fraction_map: str | tuple[str, str, float] | None=None, wc_saturate: bool = False, ic_saturate: bool = False, wc_ipa: bool = False, wc_layer: Annotated[int | None, ~annotated_types.Ge(ge=0)] = None)[source]
Bases:
UvspecOptionCloud configuration for water and ice clouds.
- ic_modify
List of ice cloud modification directives.
- Type:
- wc_modify
List of water cloud modification directives.
- Type:
- ic_modify: list[CloudModifyEntry]
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- modify: list[CloudModifyEntry]
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_cloud() CloudConfig[source]
- wc_modify: list[CloudModifyEntry]
- class pyradtran.models.cloud.CloudModifyEntry(*, variable: str, action: str, value: float)[source]
Bases:
UvspecOptionA single cloud modify directive (wc_modify or ic_modify).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_entry() CloudModifyEntry[source]
Monte Carlo
Monte Carlo (MYSTIC) configuration model.
Maps to uvspec keywords: mc_photons, mc_backward, mc_escape, mc_vroom, mc_polarisation, mc_randomseed, mc_minphotons, mc_maxscatters, mc_spectral_is, mc_delta_scaling, mc_rad_alpha, mc_backward_output, mc_forward_output, mc_backward_heat, mc_std, mc_jacobian, mc_progressbar, mc_surface_reflectalways, mc_spherical, mc_tenstream, mc_ipa, mc_tipa, mc_sensordirection, mc_sensorposition, mc_spherical3D_scene, mc_basename, mc_minscatters, mc_sun_angular_size.
Reference: libRadtran src_py/mc_options.py
- class pyradtran.models.mc.McConfig(*, photons: Annotated[int | None, Ge(ge=0)] = None, min_photons: Annotated[int | None, Ge(ge=0)] = None, backward: bool = False, backward_pixel_range: tuple[int, int, int, int] | None = None, escape: str | None = None, vroom: str | None = None, polarisation: bool = False, polarisation_state: Annotated[int | None, Ge(ge=-3), Le(le=4)] = None, random_seed: Annotated[int | None, Ge(ge=0), Le(le=1000000000000000)] = None, max_scatters: Annotated[int | None, Ge(ge=0)] = None, spectral_is: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, delta_scaling_mucut: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, delta_scaling_n_start: Annotated[int | None, Ge(ge=0)] = None, rad_alpha: Annotated[float | None, Ge(ge=0.0), Le(le=90.0)] = None, backward_output: str | None = None, backward_output_unit: str | None = None, forward_output: str | None = None, backward_heat: str | None = None, std: Annotated[float | None, Ge(ge=0.0)] = None, jacobian: str | None = None, jacobian_std: bool = False, progressbar: Annotated[int | None, Ge(ge=0), Le(le=3)] = None, surface_reflect_always: bool = False, photons_file: str | None = None, albedo_file: str | None = None, albedo_spectral_file: str | None = None, rossli_file: str | None = None, ambrals_spectral_file: str | None = None, rpv_spectral_file: str | None = None, bpdf: str | None = None, surface_parallel: bool = False, elevation_file: str | None = None, lidar_file: str | None = None, triangular_surface_file: str | None = None, spherical: str | None = None, tenstream: bool = False, ipa: bool = False, tipa: str | None = None, sensor_direction: tuple[float, float, float] | None = None, sensor_position: tuple[float, float, float] | None = None, spherical3d_scene: tuple[float, float, float, float] | None = None, basename: str | None = None, min_scatters: Annotated[int | None, Ge(ge=0)] = None, sun_angular_size: Annotated[float | None, Ge(ge=0.0), Le(le=10.0)] = None, relerr: Annotated[float | None, Ge(ge=0.0)] = None, coherent_backscatter: bool = False, nca: bool = False, aerosol_is: bool = False, bcond: str | None = None)[source]
Bases:
UvspecOptionMonte Carlo (MYSTIC) solver configuration.
- backward_pixel_range
Optional (ix_start, iy_start, ix_end, iy_end).
- spherical3d_scene
Spherical 3D scene bounds (lon_min, lat_min, lon_max, lat_max).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
SSLidar
SSLidar (Single Scattering Lidar) configuration model.
Maps to uvspec keywords: sslidar, sslidar_nranges, sslidar_polarisation.
Reference: libRadtran src_py/geometry_options.py, src_py/solver_options.py
- class pyradtran.models.sslidar.SslidarConfig(*, area: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, E0: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, efficiency: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, position: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, range_bin: Annotated[float | None, Ge(ge=0), Le(le=1000000.0)] = None, n_ranges: Annotated[int | None, Ge(ge=1)] = None, polarisation: bool = False)[source]
Bases:
UvspecOptionSingle scattering lidar configuration.
Requires rte_solver sslidar.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
3D Fields
3D atmosphere and cloud configuration model.
Maps to uvspec keywords: atmosphere_file (3D NetCDF fields).
Note: 3D cloud fields are specified via CloudConfig using wc_file=(“3D”, path) or ic_file=(“3D”, path), not through a separate keyword. The ipa_3d and output3D flags are set automatically by uvspec when tipa or MYSTIC is enabled.
Reference: libRadtran src/uvspec_lex.l (MYSTIC 3D options)
- class pyradtran.models.three_d.ThreeDConfig(*, atmosphere_file: str | None = None)[source]
Bases:
UvspecOption3D atmospheric field configuration.
Configures 3D atmospheric input fields for MYSTIC and dynamic tenstream solvers.
Note
3D cloud fields are specified through CloudConfig: scene.set_cloud(wc_file=(“3D”, “/path/to/cloud3d.nc”)) or scene.set_cloud(ic_file=(“3D”, “/path/to/ic3d.nc”)).
The ipa (independent pixel approximation) for 3D is enabled via McConfig.ipa=True or McConfig.tipa=”dir”/”dir3d”.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Advanced
Advanced options model.
Maps to uvspec keywords: fluorescence, fluorescence_file, raman.
Phase 3 scope. Phase 4 may add 3D, satellite geometry, dynamic solvers, etc.
Reference: libRadtran src_py/surface_options.py, src_py/solver_options.py
- class pyradtran.models.advanced.AdvancedConfig(*, fluorescence: Annotated[float | None, Ge(ge=0.0)] = None, fluorescence_file: str | None = None, raman: bool = False, raman_variant: str | None = None)[source]
Bases:
UvspecOptionAdvanced radiative transfer options.
- fluorescence_file
Path to wavelength-dependent fluorescence file. Mutually exclusive with fluorescence.
- Type:
str | None
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_items() list[tuple[int, str]][source]
Return (phase, keyword_line) pairs for priority-sorted output.
Subclasses may override to assign different phases to different keywords. Default phase is 9 (output section).
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_advanced() AdvancedConfig[source]
Special
Special options model for scattering/absorption control and file includes.
Maps to uvspec keywords: no_absorption, no_scattering, no_scattering mol, include.
Reference: libRadtran src/uvspec_lex.l
- class pyradtran.models.special.SpecialConfig(*, no_absorption: bool = False, no_scattering: bool = False, no_scattering_mol: bool = False, include_files: list[str] = <factory>)[source]
Bases:
UvspecOptionSpecial options: scattering/absorption toggles and include files.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_scattering() SpecialConfig[source]
Aerosol Models
Standard Aerosol
Aerosol configuration models.
Provides a strict class hierarchy for aerosol configuration:
OpacPreset: OPAC preset mixture profiles (continental_average, maritime_clean, etc.)
OpacCustom: OPAC custom species profile files
ExternalAerosol: External optical property files (explicit, gg, ssa, tau, moments)
Reference: libRadtran src/uvspec_lex.l (aerosol options) Reference: Hess et al. (1998), Bull. Amer. Meteor. Soc., 79, 831-844
- class pyradtran.models.aerosol.AerosolModel(*, set_tau_at_wvl: tuple[float, float] | None=None, king_byrne: tuple[float, float, float] | None=None, modify: list[AerosolModifyEntry] = <factory>)[source]
Bases:
UvspecOptionAbstract base class for all aerosol configurations.
Subclasses implement mode-specific
to_uvspec_lines(). Common capabilities (set_tau_at_wvl, king_byrne, modify) are handled here.- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- modify: list[AerosolModifyEntry]
- class pyradtran.models.aerosol.AerosolModifyEntry(*, variable: str, action: str, value: float)[source]
Bases:
UvspecOptionA single aerosol_modify directive.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_entry() AerosolModifyEntry[source]
- pyradtran.models.aerosol.ExternalAerosol
alias of
ExternalFile
- class pyradtran.models.aerosol.ExternalFile(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, files: ~typing.Annotated[list[tuple[str, str]], ~annotated_types.MinLen(min_length=1)])[source]
Bases:
AerosolModelExternal aerosol optical property files.
- files
List of (file_type, file_path) tuples. Types: “gg”, “ssa”, “tau”, “explicit”, “moments”, “ref”, “siz”.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_files() ExternalFile[source]
- class pyradtran.models.aerosol.OpacCustom(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, species_file: ~typing.Annotated[str, ~annotated_types.MinLen(min_length=1)], species_names: list[str] | None = None, library: str = 'OPAC')[source]
Bases:
AerosolModelOPAC custom species profile aerosol.
Uses a user-provided mass concentration profile file with the OPAC library.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_species() OpacCustom[source]
- class pyradtran.models.aerosol.OpacPreset(*, set_tau_at_wvl: tuple[float, float] | None=None, king_byrne: tuple[float, float, float] | None=None, modify: list[AerosolModifyEntry] = <factory>, name: OpacPresetName, library: str = 'OPAC', species_names: list[str] | None = None)[source]
Bases:
AerosolModelOPAC preset mixture profile aerosol.
Uses pre-defined aerosol species mixture profiles from the OPAC library. The
nameselects from 10 predefined mixture profiles. Optionally filter to specific species viaspecies_names.- name
Preset mixture profile name.
- Type:
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: OpacPresetName
- to_uvspec_lines() list[str][source]
Serialize this configuration to uvspec input file lines.
- Returns:
List of strings, each being one line of a uvspec input file.
- validate_species() OpacPreset[source]
- class pyradtran.models.aerosol.OpacPresetName(value)[source]
-
OPAC preset mixture profile names.
These correspond to files in data/aerosol/OPAC/standard_aerosol_files/.
- ANTARCTIC = 'antarctic'
- CONTINENTAL_AVERAGE = 'continental_average'
- CONTINENTAL_CLEAN = 'continental_clean'
- CONTINENTAL_POLLUTED = 'continental_polluted'
- DESERT = 'desert'
- DESERT_SPHEROIDS = 'desert_spheroids'
- MARITIME_CLEAN = 'maritime_clean'
- MARITIME_POLLUTED = 'maritime_polluted'
- MARITIME_TROPICAL = 'maritime_tropical'
- URBAN = 'urban'
Composite Aerosol
Composable aerosol optical-property models (Tier 1–4).
See design spec: docs/superpowers/specs/2026-04-27-composite-aerosol-design.md
- class pyradtran.models.aerosol_composite.CompositeAerosol(*, set_tau_at_wvl: tuple[float, float] | None = None, king_byrne: tuple[float, float, float] | None = None, modify: list[~pyradtran.models.aerosol.AerosolModifyEntry] = <factory>, sources: ~typing.Annotated[list, ~annotated_types.MinLen(min_length=1)], wavelength_grid_um: ~typing.Annotated[list[float], ~annotated_types.MinLen(min_length=1)], altitude_grid_km: ~typing.Annotated[list[float], ~annotated_types.MinLen(min_length=2)], n_legendre: int = 32, output_dir: ~pathlib.Path | None = None)[source]
Bases:
AerosolModelTier 4: composite aerosol scene mixing multiple sources.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- to_uvspec_lines() list[str][source]
Generate
aerosol_file explicit <master>line.For single preset/external sources, delegates directly to their
to_uvspec_lines()to avoid the explicit-file overhead.
- validate_grids() CompositeAerosol[source]
- class pyradtran.models.aerosol_composite.IntegrationConfig(*, n_radius_grid: int = 200, radius_min_um: float = 0.001, radius_max_um: float = 100.0)[source]
Bases:
BaseModelConfiguration for size-distribution numerical integration.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyradtran.models.aerosol_composite.LayerOptics(tau: ndarray[tuple[Any, ...], dtype[_ScalarT]], ssa: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]])[source]
Bases:
objectExtensive optical properties per layer.
- class pyradtran.models.aerosol_composite.LoadedSpecies(*, species: MieSpecies | PrecomputedSpecies | OPACSpecies, mass_profile_kg_m3: Annotated[list[float], MinLen(min_length=1)], altitude_km: Annotated[list[float], MinLen(min_length=2)], rh_profile: list[float] | None = None)[source]
Bases:
BaseModelTier 3: extensive in-atmosphere optical properties.
- evaluate(wl_um: ndarray, z_km: ndarray, n_legendre: int = 32) LayerOptics[source]
Evaluate optical properties on (wavelength, altitude) grid.
- Parameters:
wl_um – Wavelength grid in um, strictly ascending.
z_km – Altitude grid in km, strictly descending (layer centers or boundaries).
n_legendre – Number of Legendre moments.
- Returns:
LayerOptics with shape (n_wl, n_layer).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- species: MieSpecies | PrecomputedSpecies | OPACSpecies
- validate_profiles() LoadedSpecies[source]
- class pyradtran.models.aerosol_composite.MieSpecies(*, refractive_index: ~pyradtran.models.aerosol_composite.RefractiveIndex, size_distribution: ~pyradtran.models.aerosol_composite.SizeDistribution, particle_density_kg_m3: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)], integration_config: ~pyradtran.models.aerosol_composite.IntegrationConfig = <factory>)[source]
Bases:
BaseModelMie-computed species from refractive index + size distribution.
- integration_config: IntegrationConfig
- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Compute mass-normalized intensive optical properties.
- Parameters:
wl_um – Wavelengths in micrometers.
n_legendre – Number of Legendre moments to generate. Because the bhmie() path does not compute angular scattering by default, moments are derived from the Henyey-Greenstein phase function rather than a full Mie phase function.
- Returns:
SpeciesOptics with beta_ext_per_mass, ssa, g, and legendre_moments.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- refractive_index: RefractiveIndex
- size_distribution: SizeDistribution
- class pyradtran.models.aerosol_composite.OPACSpecies(*, netcdf_path: Annotated[str, MinLen(min_length=1)], wavelength_nm: float | None = None)[source]
Bases:
BaseModelOPAC species from a pre-computed libRadtran netCDF optical-property file.
The netCDF file is expected to contain
output_dtauc,output_ssalb, andoutput_pmomvariables (libRadtranwrite_optical_propertiesformat).- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Read netCDF and return intensive properties.
For a netCDF with
nlyrlayers, the returnedbeta_ext_per_massassumes the optical depth is distributed uniformly across layers for the purpose of SpeciesOptics (the actual layer geometry is applied later in LoadedSpecies).
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyradtran.models.aerosol_composite.ParticleOptics(*, wavelength_um: Annotated[list[float], MinLen(min_length=1)], radius_um: Annotated[list[float], MinLen(min_length=1)], Qext: ndarray[tuple[Any, ...], dtype[_ScalarT]], Qsca: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None)[source]
Bases:
BaseModelSingle-particle optical properties vs wavelength and radius.
- Qext: NDArray
- Qsca: NDArray
- classmethod from_aerosol3d(data) ParticleOptics[source]
Create ParticleOptics from Aerosol3D AerosolOpticsData.
Handles unit conversion (nm -> um, nm^2 -> um^2) and Legendre convention (prefers beta_l, falls back to k_l conversion).
- Parameters:
data – Object with wavelength_nm, C_ext, C_sca, g, r_eff_nm, n_legendre, legendre_moments_beta, legendre_moments fields.
- Returns:
ParticleOptics ready for use in PrecomputedSpecies.
- classmethod from_cross_sections(*, wavelength_um: list[float], radius_um: list[float], Cext_um2: ndarray[tuple[Any, ...], dtype[_ScalarT]], Csca_um2: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None) ParticleOptics[source]
Build from cross-sections (convert to Q-factors).
- g: NDArray
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_shapes() ParticleOptics[source]
- class pyradtran.models.aerosol_composite.PrecomputedSpecies(*, particle_optics: ~pyradtran.models.aerosol_composite.ParticleOptics, size_distribution: ~pyradtran.models.aerosol_composite.SizeDistribution, particle_density_kg_m3: ~typing.Annotated[float, ~annotated_types.Gt(gt=0)], integration_config: ~pyradtran.models.aerosol_composite.IntegrationConfig = <factory>)[source]
Bases:
BaseModelSpecies from precomputed ParticleOptics + size distribution.
- integration_config: IntegrationConfig
- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
Integrate precomputed Q-factors over size distribution.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- particle_optics: ParticleOptics
- size_distribution: SizeDistribution
- class pyradtran.models.aerosol_composite.RefractiveIndex(*, wavelength_um: Annotated[list[float], MinLen(min_length=2)], n_real: list[float], k_imag: Annotated[list[float], MinLen(min_length=1)])[source]
Bases:
BaseModelWavelength-dependent complex refractive index.
Interpolation is log-linear in wavelength.
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_lengths_and_sorted() RefractiveIndex[source]
- class pyradtran.models.aerosol_composite.SizeDistribution(*, kind: Literal['lognormal', 'modified_gamma', 'discrete', 'monodisperse'], params: dict, number_density_per_m3: float = 1.0)[source]
Bases:
BaseModelAerosol particle size distribution.
- kind: Literal['lognormal', 'modified_gamma', 'discrete', 'monodisperse']
- model_config = {'extra': 'forbid', 'frozen': True, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- validate_params() SizeDistribution[source]
- class pyradtran.models.aerosol_composite.Species(*args, **kwargs)[source]
Bases:
ProtocolProtocol for Tier 2 species classes.
- intensive(wl_um: ndarray, n_legendre: int = 32) SpeciesOptics[source]
- class pyradtran.models.aerosol_composite.SpeciesOptics(beta_ext_per_mass: ndarray[tuple[Any, ...], dtype[_ScalarT]], ssa: ndarray[tuple[Any, ...], dtype[_ScalarT]], g: ndarray[tuple[Any, ...], dtype[_ScalarT]], legendre_moments: ndarray[tuple[Any, ...], dtype[_ScalarT]] | None = None)[source]
Bases:
objectMass-normalized intensive optical properties of an aerosol species.
Aerosol Optics
Presets
Site altitudes, standard atmosphere profiles, and common configurations.