#include <cmath>
#include <stdexcept>
#include "auto_md.h"
#include "check_input.h"
#include "logic.h"
#include "math_funcs.h"
#include "physics_funcs.h"
#include "ppath.h"
#include "rte.h"
#include "special_interp.h"
#include "lin_alg.h"
Go to the source code of this file.
Functions | |
void | apply_y_unit (MatrixView iy, const String &y_unit, const Vector &f_grid) |
apply_y_unit | |
void | apply_y_unit_single (Vector &i, const String &y_unit, const Numeric &f) |
apply_y_unit_single | |
void | get_radiative_background (Workspace &ws, Matrix &iy, Ppath &ppath, Index &ppath_array_index, ArrayOfPpath &ppath_array, ArrayOfTensor4 &diy_dvmr, ArrayOfTensor4 &diy_dt, const Agenda &ppath_step_agenda, const Agenda &rte_agenda, const Agenda &surface_prop_agenda, const Agenda &iy_space_agenda, const Agenda &iy_cloudbox_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Matrix &r_geoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &f_grid, const Index &stokes_dim, const Index &ppath_array_do, const ArrayOfIndex &rte_do_vmr_jacs, const Index &rte_do_t_jacs) |
get_radiative_background | |
void | include_cumtrans_in_diy_dq (Tensor4 &diy_dq, Matrix &trans, const Index &iv, const bool &any_trans_polarised, const Tensor3 &ppath_transmissions) |
include_cumtrans_in_diy_dq | |
void | include_trans_in_diy_dq (ArrayOfTensor4 &diy_dq, const Index &iv, bool pol_trans, ConstMatrixView trans, const ArrayOfPpath &ppath_array, const Index &ppath_array_index) |
include_trans_in_diy_dq | |
void | iy_calc (Workspace &ws, Matrix &iy, Ppath &ppath, Index &ppath_array_index, ArrayOfPpath &ppath_array, ArrayOfTensor4 &diy_dvmr, ArrayOfTensor4 &diy_dt, const Agenda &ppath_step_agenda, const Agenda &rte_agenda, const Agenda &iy_space_agenda, const Agenda &surface_prop_agenda, const Agenda &iy_cloudbox_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Matrix &r_geoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &pos, const Vector &los, const Vector &f_grid, const Index &stokes_dim, const Index &ppath_array_do, const ArrayOfIndex &rte_do_vmr_jacs, const Index &rte_do_t_jacs) |
iy_calc | |
void | iy_calc_no_jacobian (Workspace &ws, Matrix &iy, Ppath &ppath, const Agenda &ppath_step_agenda, const Agenda &rte_agenda, const Agenda &iy_space_agenda, const Agenda &surface_prop_agenda, const Agenda &iy_cloudbox_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Matrix &r_geoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &pos, const Vector &los, const Vector &f_grid, const Index &stokes_dim) |
iy_calc_no_jacobian | |
void | rte_step_std (VectorView stokes_vec, MatrixView trans_mat, ConstMatrixView ext_mat_av, ConstVectorView abs_vec_av, ConstVectorView sca_vec_av, const Numeric &l_step, const Numeric &rte_planck_value) |
rte_step_std | |
void | rte_step_std_clearsky (VectorView stokes_vec, MatrixView trans_mat, const Vector &absorption, const Numeric &l_step, const Numeric &emission) |
rte_step_std_clearsky | |
void | rte_std (Workspace &ws, Matrix &iy, Tensor4 &ppath_transmissions, ArrayOfTensor4 &diy_dvmr, ArrayOfTensor4 &diy_dt, const Ppath &ppath, const ArrayOfPpath &ppath_array, const Index &ppath_array_index, const Vector &f_grid, const Index &stokes_dim, const Agenda &emission_agenda, const Agenda &abs_scalar_gas_agenda, const ArrayOfIndex &rte_do_vmr_jacs, const Index &rte_do_t_jacs, const bool &do_transmissions) |
rte_std | |
void | rtecalc_check_input (Index &nf, Index &nmblock, Index &nza, Index &naa, Index &nblock, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Matrix &r_geoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Sparse &sensor_response, const Matrix &sensor_pos, const Matrix &sensor_los, const Vector &f_grid, const Index &stokes_dim, const Index &antenna_dim, const Vector &mblock_za_grid, const Vector &mblock_aa_grid, const String &y_unit, const String &jacobian_unit) |
rtecalc_check_input | |
void | surface_calc (Matrix &iy, const Tensor3 &I, const Matrix &surface_los, const Tensor4 &surface_rmatrix, const Matrix &surface_emission) |
surface_calc |
Definition in file rte.cc.
void apply_y_unit | ( | MatrixView | iy, | |
const String & | y_unit, | |||
const Vector & | f_grid | |||
) |
apply_y_unit
Performs conversion from radiance to other units, following the keyword argument *y_unit* used in the set of RteCalc functions.
iy | In/Out: Matrix with data to be converted, where each row corresponds to a frequency. | |
y_unit | As the keyword argument for *RteCalc*. | |
f_grid | Frequency grid. |
Definition at line 72 of file rte.cc.
References invplanck(), invrayjean(), ConstMatrixView::ncols(), ConstVectorView::nelem(), and ConstMatrixView::nrows().
Referenced by apply_y_unit_single(), and RteCalc().
apply_y_unit_single
A version of apply_y_unit handle monochormatic input. Just an interface to apply_y_unit
i | In/Out: Vector with data to be converted, where each position corresponds to a Stokes dimension. | |
y_unit | As the keyword argument for *RteCalc*. | |
f | Frequency value. |
Definition at line 130 of file rte.cc.
References apply_y_unit(), joker, and ConstVectorView::nelem().
void get_radiative_background | ( | Workspace & | ws, | |
Matrix & | iy, | |||
Ppath & | ppath, | |||
Index & | ppath_array_index, | |||
ArrayOfPpath & | ppath_array, | |||
ArrayOfTensor4 & | diy_dvmr, | |||
ArrayOfTensor4 & | diy_dt, | |||
const Agenda & | ppath_step_agenda, | |||
const Agenda & | rte_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | iy_cloudbox_agenda, | |||
const Index & | atmosphere_dim, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Index & | cloudbox_on, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Vector & | f_grid, | |||
const Index & | stokes_dim, | |||
const Index & | ppath_array_do, | |||
const ArrayOfIndex & | rte_do_vmr_jacs, | |||
const Index & | rte_do_t_jacs | |||
) |
get_radiative_background
Sets *iy* to the radiative background for a propagation path.
The function uses *ppath* to determine the radiative background for a propagation path and calls the relevant agenda. Coding of backgrounds is described in the header of the function ppath_set_background (in ppath.cc).
The main purpose of the function is set *iy*. It is NOT needed to set iy* to the correct size before calling the function.
[in,out] | ws | Current workspace |
[out] | iy | |
[out] | ppath | |
[out] | ppath_array_index | |
[out] | ppath_array | |
[out] | diy_dvmr | |
[out] | diy_dt | |
[in] | ppath_step_agenda | |
[in] | rte_agenda | |
[in] | surface_prop_agenda | |
[in] | iy_space_agenda | |
[in] | iy_cloudbox_agenda | |
[in] | atmosphere_dim | |
[in] | p_grid | |
[in] | lat_grid | |
[in] | lon_grid | |
[in] | z_field | |
[in] | t_field | |
[in] | vmr_field | |
[in] | r_geoid | |
[in] | z_surface | |
[in] | cloudbox_on | |
[in] | cloudbox_limits | |
[in] | f_grid | |
[in] | stokes_dim | |
[in] | ppath_array_do | |
[in] | rte_do_vmr_jacs | |
[in] | rte_do_t_jacs |
Definition at line 193 of file rte.cc.
References Ppath::background, chk_not_empty(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos_copy(), include_trans_in_diy_dq(), iy_calc(), iy_cloudbox_agendaExecute(), iy_space_agendaExecute(), joker, Ppath::los, ConstTensor4View::nbooks(), ConstTensor4View::ncols(), ConstMatrixView::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), Ppath::np, ConstTensor4View::npages(), ConstMatrixView::nrows(), out1, out3, Ppath::pos, ppath_copy(), ppath_init_structure(), ppath_what_background(), Vector::resize(), surface_calc(), and surface_prop_agendaExecute().
Referenced by iy_calc().
void include_cumtrans_in_diy_dq | ( | Tensor4 & | diy_dq, | |
Matrix & | trans, | |||
const Index & | iv, | |||
const bool & | any_trans_polarised, | |||
const Tensor3 & | ppath_transmissions | |||
) |
include_cumtrans_in_diy_dq
Multiplicates a diy-variable with the transmission to the path's end, on the same time as the total transmission is calculated.
The function handles only a single frequency.
diy_dq | Input/Output: Corresponds to diy_vmr or diy_dt. | |
trans | Output: The complete transmission of considered path. | |
iv | Input: Frequency index. | |
any_trans_polarised | Input: Boolean to indicate if any transmission matrix in *ppath_transmission* gives any polarisation effect. If set to false, diagonal matrices are assumed. | |
ppath_transmission | Input: As the WSV |
Definition at line 455 of file rte.cc.
References id_mat(), joker, mult(), ConstTensor4View::nbooks(), ConstTensor4View::ncols(), and ConstTensor4View::npages().
Referenced by rte_std().
void include_trans_in_diy_dq | ( | ArrayOfTensor4 & | diy_dq, | |
const Index & | iv, | |||
bool | pol_trans, | |||
ConstMatrixView | trans, | |||
const ArrayOfPpath & | ppath_array, | |||
const Index & | ppath_array_index | |||
) |
include_trans_in_diy_dq
Multiplicates a diy-variable with a transmission matrix.
The transmission is included for the propagation path part indicated by ppath_array_index*, and backwards from this ppath part.
The function handles only a single frequency.
diy_dq | Input/Output: Corresponds to diy_vmr or diy_dt. | |
iv | Input: Frequency index. | |
pol_trans | Input: Boolean to indicate if *trans* gives any polarisation effect. If set to false, a diagonal *trans* is assumed. | |
trans | Input: A transmission, or reflection, matrix. | |
ppath_array | Input: As the WSV | |
ppath_array_index | Input: As the WSV |
Definition at line 526 of file rte.cc.
References include_trans_in_diy_dq(), joker, mult(), and Array< base >::nelem().
Referenced by get_radiative_background(), include_trans_in_diy_dq(), and rte_std().
void iy_calc | ( | Workspace & | ws, | |
Matrix & | iy, | |||
Ppath & | ppath, | |||
Index & | ppath_array_index, | |||
ArrayOfPpath & | ppath_array, | |||
ArrayOfTensor4 & | diy_dvmr, | |||
ArrayOfTensor4 & | diy_dt, | |||
const Agenda & | ppath_step_agenda, | |||
const Agenda & | rte_agenda, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Agenda & | iy_cloudbox_agenda, | |||
const Index & | atmosphere_dim, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Index & | cloudbox_on, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Vector & | pos, | |||
const Vector & | los, | |||
const Vector & | f_grid, | |||
const Index & | stokes_dim, | |||
const Index & | ppath_array_do, | |||
const ArrayOfIndex & | rte_do_vmr_jacs, | |||
const Index & | rte_do_t_jacs | |||
) |
iy_calc
Solves the monochromatic pencil beam RTE.
The function performs three basic tasks:
1. Determines the propagation path (by call of ppath_calc).
2. Determines the radiative background.
3. Executes *rte_agenda*.
The start position and LOS shall be put into *los* and *pos* (and not *rte_pos* and *rte_los*).
It is NOT needed to set *iy* to the correct size before calling the function.
[in,out] | ws | Current Workspace |
[out] | iy | |
[out] | ppath | |
[out] | ppath_array_index | |
[out] | ppath_array | |
[out] | diy_dvmr | |
[out] | diy_dt | |
[in] | ppath_step_agenda | |
[in] | rte_agenda | |
[in] | surface_prop_agenda | |
[in] | iy_space_agenda | |
[in] | iy_cloudbox_agenda | |
[in] | atmosphere_dim | |
[in] | p_grid | |
[in] | lat_grid | |
[in] | lon_grid | |
[in] | z_field | |
[in] | t_field | |
[in] | vmr_field | |
[in] | r_geoid | |
[in] | z_surface | |
[in] | cloudbox_on | |
[in] | cloudbox_limits | |
[in] | pos | |
[in] | los | |
[in] | f_grid | |
[in] | stokes_dim | |
[in] | ppath_array_do | |
[in] | rte_do_vmr_jacs | |
[in] | rte_do_t_jacs |
Definition at line 622 of file rte.cc.
References get_radiative_background(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, interp_atmfield_by_itw(), interp_atmfield_gp2itw(), interpweights(), itw2p(), joker, ConstTensor4View::nbooks(), ConstVectorView::nelem(), Array< base >::nelem(), Ppath::np, ns, Ppath::p, ppath_calc(), Matrix::resize(), Vector::resize(), rte_agendaExecute(), Ppath::t, and Ppath::vmr.
Referenced by get_radiative_background(), iy_calc_no_jacobian(), and RteCalc().
void iy_calc_no_jacobian | ( | Workspace & | ws, | |
Matrix & | iy, | |||
Ppath & | ppath, | |||
const Agenda & | ppath_step_agenda, | |||
const Agenda & | rte_agenda, | |||
const Agenda & | iy_space_agenda, | |||
const Agenda & | surface_prop_agenda, | |||
const Agenda & | iy_cloudbox_agenda, | |||
const Index & | atmosphere_dim, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Tensor3 & | t_field, | |||
const Tensor4 & | vmr_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Index & | cloudbox_on, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Vector & | pos, | |||
const Vector & | los, | |||
const Vector & | f_grid, | |||
const Index & | stokes_dim | |||
) |
iy_calc_no_jacobian
Interface to *iy_calc* where jacobian variables can be left out.
Definition at line 753 of file rte.cc.
References iy_calc().
Referenced by Cloudbox_ppath_rteCalc(), CloudboxGetIncoming(), CloudboxGetIncoming1DAtm(), and montecarloGetIncoming().
void rte_std | ( | Workspace & | ws, | |
Matrix & | iy, | |||
Tensor4 & | ppath_transmissions, | |||
ArrayOfTensor4 & | diy_dvmr, | |||
ArrayOfTensor4 & | diy_dt, | |||
const Ppath & | ppath, | |||
const ArrayOfPpath & | ppath_array, | |||
const Index & | ppath_array_index, | |||
const Vector & | f_grid, | |||
const Index & | stokes_dim, | |||
const Agenda & | emission_agenda, | |||
const Agenda & | abs_scalar_gas_agenda, | |||
const ArrayOfIndex & | rte_do_vmr_jacs, | |||
const Index & | rte_do_t_jacs, | |||
const bool & | do_transmissions | |||
) |
rte_std
Core function for the different versions of WSM RteStd.
See the the online help (arts -d RteStd)
[in,out] | ws | Current Workspace |
[out] | iy | |
[out] | ppath_transmissions | |
[out] | diy_dvmr | |
[out] | diy_dt | |
[in] | ppath | |
[in] | ppath_array | |
[in] | ppath_array_index | |
[in] | f_grid | |
[in] | stokes_dim | |
[in] | emission_agenda | |
[in] | abs_scalar_gas_agenda | |
[in] | rte_do_vmr_jacs | |
[in] | rte_do_t_jacs | |
[in] | do_transmissions | Boolean to fill *ppath_transmissions* or not. |
Definition at line 1069 of file rte.cc.
References abs_scalar_gas_agendaExecute(), emission_agendaExecute(), include_cumtrans_in_diy_dq(), include_trans_in_diy_dq(), joker, Ppath::l_step, Array< base >::nelem(), ConstVectorView::nelem(), Ppath::np, ConstMatrixView::nrows(), ns, Ppath::p, Tensor4::resize(), rte_step_std_clearsky(), Ppath::t, transform(), and Ppath::vmr.
Referenced by RteStd(), and RteStdWithTransmissions().
void rte_step_std | ( | VectorView | stokes_vec, | |
MatrixView | trans_mat, | |||
ConstMatrixView | ext_mat_av, | |||
ConstVectorView | abs_vec_av, | |||
ConstVectorView | sca_vec_av, | |||
const Numeric & | l_step, | |||
const Numeric & | rte_planck_value | |||
) |
rte_step_std
Solves monochromatic VRTE for an atmospheric slab with constant conditions.
The function can be used for clearsky and cloudbox calculations.
The function is best explained by considering a homogenous layer. That is, the physical conditions inside the layer are constant. In reality they are not constant, so in practical all coefficients have to be averaged before calling this function. Total extinction and absorption inside the layer are described by ext_mat_av* and *abs_vec_av* respectively, the blackbdody radiation of the layer is given by *rte_planck_value* and the propagation path length through the layer is *l_step*.
There is an additional scattering source term in the VRTE, the scattering integral term. For this function a constant scattering term is assumed. The radiative transfer step is only a part the iterative solution of the scattering problem, for more information consider AUG. In the clearsky case this variable has to be set to 0.
When calling the function, the vector *stokes_vec* shall contain the Stokes vector for the incoming radiation. The function returns this vector, then containing the outgoing radiation on the other side of the layer.
The function performs the calculations differently depending on the conditions to improve the speed. There are three cases:
1. Scalar absorption (stokes_dim = 1).
2. The matrix ext_mat_gas is diagonal (unpolarised absorption).
3. The total general case.
stokes_vec | Input/Output: A Stokes vector. | |
trans_mat | Input/Output: Transmission matrix of slab. | |
ext_mat_av | Input: Averaged extinction matrix. | |
abs_vec_av | Input: Averaged absorption vector. | |
sca_vec_av | Input: averaged scattering vector. | |
l_step | Input: The length of the RTE step. | |
rte_planck_value | Input: Blackbody radiation. |
Definition at line 843 of file rte.cc.
References id_mat(), is_diagonal(), is_singular(), is_size(), lubacksub(), ludcmp(), matrix_exp(), mult(), ConstVectorView::nelem(), and q.
Referenced by cloud_ppath_update1D_planeparallel(), and cloud_RT_no_background().
void rte_step_std_clearsky | ( | VectorView | stokes_vec, | |
MatrixView | trans_mat, | |||
const Vector & | absorption, | |||
const Numeric & | l_step, | |||
const Numeric & | emission | |||
) |
rte_step_std_clearsky
Solves monochromatic clear sky VRTE for an atmospheric slab with constant temperature and absorption.
stokes_vec | Input/Output: A Stokes vector. | |
trans_mat | Input/Output: Transmission matrix of slab. | |
absorption | Input: Gas absorption for each species. | |
l_step | Input: The length of the RTE step. | |
emission | Input: Blackbody radiation. |
Definition at line 990 of file rte.cc.
References is_size(), ConstVectorView::nelem(), and ConstVectorView::sum().
Referenced by rte_std().
void rtecalc_check_input | ( | Index & | nf, | |
Index & | nmblock, | |||
Index & | nza, | |||
Index & | naa, | |||
Index & | nblock, | |||
const Index & | atmosphere_dim, | |||
const Vector & | p_grid, | |||
const Vector & | lat_grid, | |||
const Vector & | lon_grid, | |||
const Tensor3 & | z_field, | |||
const Tensor3 & | t_field, | |||
const Matrix & | r_geoid, | |||
const Matrix & | z_surface, | |||
const Index & | cloudbox_on, | |||
const ArrayOfIndex & | cloudbox_limits, | |||
const Sparse & | sensor_response, | |||
const Matrix & | sensor_pos, | |||
const Matrix & | sensor_los, | |||
const Vector & | f_grid, | |||
const Index & | stokes_dim, | |||
const Index & | antenna_dim, | |||
const Vector & | mblock_za_grid, | |||
const Vector & | mblock_aa_grid, | |||
const String & | y_unit, | |||
const String & | jacobian_unit | |||
) |
rtecalc_check_input
Common sub-function for RteCalc functions to check consistency of input.
[out] | nf | Number of frequencies in f_grid. |
[out] | nmblock | Number of measurement blocks. |
[out] | nza | Number of zenith angles / measurement block. |
[out] | naa | Number of azimuth angles / measurement block. |
[out] | nblock | Length of for one measurement block. |
[in] | atmosphere_dim | |
[in] | p_grid | |
[in] | lat_grid | |
[in] | lon_grid | |
[in] | z_field | |
[in] | t_field | |
[in] | r_geoid | |
[in] | z_surface | |
[in] | cloudbox_on | |
[in] | cloudbox_limits | |
[in] | sensor_response | |
[in] | sensor_pos | |
[in] | sensor_los | |
[in] | f_grid | |
[in] | stokes_dim | |
[in] | antenna_dim | |
[in] | mblock_za_grid | |
[in] | mblock_aa_grid | |
[in] | y_unit | |
[in] | jacobian_unit |
Definition at line 1302 of file rte.cc.
References chk_atm_field(), chk_atm_grids(), chk_atm_surface(), chk_cloudbox(), chk_if_in_range(), chk_if_increasing(), joker, Sparse::ncols(), ConstMatrixView::ncols(), ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), Sparse::nrows(), and ConstMatrixView::nrows().
Referenced by RteCalc(), and RteCalcMC().
void surface_calc | ( | Matrix & | iy, | |
const Tensor3 & | I, | |||
const Matrix & | surface_los, | |||
const Tensor4 & | surface_rmatrix, | |||
const Matrix & | surface_emission | |||
) |
surface_calc
Weights together downwelling radiation and surface emission.
iy* must have correct size when function is called.
iy | In/Out: Radiation matrix, amtching the WSV with the same name. | |
I | Input: Downwelling radiation, with dimensions matching: (surface_los, f_grid, sokes_dim) | |
surface_los | Input: As the WSV with the same name. | |
surface_rmatrix | Input: As the WSV with the same name. | |
surface_emission | Input: As the WSV with the same name. |
Definition at line 1504 of file rte.cc.
References joker, mult(), ConstTensor3View::ncols(), ConstMatrixView::nrows(), and ConstTensor3View::nrows().
Referenced by get_radiative_background().