am¶
Submodules¶
Exceptions¶
Base exception for am errors. |
Classes¶
Error during model computation. |
|
Error parsing an .amc configuration file. |
|
Run an am model over a grid of parameter values. |
|
An am atmospheric model loaded from an |
Package Contents¶
- exception am.AmError¶
Base exception for am errors.
- class am.ComputeError¶
Error during model computation.
- class am.ConfigError¶
Error parsing an .amc configuration file.
- class am.ModelGrid(path: pathlib.Path, params: xarray.Dataset, args_fn: Callable[Ellipsis, list[str]], max_workers: int | None = None)¶
Run an am model over a grid of parameter values.
Parameters¶
- path:
Path to the
.amctemplate file.- params:
xarray Dataset defining the parameter space. Two forms are supported:
Regular (Cartesian) grid — coordinates on independent dimensions:
xr.Dataset(coords={"elevation": [30, 45, 60], "pwv": [0.5, 1.0, 2.0]})
Irregular grid — variables sharing one dimension:
xr.Dataset({"elevation": ("profile", elev), "pwv": ("profile", pwv)})
- args_fn:
Callable that maps parameter values to an am args list. Keyword argument names must match coordinate/variable names in params:
args_fn=lambda elevation, pwv: [ "0", "GHz", "350", "GHz", "0.5", "GHz", str(elevation), "deg", str(pwv), ]
- max_workers:
Number of worker processes (default:
os.cpu_count()).
- compute() xarray.Dataset¶
Run all models and return an xarray Dataset.
The output Dataset has the same dimensions and coordinates as params, plus a
frequencydimension. Each requested am output (e.g.tb_rj,transmittance) becomes a data variable.
- class am.Model(path, args)¶
An am atmospheric model loaded from an
.amcconfiguration file.Thin wrapper around the Rust
_Modelthat returns xarray Datasets foroutputsandjacobian().Parameters¶
- path:
Path to the
.amcfile.- args:
Positional substitution values for
%1,%2, … placeholders in the config (frequency grid, zenith angle, PWV scale, etc.).
- compute()¶
Run the radiative transfer computation.
- property frequency: numpy.ndarray¶
Frequency grid in GHz.
- property outputs: xarray.Dataset¶
Computed output spectra as an xarray Dataset.
Dimension is
frequency(GHz). Only outputs listed in theoutputdirective of the.amcfile are present. Empty beforecompute()is called.
- property variables: list[str]¶
Names of fit/differentiation variables defined in the config.
- property n_variables: int¶
Number of fit/differentiation variables.
- jacobian() xarray.Dataset¶
Compute Jacobians of all outputs w.r.t. fit variables.
Returns an xarray Dataset with dimensions
(variable, frequency). The.amcconfig must define fit variables (parameters with scales).Raises¶
- ConfigError
If no fit variables are defined in the
.amcconfig.
- summary() str¶
Full resolved model configuration summary.