eradiate.data.convert.make_aer_core_v2¶
- eradiate.data.convert.make_aer_core_v2(w, phamat, mu, theta, ext, ssa, phase, nangles=None, pmom=None, nmom=None, grid_res=3, attrs=None, normalize=False, check=None)¶
Create a new dataset in the Aer-Core v2 format.
- Parameters:
w (
quantity) – Wavelength, shape (nw,).phamat (
listofstr) – Phase matrix component list, shape (nphamat,).mu (
quantity) – Scattering angle cosine, shape (nw, nangle).theta (
quantity) – Scattering angle, shape (nw, nangle).ext (
quantity) – Extinction coefficient, shape (nw,).ssa (
quantity) – Single-scattering albedo, shape (nw,).phase (
quantity) – Phase matrix values, shape (nphamat, nw, nangle). Integral normalized to 2 (i.e. ∫ p(μ) dμ = 2).nangles (
ndarray, optional) – Number of valid angular samples per wavelength, shape (nw,), dtype int. When provided, entries at indices>= nangles[iw]inmu,theta, andphasemust be NaN-padded. Thenanglesdataset variable is always written; if not provided, it is inferred by counting non-NaN entries in the first phase matrix component.pmom (
ndarray, optional) – Legendre polynomials for the (1,1) phase matrix element, shape (nw, nimom). If not provided, they are computed automatically fromphaseandthetausingcompute_pmom()withcoefficients=True.nmom (
intorndarray, optional) – Controls the number of Legendre polynomials. Thenmomdataset variable is always written whenpmomis present.None(default) — whenpmomis not provided, compute 129 coefficients and store their count as a uniformnmomarray; whenpmomis provided explicitly, infer per-wavelength counts by counting non-NaN entries in the first phase matrix component, consistent with the NaN-padding convention.int— scalar moment count; used as the target for automatic computation and stored as a uniformnmomarray.ndarrayshape(nw,)— per-wavelength count stored as-is.pmommust be provided explicitly whennmomis an ndarray.
grid_res (
int, default:3) – Angular grid resolution passed tocompute_pmom()whenpmomis computed automatically.3uses the input grid with the exact BDE method (recommended). Seecompute_pmom()for all options.attrs (
dict) – Dataset attributes.normalize (
bool, default:False) – IfTrue, rescale the phase matrix so thatp₁₁integrates to 2 over μ ∈ [-1, 1]. All phase matrix components are multiplied by the same factor (2 / ∫p₁₁ dμ), preserving their relative magnitudes. WhenFalse(default), the caller is responsible for providing a pre-normalizedphasearray.check (
{"none", "fast", "full"}, optional) – Controls validation of themuangular grid sort order.Noneor"none"— no check (default)."fast"— sampling-based check: validates a random 10 % of wavelengths (at least one). Intended as a cheap guard during bulk production runs."full"— validates every wavelength.
A
ValueErroris raised if any sampled row is not strictly monotonically increasing in μ. Only the valid (non-NaN) portion of each row is checked (bounded bynangles[iw]).
- Returns:
- Raises:
ValueError – If a value check fails, or if
nmomis an ndarray butpmomis not provided.