sasktran2.optical.BaumIceCrystal#
- class sasktran2.optical.BaumIceCrystal(particle_model: Literal['general_habit_mixture', 'aggregate_solid_columns', 'solid_columns'] = 'general_habit_mixture', max_moments: int | None = 256, db_filepath: Path | None = None)[source]#
Bases:
OpticalDatabaseGenericScattererRustBaum V3.6 severely rough ice-crystal optical properties.
This database provides extinction, single-scattering albedo, and the stored polarized phase-matrix expansion for three ice-crystal habit models. The tabulation contains 445 wavelengths from 199 nm to 99,000 nm (0.199 to 99 microns) and 23 effective diameters from 10 to 120 microns in 5-micron increments. Wavelengths supplied to SASKTRAN2 remain in nanometres.
The available
particle_modelvalues are:"general_habit_mixture": the Baum general habit mixture."aggregate_solid_columns": aggregates of solid columns."solid_columns": solid columns.
All three models use the severely rough particle treatment in the Baum V3.6 tables. The large database is capped at 16,384 moments. Some sharply peaked short-wavelength phase matrices do not meet the database-generation reconstruction tolerances at that cap; the NetCDF generation diagnostics mark those cells explicitly.
This optical property is intended for use with
sasktran2.constituent.ExtinctionScatterer. The effective diameter is selected by passingeffective_diameter_umto the constituent; supply one value per point on the constituent altitude grid. Values between tabulated diameters are interpolated by the Rust database backend. The stored extinction cross section is extinction per ice-water content inm^2 g^-1, so an extinction-profile constituent is preferred over treating the table as a per-particle number-density cross section.- Parameters:
particle_model ({"general_habit_mixture", "aggregate_solid_columns", "solid_columns"}, optional) – Ice-crystal habit model to select. By default
"general_habit_mixture".max_moments (int or None, optional) – Maximum number of Greek-coefficient moments to load. Limits up to 256 use the smaller standard-database artifact. Values above 256 select the full database, which is several gigabytes.
Noneselects the full database and loads all 16,384 stored moments, which can also require multiple gigabytes of memory. This value must be at leastsasktran2.Config.num_singlescatter_momentsfor any atmosphere using the property. By default 256.db_filepath (pathlib.Path or None, optional) – Optional local database override. By default the file is obtained from the SASKTRAN2 standard database and cached locally.
- Raises:
TypeError – If
max_momentsis not an integer orNone.ValueError – If the particle model or moment limit is invalid, or when a requested effective diameter is outside 10–120 microns.
OSError – If the database cannot be resolved or opened.
Examples
Construct an extinction-profile ice cloud with a 40-micron effective diameter:
>>> import numpy as np >>> import sasktran2 as sk >>> altitudes_m = np.arange(0.0, 20001.0, 1000.0) >>> extinction_per_m = np.full_like(altitudes_m, 1.0e-5) >>> effective_diameter_um = np.full_like(altitudes_m, 40.0) >>> ice_optical_property = sk.optical.BaumIceCrystal( ... particle_model="general_habit_mixture", ... max_moments=256, ... ) >>> ice_cloud = sk.constituent.ExtinctionScatterer( ... ice_optical_property, ... altitudes_m, ... extinction_per_m, ... extinction_wavelength_nm=550.0, ... effective_diameter_um=effective_diameter_um, ... )
A purely scattering optical property defined by a database file. The database must contain the following
xs_total : The total cross section in [m^2]
xs_scattering : The scattering cross section in [m^2]
lm_a1 : the legendre coefficients for the phase function
All variables must be a function of either wavelength_nm or wavenumber_cminv, and optionally any other dimension such as particle size.
This differs from OpticalDatabaseGenericScatterer in that it uses the Rust backend for the interpolation, other than that the two classes are identical.
- Parameters:
db_filepath (Path, optional) – Path to the database file
db (xr.Dataset, optional) – An already opened database. This is useful when a caller needs to select a subset of a larger database before constructing the Rust interpolator.
- __init__(particle_model: Literal['general_habit_mixture', 'aggregate_solid_columns', 'solid_columns'] = 'general_habit_mixture', max_moments: int | None = 256, db_filepath: Path | None = None) None[source]#
A purely scattering optical property defined by a database file. The database must contain the following
xs_total : The total cross section in [m^2]
xs_scattering : The scattering cross section in [m^2]
lm_a1 : the legendre coefficients for the phase function
All variables must be a function of either wavelength_nm or wavenumber_cminv, and optionally any other dimension such as particle size.
This differs from OpticalDatabaseGenericScatterer in that it uses the Rust backend for the interpolation, other than that the two classes are identical.
- Parameters:
db_filepath (Path, optional) – Path to the database file
db (xr.Dataset, optional) – An already opened database. This is useful when a caller needs to select a subset of a larger database before constructing the Rust interpolator.
Methods
__init__([particle_model, max_moments, ...])A purely scattering optical property defined by a database file.
atmosphere_quantities(atmo, **kwargs)cross_section_derivatives(wavelengths_nm, ...)cross_sections(wavelengths_nm, altitudes_m, ...)optical_derivatives(atmo, **kwargs)Attributes
Moments stored in the selected standard or local database file.
Number of Greek-coefficient moments loaded into the Rust backend.
Selected ice-crystal habit model.