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
|
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:
objectCombined radiative-transfer and absorption model.
- Parameters:
freqs (array-like) – Simulation frequencies in GHz.
angles (array-like) – Viewing elevation angles in degrees.
90denotes 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. IfFalse, use plane-parallel slant-path geometry.from_sat (bool, optional) – If
True, integrate top-down (satellite view). IfFalse, 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
freqsisNone.
Notes
Absorption-model instances are initialized during construction and reused for subsequent calls to
execute().Cloud absorption is inferred from the presence of
lwcand/oriwcin the providedAtmProfile.Input
freqsandanglesare converted to torch tensors on the configured dtype/device.
Provenance: the overall radiative-transfer and absorption workflow is adapted from pyrtlib (especially
TbCloudRTEandRTEquation) 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 anxarray.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
profileis not anAtmProfileinstance.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.executeand the underlyingpyrtlib.rt_equation.RTEquationroutines.