eradiate.data.convert.libradtran_to_prt#
- eradiate.data.convert.libradtran_to_prt(ds, attrs=None, fallback_units=None, normalize=False, check='full', *, reff=None, veff=None, hum=None, squeeze=False, tolerance=None, wbounds=(None, None))#
Convert a libRadtran scattering particle property dataset to Prt v1.
The output variant depends on the dimensions remaining after point selection (see
reffandhum): Prt-MS v1 if areffdimension remains, Prt-Hum v1 if ahumdimension remains, Prt-Core v1 otherwise.- Parameters:
ds (
Datasetor path-like) – A dataset in the libRadtran format. If a path is passed, it is resolved by the file resolver and loaded into memory.attrs (
dict, optional) – Additional metadata applied to the converted dataset.fallback_units (
dict, optional) – A mapping that specifies units to apply to variables that are missing them.normalize (
bool, default:False) – IfTrue, rescale the phase matrix so thatp₁₁integrates to 2 over μ ∈ [-1, 1]. Passed tomake_prt_v1(); see that function for details.check (
{"none", "fast", "full"}, default:"full") – Apply validation checks to the output.reff (
floatorquantityor array-like, optional) – Effective radius points to select (nearest neighbour), for datasets with an effective radius dimension. Selection followsxarray.Dataset.sel(): a scalar drops the dimension, a 1D array keeps it. If unset, no selection is performed and the dimension is kept (seesqueeze). Unitless values are interpreted in µm.veff (
float, optional) – The effective variance attached to Prt-MS v1 output, as a size-1veffdimension. If unset, it defaults to1 / (param_alpha + 3), the standard gamma-distribution relation, computed fromds.attrs["param_alpha"]; if that attribute is missing, the output has noveffdimension. Ignored if the output has noreffdimension.hum (
floatorquantityor array-like, optional) – Relative humidity points to select (nearest neighbour), for datasets with a humidity dimension. Same selection rules asreff. Unitless values are interpreted in percent.squeeze (
bool, default:False) – IfTrue, drop size-1reffandhumdimensions on which no selection is performed.tolerance (
dict, optional) – Maximum distance for the nearest-neighbour lookup, indexed by"reff"and"hum". Units follow the same rules as for thereffandhumparameters.wbounds (
tuple, default:(None,None)) – Bounds restricting the spectral domain where conversion is performed, as a (min, max) pair; useNoneto leave a bound open. Examples:(300, 3000),(None, 3000),(0.3, 3) * ureg.micron. Unitless values are interpreted inucc.get("wavelength")units.
- Returns:
xr.Dataset- Raises:
ValueError – If a variable has no units and
fallback_unitsdoes not provide them.
Notes
All conversion is done in memory: very large datasets might result in massive converted data. In such cases, restrict the spectral domain using
wbounds.The Prt-Core v1 format has a single angular discretization common to all phase matrix coefficients, while libRadtran’s data aerosol format allows for a different one for each coefficient. The angular grid of the output dataset is constructed as the union of the libRadtran grids for all coefficients; all coefficients are then interpolated linearly in μ space on the angular points that were missing for them. The same construction applies independently at each
refforhumpoint.