crt1d.diagnostics
#
Calculations/plots using the CRT solutions (irradiance spectral profiles),
using the model output dataset created by crt1d.Model.to_xr()
.
Module Contents#
Functions#
|
Reduce spectral variables in ds by summing in-band irradiances |
|
For dsets, assess energy balance closure by comparing |
|
Multi-panel plot to compare profiles for the specified band for a set of datasets. |
|
Multi-panel plot to compare spectra at each height for a set of datasets. |
- crt1d.diagnostics.band(ds, *, variables=None, band_name='PAR', bounds=None, calc_PFD=False)#
Reduce spectral variables in ds by summing in-band irradiances to give the integrated irradiance in a given spectral band.
bounds does not have to be provided if band_name is one of the known bands. If variables is
None
, we attempt to guess.Optionally, we additionally calculate photon flux density (PFD) variants of the quantities. It is important to do this at this stage (rather than after integrating) due to the non-linear dependence of photon energy on wavelength.
- Returns:
xarray.Dataset
– New dataset with no wavelength dimension, only height.
- crt1d.diagnostics.compare_ebal(dsets, *, band_name='solar', bounds=None)#
For dsets, assess energy balance closure by comparing computed canopy and soil absorption to incoming minus outgoing radiation at the top of the canopy.
- Parameters:
dsets (
list
ofxarray.Dataset
) – Created usingto_xr()
.- Returns:
- crt1d.diagnostics.plot_compare_band(dsets, *, band_name='PAR', bounds=None, marker='.', ref=None, ref_label=None, ref_relative=False, ds_labels='scheme_long_name', legend_outside=True)#
Multi-panel plot to compare profiles for the specified band for a set of datasets. bounds does not have to be provided if band_name is one of the known bands.
This uses
band()
to sum irradiances within the band.- Parameters:
dsets (
list
ofxarray.Dataset
) – Created usingcrt1d.Model.to_xr()
.marker (
str
, optional) – Marker to be used when plotting the lines. Pass None to get no markers (this can make it easier to see what’s going on if there are many levels).ref (
str
,xarray.Dataset
, optional) – Dataset to be used as the reference (it will be subtracted from the others in the plot). Ifstr
, the first found withname
ref will be used, sostr
should only be used when comparing disparate schemes, like2s
vs4s
). Default: no reference.ref_label (
str
, optional) – If not provided, a dataset attribute will be used (scheme_short_name
or the one being used for legend labels).ref_relative (
bool
, optional) – Whether to present relative error when using a ref. If false (default), absolute error is presented.ds_labels (
str
orlist
ofstr
, optional) – Ifstr
, must be a dataset attribute (that all in dsets have). Iflist
, should be same length as dsets.legend_outside (
bool
, optional) – Whether to place the legend outside the axes area or within. If outside, it will be placed upper right. If within, it will be placed on top of the lower left ax.
See also
band
Related function that returns a dataset for a given spectral band.
plot_compare_spectra
Similar routine, but plots one spectral variable as function of height and wavelength.
- crt1d.diagnostics.plot_compare_spectra(dsets, which='I_d', *, dwl_relative=True, toc_relative=False, ref=None, ref_label=None, ref_relative=False, ref_plot=False, ds_labels='scheme_short_name', norm=None, plot_type='pcolormesh', shading='auto', hspace=0.025, wspace=0.03)#
Multi-panel plot to compare spectra at each height for a set of datasets.
- Parameters:
dsets (
list
ofxarray.Dataset
) – Created usingcrt1d.Model.to_xr()
.which (
str
) – Which spectrum to compare. Default:"I_d"
(downward irradiance).dwl_relative (
bool
, optional) – Whether to divide by the wavelength band width. Default: true.toc_relative (
bool
, optional) – Whether to divide by the top-of-canopy spectrum.ref (
str
,xarray.Dataset
, optional) – Dataset to be used as the reference (it will be subtracted from the others in the plot). Ifstr
, the first found withname
ref will be used, sostr
should only be used when comparing disparate schemes, like2s
vs4s
). Default: no reference.ref_label (
str
, optional) – If not provided, a dataset attribute will be used (scheme_short_name
or the one being used for legend labels).ref_relative (
bool
, optional) – Whether to present relative error when using a ref. If false (default), absolute error is presented.ref_plot (
bool
, optional) – Whether to plot the reference.ds_labels (
str
orlist
ofstr
, optional) – Ifstr
, must be a dataset attribute (that all in dsets have). Iflist
, should be same length as dsets.norm (
matplotlib.colors.Normalize
, optional) – Used if provided.plot_type (
{"pcolormesh"}
) – Currently only one plot_type is supported.shading (
str
) – For pcolormesh.hspace (
float
) – For the figure gridspec.wspace (
float
) – For the figure gridspec.
See also
plot_compare_band
Similar routine, but integrates over a wave band and plots profiles of multiple variables.