crt1d.model =========== .. py:module:: crt1d.model .. autoapi-nested-parse:: This module contains the model class :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 :class:`xr.Dataset` s created by :meth:`Model.to_xr` are in :mod:`.diagnostics`. Classes ------- .. autoapisummary:: crt1d.model.Model Functions --------- .. autoapisummary:: crt1d.model.run_sensitivity Module Contents --------------- .. py:class:: 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. :param scheme: Identifier for the desired canopy radiative transfer scheme. :type scheme: :class:`str` :param psi: Solar zenith angle (radians). :type psi: :class:`float` :param nlayers: Number of in-canopy layers to use in the solver (interface levels). :type nlayers: :class:`int` :param \*\*p_kwargs: Model parameter keyword arguments passed on to :meth:`update_p()`. .. py:method:: assign_scheme(scheme_name, *, verbose=False) Using the :const:`~crt1d.solvers.AVAILABLE_SCHEMES` dict, assign scheme and necessary scheme attrs. .. py:method:: calc_absorption() Calculate layerwise absorption variables. .. py:method:: copy_p() Return a copy of the parameters dict. .. py:method:: plot_canopy() Plot LAI and LAD profiles. .. py:method:: plot_leafsoil_spectra() Plot the leaf and soil optical properties spectra used by the model. .. py:method:: plot_toc_spectra() Plot the toc (top-of-canopy) irradiance spectra used for the upper boundary condition. .. py:method:: print_p() Pretty print the parameters. .. py:method:: run(**extra_solver_kwargs) TODO: could add verbose option .. py:method:: to_xr(*, info='') Construct and return an :class:`xarray.Dataset`. :param info: Extra information about the run/model to be stored in the dataset. :type info: :class:`str` .. py:method:: update_p(**kwargs) Update parameters, if the validation passes. :param `**kwargs`: Used to update the model parameters. .. py:method:: update_spectra(ds) Update irradiance and leaf/soil optical property spectra from :class:`xarray.Dataset` `ds`. .. py:attribute:: absorption :value: None Absorption outputs calculated from the standard outputs :attr:`out`. .. py:property:: cd Canopy description. .. py:attribute:: out Scheme standard outputs. .. py:property:: out_all Standard and extra outputs. .. py:attribute:: out_extra Scheme extra outputs, such as absorption. Only some schemes provide any. .. py:property:: p Model parameters are indended to be read only (updated with :meth:`update_p`). Invoking this just prints a message. .. py:attribute:: p_default Default parameter settings dict. .. py:attribute:: required_input_keys Required model inputs. .. py:function:: run_sensitivity(m0, p_sets) For model m, run multiple cases. Vary one or more attributes and create combined dataset. m0 : model object base case to branch off of p_sets : dict keys: param to change; values: list of values for the param :returns: :class:`xarray.Dataset` -- With a new dimension for each key in `p_sets`