crt1d.model
#
This module contains the model class Model
, which can be used to
conveniently solve CRT problems using different solvers with minimal boilerplate code needed.
(At least that is the goal.)
This module also contains functions that operate on the model state,
most of which are also attached as class methods.
Functions that operate on xr.Dataset
s
created by Model.to_xr()
are in diagnostics
.
Module Contents#
Classes#
A general class for testing 1-D canopy radiative transfer schemes. |
Functions#
|
For model m, run multiple cases. |
- class crt1d.model.Model(scheme='2s', nlayers=60, **p_kwargs)#
A general class for testing 1-D canopy radiative transfer schemes.
Create a model instance based on the default setup.
- Parameters:
scheme (
str
) – Identifier for the desired canopy radiative transfer scheme.psi (
float
) – Solar zenith angle (radians).nlayers (
int
) – Number of in-canopy layers to use in the solver (interface levels).**p_kwargs – Model parameter keyword arguments passed on to
update_p()
.
- property cd#
Canopy description.
- property out_all#
Standard and extra outputs.
- property p#
Model parameters are indended to be read only (updated with
update_p()
). Invoking this just prints a message.
- out#
Scheme standard outputs.
- out_extra#
Scheme extra outputs, such as absorption. Only some schemes provide any.
- p_default#
Default parameter settings dict.
- required_input_keys#
Required model inputs.
- assign_scheme(scheme_name, *, verbose=False)#
Using the
AVAILABLE_SCHEMES
dict, assign scheme and necessary scheme attrs.
- calc_absorption()#
Calculate layerwise absorption variables.
- copy_p()#
Return a copy of the parameters dict.
- plot_canopy()#
Plot LAI and LAD profiles.
- plot_leafsoil_spectra()#
Plot the leaf and soil optical properties spectra used by the model.
- plot_toc_spectra()#
Plot the toc (top-of-canopy) irradiance spectra used for the upper boundary condition.
- print_p()#
Pretty print the parameters.
- run(**extra_solver_kwargs)#
TODO: could add verbose option
- to_xr(*, info='')#
Construct and return an
xarray.Dataset
.- Parameters:
info (
str
) – Extra information about the run/model to be stored in the dataset.
- update_p(**kwargs)#
Update parameters, if the validation passes.
- Parameters:
**kwargs – Used to update the model parameters.
- update_spectra(ds)#
Update irradiance and leaf/soil optical property spectra from
xarray.Dataset
ds.
- crt1d.model.run_sensitivity(m0, p_sets)#
For model m, run multiple cases. Vary one or more attributes and create combined dataset.
- m0model object
base case to branch off of
- p_setsdict
keys: param to change; values: list of values for the param
- Returns:
xarray.Dataset
– With a new dimension for each key in p_sets