pyradtran.core.Simulation#

class pyradtran.core.Simulation(config: SimulationConfig)[source]#

Bases: object

Low-level wrapper around a single uvspec execution.

Parameters:

config (SimulationConfig) – Fully merged configuration object.

__init__(config: SimulationConfig)[source]#

Initialise with a merged SimulationConfig.

__init__(config)

Initialise with a merged SimulationConfig.

format_cloud_profile(data)

Format a cloud-profile dict as a libRadtran column file.

run_simulation(dt, latitude, longitude[, ...])

Run a single uvspec simulation.

static format_cloud_profile(data: Dict[str, Any]) str[source]#

Format a cloud-profile dict as a libRadtran column file.

Parameters:

data (dict) – Must contain 'z' (altitude in km) and either 'lwc' or 'iwc' (water content in g m⁻³), plus 'reff' (effective radius in µm).

Returns:

Multi-line string ready to write to a .dat file.

Return type:

str

Raises:

ValueError – If required keys are missing.

run_simulation(dt: datetime, latitude: float, longitude: float, override_albedo: float | None = None, override_surface_temperature: float | None = None, override_altitude_km: float | None = None, override_surface_type: int | None = None, era5_atmosphere_file: Path | None = None, parameter_overrides: Dict[str, Any] = None) Path | None[source]#

Run a single uvspec simulation.

Parameters:
  • dt (datetime) – Simulation date/time (UTC).

  • latitude (float) – Location in degrees.

  • longitude (float) – Location in degrees.

  • override_albedo (float, optional) – Per-point surface albedo (overrides config value).

  • override_surface_temperature (float, optional) – Per-point surface temperature in K.

  • override_altitude_km (float, optional) – Per-point observation altitude in km.

  • override_surface_type (int, optional) – IGBP surface-type code (1–20) for BRDF look-up.

  • era5_atmosphere_file (pathlib.Path, optional) – Custom ERA5 atmosphere file (radiosonde format).

  • parameter_overrides (dict, optional) – Extra key: value pairs appended to the input file.

Returns:

Path to the uvspec output file, or None on failure.

Return type:

pathlib.Path or None

Raises:

UvspecExecutionError – If the subprocess returns a non-zero exit code.