cesm_hawc.save_inputs¶
Save WACCM columns as simulator-ready NetCDF files.
The files can drive hawcsimulator directly, with native sasktran2
calls and no cesm_hawc import; the documentation’s “Using saved inputs”
page has a complete example.
save_column_inputs¶
def save_column_inputs(
waccm,
lat: float,
lon: float,
output_path: str,
time_index: int,
alt_m: np.ndarray,
wavelengths_nm=None,
profiles_only: bool = False,
obs_time=None,
extra_attrs: dict | None = None,
) -> NoneExtract one WACCM column and save it as a simulator-ready file.
Parameters¶
waccm(cesm_hawc.waccm.WACCMAtmosphere) — The opened history file.lat,lon(float) — Column location [degrees].output_path(str) — NetCDF file to write.time_index(int) — Time slice within the history file.alt_m(numpy.ndarray) — Altitude grid [m]; must matchwaccm.alt_grid_m.wavelengths_nm(array-like, optional) — Wavelengths [nm] for the truth extinction, when constituents are saved. Default[745.0].profiles_only(bool, optional) — Save only the WACCM profiles, even ifsasktran2is installed. Default False.obs_time(optional) — Observation time (e.g. apandas.Timestamp), saved as thetimeattribute. Not saved if omitted.extra_attrs(dict, optional) — Further global attributes, e.g.observer_latitude,observer_longitudeandobserver_altitude.
Notes¶
The file always holds the profiles from
get_column_profiles() on the
altitude_m dimension. When sasktran2 is installed and
profiles_only is False, it also holds, for each mode
(aerosol_accum, aerosol_coarse):
{mode}_extinction_per_m(wavelength_nm,altitude_m): truth extinction [m⁻¹];{mode}_reference_extinction_per_m(altitude_m): extinction at 745 nm [m⁻¹];{mode}_median_radius_nm(altitude_m): clipped median radius [nm];
plus the attributes needed to rebuild the Mie databases:
extinction_reference_wavelength_nm, mode_width_accum,
mode_width_coarse, mie_refractive_index,
mie_wavelength_grid_nm and mie_median_radius_grid_nm. The
includes_constituents attribute (0 or 1) records which kind of file
it is.