cesm_hawc.constituents¶
Build the sasktran2 constituents that represent a WACCM column.
hawcsimulator’s default atmosphere contains Rayleigh scattering, MIPAS
climatological ozone, solar irradiance and a Lambertian surface with albedo
0.3. build_waccm_constituents() returns WACCM ozone (replacing the
MIPAS ozone), WACCM NO2 and the two MAM4 sulfate modes, to be passed to
simulator.run() under the constituents key:
constituents = build_waccm_constituents(profiles, alt_grid_m)
data = simulator.run(products, {**sim_input, "constituents": constituents})Do not wrap the dict in Atmosphere(constituents=...): that bypasses the
simulator’s atmosphere step and the aerosol is silently dropped.
Each sulfate mode is an ExtinctionScatterer backed by its own Mie
database, built for a lognormal size distribution with that mode’s width
(sigma_g = 1.6 for accumulation, 1.2 for coarse) and the H2SO4
refractive index. sasktran2 integrates over the size distribution, and
the same database supplies extinction and phase function at every
wavelength. The L2 retrieval separately assumes a single mode with
sigma_g = 1.6, via aliprocessing.l2.optical.aerosol_median_radius_db.
Requires the [sim] extra.
get_mode_mie_database¶
def get_mode_mie_database(mode_width: float)Return the Mie database for one sulfate mode.
Use this to rebuild an sk.constituent.ExtinctionScatterer yourself
from a saved column’s {mode}_reference_extinction_per_m and
{mode}_median_radius_nm (see cesm_hawc.save_inputs).
Parameters¶
mode_width(float) — Geometric standard deviation of the mode: 1.6 for accumulation, 1.2 for coarse.
Returns¶
sasktran2.database.MieDatabase — The database, built on first use.
warm_mode_databases¶
def warm_mode_databases() -> NoneBuild both sulfate-mode Mie databases.
Call this in the main process before starting worker processes, so the databases are built once rather than concurrently by every worker.
build_waccm_constituents¶
def build_waccm_constituents(
profiles: dict,
alt_m: np.ndarray,
return_extinction: bool = False,
truth_wavelengths_nm=None,
)Build the sasktran2 constituents for one WACCM column.
Parameters¶
profiles(dict) — Result ofcesm_hawc.waccm.WACCMAtmosphere.get_column_profiles().alt_m(numpy.ndarray) — Altitude grid [m]; must matchprofiles["altitudes_m"]and the simulator’saltitude_grid.return_extinction(bool, optional) — Also return the truth extinction. Default False.truth_wavelengths_nm(array-like, optional) — Wavelengths [nm] for the truth extinction; normally the simulated wavelengths. Default[745.0].
Returns¶
constituents(dict) —o3andno2(VMRAltitudeAbsorber) andaerosol_accumandaerosol_coarse(ExtinctionScatterer, fromso4_a1andso4_a3).true_extinction(dict) — Only ifreturn_extinctionis True. For each mode (aerosol_accum,aerosol_coarse):{mode}_extinction_per_m: truth extinction [m⁻¹], shape (wavelength, altitude), attruth_wavelengths_nm;{mode}_reference_extinction_per_m: extinction at 745 nm [m⁻¹], shape (altitude,);{mode}_median_radius_nm: clipped median radius [nm], shape (altitude,);
plus
extinction_wavelength_nm. The reference extinction and median radius are exactly the arguments used to build that mode’sExtinctionScatterer, so it can be rebuilt from them withget_mode_mie_database().
Notes¶
Median radii are clipped to the Mie database range (10–590 nm), and extinction is set to zero where the radius is below 10 nm.