torchMWRT.rt_model#

Torch radiative-transfer model utilities.

This module ports pyrtlib radiative-transfer routines to PyTorch and combines gas/cloud absorption with layer-by-layer radiance integration for batched profiles, frequencies, and viewing angles.

Classes

RTModel(freqs, angles[, absmdl, ...])

Combined radiative-transfer and absorption model.

class torchMWRT.rt_model.RTModel(freqs, angles, absmdl='R98', ray_tracing=False, from_sat=False, dtype=torch.float64, device=None, amu=None)[source]#

Bases: object

Combined radiative-transfer and absorption model.

Parameters:
  • freqs (array-like) – Simulation frequencies in GHz.

  • angles (array-like) – Viewing elevation angles in degrees. 90 denotes zenith-pointing (upward looking).

  • absmdl (str, optional) – Absorption-model identifier (for example "R98" or "R17").

  • ray_tracing (bool, optional) – If True, use refractivity-dependent ray tracing. If False, use plane-parallel slant-path geometry.

  • from_sat (bool, optional) – If True, integrate top-down (satellite view). If False, integrate bottom-up (ground-based view).

  • dtype (torch.dtype, optional) – Default dtype used for internal frequency/angle tensors and absorption model setup.

  • device (str or torch.device, optional) – Device for internal tensors and absorption-model instances.

  • amu (optional) – Optional line-shape parameter forwarded to absorption-model constructors.

Raises:

ValueError – If freqs is None.

Notes

  • Absorption-model instances are initialized during construction and reused for subsequent calls to execute().

  • Cloud absorption is inferred from the presence of lwc and/or iwc in the provided AtmProfile.

  • Input freqs and angles are converted to torch tensors on the configured dtype/device.

Provenance: the overall radiative-transfer and absorption workflow is adapted from pyrtlib (especially TbCloudRTE and RTEquation) and ported to PyTorch for differentiable workflows.

execute(profile, return_intermediate=False, return_ds=False)[source]#

Run radiative-transfer integration for one atmospheric profile object.

Parameters:
  • profile (AtmProfile) – Atmospheric profile container with thermodynamic state, cloud fields, geometry, and optional batch coordinates.

  • return_intermediate (bool, optional) – If True, include intermediate absorption and integrated-path diagnostics in the output.

  • return_ds (bool, optional) – If True, return an xarray.Dataset; otherwise return a dictionary of tensors.

Returns:

Brightness-temperature outputs and, optionally, intermediate absorption/path diagnostics.

Return type:

dict[str, torch.Tensor] or xarray.Dataset

Raises:
  • TypeError – If profile is not an AtmProfile instance.

  • RuntimeError – If ray tracing fails or required intermediate arrays are missing.

Notes

The computation is vectorized over leading batch dimensions, frequency, and viewing angle. Absorption is computed once per frequency/state and reused across angles, then integrated along each slant path.

Provenance: output intent and naming conventions are adapted from pyrtlib.tb_spectrum.TbCloudRTE.execute and the underlying pyrtlib.rt_equation.RTEquation routines.