ARTS
2.3.1285(git:92a29ea9-dirty)
|
Routines for setting up the jacobian. More...
#include <iostream>
#include <map>
#include <stdexcept>
#include "abs_species_tags.h"
#include "agenda_class.h"
#include "array.h"
#include "bifstream.h"
#include "interpolation.h"
#include "logic.h"
#include "matpackI.h"
#include "methods.h"
#include "mystring.h"
#include "ppath.h"
#include "quantum.h"
Go to the source code of this file.
Classes | |
class | RetrievalQuantity |
Deals with internal derivatives, Jacobian definition, and OEM calculations. More... | |
struct | jacobianVMRcheck |
Deals with whether or not we should do a VMR derivative. More... | |
Macros | |
#define | FOR_ANALYTICAL_JACOBIANS_DO(what_to_do) |
#define | FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do) |
Typedefs | |
typedef Array< RetrievalQuantity > | ArrayOfRetrievalQuantity |
Functions | |
ostream & | operator<< (ostream &os, const RetrievalQuantity &ot) |
Output operator for RetrievalQuantity. More... | |
void | jac_ranges_indices (ArrayOfArrayOfIndex &jis, bool &any_affine, const ArrayOfRetrievalQuantity &jqs, const bool &before_affine=false) |
Determines the index range inside x and the Jacobian for each retrieval quantity. More... | |
void | transform_jacobian (Matrix &jacobian, const Vector x, const ArrayOfRetrievalQuantity &jqs) |
Applies both functional and affine transformations. More... | |
void | transform_x (Vector &x, const ArrayOfRetrievalQuantity &jqs) |
Handles transformations of the state vector. More... | |
void | transform_x_back (Vector &x_t, const ArrayOfRetrievalQuantity &jqs, bool revert_functional_transforms=true) |
Handles back-transformations of the state vector. More... | |
bool | check_retrieval_grids (ArrayOfVector &grids, ostringstream &os, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &p_retr, const Vector &lat_retr, const Vector &lon_retr, const String &p_retr_name, const String &lat_retr_name, const String &lon_retr_name, const Index &dim) |
Check that the retrieval grids are defined for each atmosphere dim. More... | |
bool | check_retrieval_grids (ArrayOfVector &grids, ostringstream &os, const Vector &lat_grid, const Vector &lon_grid, const Vector &lat_retr, const Vector &lon_retr, const String &lat_retr_name, const String &lon_retr_name, const Index &dim) |
Check that the retrieval grids are defined for each atmosphere dim. More... | |
void | diy_from_path_to_rgrids (Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstTensor3View diy_dpath, const Index &atmosphere_dim, const Ppath &ppath, ConstVectorView ppath_p) |
Maps jacobian data for points along the propagation path, to jacobian retrieval grid data. More... | |
void | diy_from_pos_to_rgrids (Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstMatrixView diy_dpos, const Index &atmosphere_dim, ConstVectorView rtp_pos) |
diy_from_pos_to_rgrids More... | |
void | get_pointers_for_analytical_jacobians (ArrayOfIndex &abs_species_i, ArrayOfIndex &scat_species_i, ArrayOfIndex &is_t, ArrayOfIndex &wind_i, ArrayOfIndex &magfield_i, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &cloudbox_on, const ArrayOfString &scat_species) |
Help function for analytical jacobian calculations. More... | |
void | jacobian_type_extrapol (ArrayOfGridPos &gp) |
Adopts grid positions to extrapolation used for jacobians. More... | |
void | polynomial_basis_func (Vector &b, const Vector &x, const Index &poly_coeff) |
Calculates polynomial basis functions. More... | |
void | calcBaselineFit (Vector &y_baseline, const Vector &x, const Index &mblock_index, const Sparse &sensor_response, const ArrayOfIndex &sensor_response_pol_grid, const Vector &sensor_response_f_grid, const Matrix &sensor_response_dlos_grid, const RetrievalQuantity &rq, const Index rq_index, const ArrayOfArrayOfIndex &jacobian_indices) |
Calculate baseline fit. More... | |
void | vmrunitscf (Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t) |
Scale factor for conversion between gas species units. More... | |
void | dxdvmrscf (Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t) |
Scale factor for conversion of derivatives with respect to VMR. More... | |
void | get_diydx (VectorView diy1, VectorView diy2, ConstMatrixView ImT, ConstMatrixView cumulative_transmission, ConstMatrixView dT1, ConstMatrixView dT2, ConstVectorView iYmJ, ConstVectorView dJ1, ConstVectorView dJ2, const Index stokes_dim, const bool transmission_only=false) |
ArrayOfIndex | equivalent_propmattype_indexes (const ArrayOfRetrievalQuantity &js) |
Returns a list of positions for the derivatives in Propagation Matrix calculations. More... | |
Index | equivalent_propmattype_index (const ArrayOfRetrievalQuantity &js, const Index i) noexcept |
Returns a list of positions for the derivatives in Propagation Matrix calculations. More... | |
Numeric | temperature_perturbation (const ArrayOfRetrievalQuantity &js) noexcept |
Returns the temperature perturbation if it exists. More... | |
Numeric | frequency_perturbation (const ArrayOfRetrievalQuantity &js) noexcept |
Returns the frequency perturbation if it exists. More... | |
Numeric | magnetic_field_perturbation (const ArrayOfRetrievalQuantity &js) noexcept |
Returns the magnetic field perturbation if it exists. More... | |
String | propmattype_string (const RetrievalQuantity &rq) |
Returns a string of the retrieval quantity propagation matrix type. More... | |
bool | is_wind_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a wind parameter. More... | |
bool | is_frequency_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations. More... | |
bool | is_derived_magnetic_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a derived magnetic parameter. More... | |
bool | is_magnetic_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a magnetic parameter. More... | |
bool | is_nlte_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a NLTE parameter. More... | |
bool | is_pressure_broadening_G0 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a G0 derivative. More... | |
bool | is_pressure_broadening_D0 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a D0 derivative. More... | |
bool | is_pressure_broadening_G2 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a G0 derivative. More... | |
bool | is_pressure_broadening_D2 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a D2 derivative. More... | |
bool | is_pressure_broadening_FVC (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a FVC derivative. More... | |
bool | is_pressure_broadening_ETA (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a ETA derivative. More... | |
bool | is_pressure_broadening_Y (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a Y derivative. More... | |
bool | is_pressure_broadening_G (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a G derivative. More... | |
bool | is_pressure_broadening_DV (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a DV derivative. More... | |
bool | is_lineshape_parameter_X0 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a X0 derivative. More... | |
bool | is_lineshape_parameter_X1 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a X1 derivative. More... | |
bool | is_lineshape_parameter_X2 (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a X2 derivative. More... | |
bool | is_lineshape_parameter_bar_linemixing (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC derivative. More... | |
bool | is_lineshape_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC, Y, G, DV derivative. More... | |
bool | is_line_parameter (const RetrievalQuantity &t) noexcept |
Returns if the Retrieval quantity is related to the absorption line. More... | |
bool | supports_CIA (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports CIA derivatives. More... | |
bool | supports_hitran_xsec (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports HITRAN cross-section derivatives. More... | |
bool | supports_continuum (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports continuum derivatives. More... | |
bool | supports_LBL_without_phase (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports line-by-line derivatives without requiring the phase. More... | |
bool | supports_relaxation_matrix (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports relaxation matrix derivatives. More... | |
bool | supports_lookup (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports lookup table derivatives. More... | |
bool | supports_zeeman (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports Zeeman derivatives. More... | |
bool | supports_faraday (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports Faraday derivatives. More... | |
bool | supports_particles (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports particulate derivatives. More... | |
bool | supports_propmat_clearsky (const ArrayOfRetrievalQuantity &js) |
Returns if the array supports propagation matrix derivatives. More... | |
bool | species_match (const RetrievalQuantity &rq, const ArrayOfSpeciesTag &ast) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags. More... | |
bool | species_match (const RetrievalQuantity &rq, const Index species) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags. More... | |
bool | species_iso_match (const RetrievalQuantity &rq, const Index species, const Index iso) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags. More... | |
bool | do_temperature_jacobian (const ArrayOfRetrievalQuantity &js) noexcept |
Returns if the array wants the temperature derivative. More... | |
jacobianVMRcheck | do_vmr_jacobian (const ArrayOfRetrievalQuantity &js, const QuantumIdentifier &line_qid) noexcept |
Returns the required info for VMR Jacobian. More... | |
bool | do_line_center_jacobian (const ArrayOfRetrievalQuantity &js) noexcept |
Returns if the array wants a line center derivative. More... | |
bool | do_frequency_jacobian (const ArrayOfRetrievalQuantity &js) noexcept |
Returns if the array wants a frequency derivative. More... | |
bool | do_magnetic_jacobian (const ArrayOfRetrievalQuantity &js) noexcept |
Returns if the array wants a magnetic derivative. More... | |
#define FOR_ANALYTICAL_JACOBIANS_DO | ( | what_to_do | ) |
Definition at line 405 of file jacobian.h.
Referenced by get_pointers_for_analytical_jacobians(), get_stepwise_scattersky_propmat(), get_stepwise_scattersky_source(), iyActiveSingleScat(), iyActiveSingleScat2(), iyEmissionStandard(), iyEmissionStandardSequential(), iyHybrid(), iyHybrid2(), iyTransmissionStandard(), rtmethods_jacobian_finalisation(), rtmethods_jacobian_init(), and yActive().
#define FOR_ANALYTICAL_JACOBIANS_DO2 | ( | what_to_do | ) |
Definition at line 412 of file jacobian.h.
Referenced by iyb_calc(), iyb_calc_body(), iyEmissionStandard(), iyEmissionStandardSequential(), rtmethods_jacobian_init(), rtmethods_unit_conversion(), yCalc(), and yCalc_mblock_loop_body().
Definition at line 402 of file jacobian.h.
|
strong |
Enum for knowing what Jacobian scheme is in-play in the m_rte.cc methods.
Enumerator | |
---|---|
None | |
Temperature | |
WindFieldU | |
WindFieldV | |
WindFieldW | |
AbsWind | |
MagFieldU | |
MagFieldV | |
MagFieldW | |
AbsMag | |
Other |
Definition at line 747 of file jacobian.h.
|
strong |
List of Jacobian properties for analytical line shape related derivatives.
Definition at line 46 of file jacobian.h.
void calcBaselineFit | ( | Vector & | y_baseline, |
const Vector & | x, | ||
const Index & | mblock_index, | ||
const Sparse & | sensor_response, | ||
const ArrayOfIndex & | sensor_response_pol_grid, | ||
const Vector & | sensor_response_f_grid, | ||
const Matrix & | sensor_response_dlos_grid, | ||
const RetrievalQuantity & | rq, | ||
const Index | rq_index, | ||
const ArrayOfArrayOfIndex & | jacobian_indices | ||
) |
Calculate baseline fit.
Computes the baseline fit from a given state vector.
Given a retrieval quantitiy which is either a polynomial or a sine baseline fit this function computes the baseline offset in y_baseline.
[out] | y_baseline | The computed baseline offset. Computed baseline offset are accumulated into this vector, so it must be initialized externally! |
[in] | x | State vector consisten with given retrieval quantity |
[in] | mblock_index | The index of the measurement block. |
[in] | sensor_response | Must be consistent with size of y_baseline. |
[in] | sensor_response_pol_grid | Must be consistent with size of y_baseline. |
[in] | sensor_response_f_grid | Must be consistent with size of y_baseline. |
[in] | sensor_dlos_grid | Must be consistent with size of y_baseline. |
[in] | rq | The poly- or sinefit retrieval quantity |
[in] | rq_index | The index of the retrieval quantity |
[in] | jacobian_indices |
Definition at line 921 of file jacobian.cc.
References RetrievalQuantity::MainTag(), Array< base >::nelem(), ConstVectorView::nelem(), ConstMatrixView::nrows(), POLYFIT_MAINTAG, SINEFIT_MAINTAG, and w().
bool check_retrieval_grids | ( | ArrayOfVector & | grids, |
ostringstream & | os, | ||
const Vector & | p_grid, | ||
const Vector & | lat_grid, | ||
const Vector & | lon_grid, | ||
const Vector & | p_retr, | ||
const Vector & | lat_retr, | ||
const Vector & | lon_retr, | ||
const String & | p_retr_name, | ||
const String & | lat_retr_name, | ||
const String & | lon_retr_name, | ||
const Index & | dim | ||
) |
Check that the retrieval grids are defined for each atmosphere dim.
Use this version for atmospheric fields.
This function checks for the given atmosphere dimension that I) the retrieval grids are defined II) and that they are covered by the corresponding atmospheric grid. If not the return is false and an output string is created to print the error to the user. If the grids are ok they are stored in an array and true is returned.
[out] | grids | The array of retrieval grids. |
[in,out] | os | The output string stream. |
[in] | p_grid | The atmospheric pressure grid |
[in] | lat_grid | The atmospheric latitude grid |
[in] | lon_grid | The atmospheric longitude grid |
[in] | p_retr | The pressure retrieval grid. |
[in] | lat_retr | The latitude retrieval grid. |
[in] | lon_retr | The longitude retrieval grid. |
[in] | p_retr_name | The control file name used for the pressure retrieval grid. |
[in] | lat_retr_name | The control file name for the latitude retrieval grid. |
[in] | lon_retr_name | The control file name for the longitude retrieval grid. |
[in] | dim | The atmosphere dimension |
Definition at line 690 of file jacobian.cc.
References is_decreasing(), is_increasing(), Array< base >::nelem(), and ConstVectorView::nelem().
Referenced by jacobianAddAbsSpecies(), jacobianAddMagField(), jacobianAddNLTE(), jacobianAddScatSpecies(), jacobianAddSpecialSpecies(), jacobianAddSurfaceQuantity(), jacobianAddTemperature(), and jacobianAddWind().
bool check_retrieval_grids | ( | ArrayOfVector & | grids, |
ostringstream & | os, | ||
const Vector & | lat_grid, | ||
const Vector & | lon_grid, | ||
const Vector & | lat_retr, | ||
const Vector & | lon_retr, | ||
const String & | lat_retr_name, | ||
const String & | lon_retr_name, | ||
const Index & | dim | ||
) |
Check that the retrieval grids are defined for each atmosphere dim.
Use this version for surface variables
This function checks for the given atmosphere dimension that I) the retrieval grids are defined II) and that they are covered by the corresponding atmospheric grid. If not the return is false and an output string is created to print the error to the user. If the grids are ok they are stored in an array and true is returned.
[out] | grids | The array of retrieval grids. |
[in,out] | os | The output string stream. |
[in] | lat_grid | The atmospheric latitude grid |
[in] | lon_grid | The atmospheric longitude grid |
[in] | lat_retr | The latitude retrieval grid. |
[in] | lon_retr | The longitude retrieval grid. |
[in] | lat_retr_name | The control file name for the latitude retrieval grid. |
[in] | lon_retr_name | The control file name for the longitude retrieval grid. |
[in] | dim | The atmosphere dimension |
Definition at line 800 of file jacobian.cc.
References is_increasing(), max, Array< base >::nelem(), and ConstVectorView::nelem().
void diy_from_path_to_rgrids | ( | Tensor3View | diy_dx, |
const RetrievalQuantity & | jacobian_quantity, | ||
ConstTensor3View | diy_dpath, | ||
const Index & | atmosphere_dim, | ||
const Ppath & | ppath, | ||
ConstVectorView | ppath_p | ||
) |
Maps jacobian data for points along the propagation path, to jacobian retrieval grid data.
[out] | diy_dx | One element of the WSV diy_dx. |
[in] | jacobian_quantity | One element of of the WSV jacobian_quantities. |
[in] | diy_dpath | Jacobians along the propagation path. |
[in] | atmosphere_dim | As the WSV. |
[in] | ppath | As the WSV. |
[in] | ppath_p | The pressure at each ppath point. |
Definition at line 337 of file jacobian.cc.
References from_dpath_to_dx(), gp4length1grid(), gridpos(), RetrievalQuantity::Grids(), i, RetrievalQuantity::Integration(), jacobian_type_extrapol(), joker, Array< base >::nelem(), Ppath::np, ConstTensor3View::npages(), p2gridpos(), and Ppath::pos.
Referenced by rtmethods_jacobian_finalisation().
void diy_from_pos_to_rgrids | ( | Tensor3View | diy_dx, |
const RetrievalQuantity & | jacobian_quantity, | ||
ConstMatrixView | diy_dpos, | ||
const Index & | atmosphere_dim, | ||
ConstVectorView | rtp_pos | ||
) |
diy_from_pos_to_rgrids
Maps jacobian data for a surface position, to jacobian retrieval grid data.
[out] | diy_dx | One element of the WSV diy_dx. |
[in] | jacobian_quantity | One element of of the WSV jacobian_quantities. |
[in] | diy_dpos | Jacobian for the position itself. |
[in] | atmosphere_dim | As the WSV. |
[in] | rtp_pos | As the WSV. |
Definition at line 506 of file jacobian.cc.
References from_dpath_to_dx(), gp4length1grid(), gridpos(), RetrievalQuantity::Grids(), jacobian_type_extrapol(), joker, max, Array< base >::nelem(), and ConstVectorView::nelem().
Referenced by iySurfaceRtpropCalc().
|
noexcept |
Returns if the array wants a frequency derivative.
[in] | js | As jacobian_quantities WSV |
Definition at line 1296 of file jacobian.cc.
References is_frequency_parameter().
Referenced by abs_xsec_per_speciesAddCIA(), abs_xsec_per_speciesAddConts(), abs_xsec_per_speciesAddHitranXsec(), propmat_clearskyAddFromLookup(), and propmat_clearskyAddParticles().
|
noexcept |
Returns if the array wants a line center derivative.
[in] | js | As jacobian_quantities WSV |
Definition at line 1292 of file jacobian.cc.
References LineCenter.
|
noexcept |
Returns if the array wants a magnetic derivative.
[in] | js | As jacobian_quantities WSV |
Definition at line 1300 of file jacobian.cc.
References is_magnetic_parameter().
Referenced by propmat_clearskyAddFaraday().
|
noexcept |
Returns if the array wants the temperature derivative.
[in] | js | As jacobian_quantities WSV |
Definition at line 1279 of file jacobian.cc.
References Temperature.
Referenced by abs_xsec_per_speciesAddCIA(), abs_xsec_per_speciesAddConts(), Linefunctions::apply_rosenkranz_quadratic_scaling(), iyEmissionStandard(), iyEmissionStandardSequential(), iyHybrid(), iyHybrid2(), Absorption::PredefinedModel::makarov2020_o2_lines_mpm(), propmat_clearskyAddFromLookup(), propmat_clearskyAddParticles(), and Linefunctions::set_cross_section_of_band().
|
noexcept |
Returns the required info for VMR Jacobian.
[in] | js | As jacobian_quantities WSV |
[in] | line_qid | A line identifier |
Definition at line 1283 of file jacobian.cc.
References VMR.
Referenced by Linefunctions::set_cross_section_of_band().
void dxdvmrscf | ( | Numeric & | x, |
const String & | unit, | ||
const Numeric & | vmr, | ||
const Numeric & | p, | ||
const Numeric & | t | ||
) |
Scale factor for conversion of derivatives with respect to VMR.
The function finds the factor with which a partial derivative with respect to gas species VMR shall be multiplicated to match the selected (jacobian) unit. The function was implemented for scaling of dpropmat_clearsky_dx but it could also be of use in other contexts.
[out] | x | Scale factor |
[in] | unit | Unit selected. |
[in] | vmr | VMR value. |
[in] | p | Pressure |
[in] | t | Temperature. |
Definition at line 1029 of file jacobian.cc.
References number_density(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by adapt_stepwise_partial_derivatives().
|
noexcept |
Returns a list of positions for the derivatives in Propagation Matrix calculations.
[in] | js | As jacobian_quantities WSV |
[in] | i | A position in jacobian_quantities |
Definition at line 1107 of file jacobian.cc.
Referenced by get_stepwise_clearsky_propmat().
ArrayOfIndex equivalent_propmattype_indexes | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns a list of positions for the derivatives in Propagation Matrix calculations.
[in] | js | As jacobian_quantities WSV |
Definition at line 1099 of file jacobian.cc.
References i, Array< base >::nelem(), and NotPropagationMatrixType.
Referenced by abs_coefCalcFromXsec(), abs_xsec_per_speciesAddCIA(), abs_xsec_per_speciesAddConts(), abs_xsec_per_speciesAddHitranXsec(), abs_xsec_per_speciesAddLines(), abs_xsec_per_speciesAddPredefinedO2MPM2020(), abs_xsec_per_speciesInit(), nlte_sourceFromTemperatureAndSrcCoefPerSpecies(), propmat_clearskyAddFaraday(), propmat_clearskyAddFromLookup(), propmat_clearskyAddParticles(), propmat_clearskyInit(), and zeeman_on_the_fly().
|
noexcept |
Returns the frequency perturbation if it exists.
[in] | js | As jacobian_quantities WSV |
Definition at line 1312 of file jacobian.cc.
References is_frequency_parameter().
Referenced by abs_xsec_per_speciesAddCIA(), abs_xsec_per_speciesAddConts(), abs_xsec_per_speciesAddHitranXsec(), and propmat_clearskyAddFromLookup().
void get_diydx | ( | VectorView | diy1, |
VectorView | diy2, | ||
ConstMatrixView | ImT, | ||
ConstMatrixView | cumulative_transmission, | ||
ConstMatrixView | dT1, | ||
ConstMatrixView | dT2, | ||
ConstVectorView | iYmJ, | ||
ConstVectorView | dJ1, | ||
ConstVectorView | dJ2, | ||
const Index | stokes_dim, | ||
const bool | transmission_only = false |
||
) |
FIXMEDOC: Remove this function when iyHybrid2 has become new iyHybrid The function helps to calculate the partial derivative of iy with respect to one input at one pressure. The formalism here assumes that the radiation terms are averaged rather than the absorption parameters, thus this can be solved per layer rather than for two layers at a time. Still, the absorption parameters for the transmission needs to be considered by the two layer derivatives
FIXME: Add HSE support
[in,out] | diy1 | Derivative if iy for level 1 |
[in,out] | diy2 | Derivative if iy for level 2 |
[in] | ImT | Identity matrix minus the transmission matrix |
[in] | cumulative_transmission | Accumulative transmission from level to sensor |
[in] | dT1 | Transmission matrix derivative for level 1 |
[in] | dT2 | Transmission matrix derivative for level 2 |
[in] | iYmJ | iy minus the source |
[in] | dJ1 | Source vector derivative for level 1 |
[in] | dJ2 | Source vector derivative for level 2 |
[in] | stokes_dim | As WSV |
[in] | transmission_only | Bool for not doing emission calculations |
Definition at line 1049 of file jacobian.cc.
References mult().
Referenced by iyHybrid().
void get_pointers_for_analytical_jacobians | ( | ArrayOfIndex & | abs_species_i, |
ArrayOfIndex & | scat_species_i, | ||
ArrayOfIndex & | is_t, | ||
ArrayOfIndex & | wind_i, | ||
ArrayOfIndex & | magfield_i, | ||
const ArrayOfRetrievalQuantity & | jacobian_quantities, | ||
const ArrayOfArrayOfSpeciesTag & | abs_species, | ||
const Index & | cloudbox_on, | ||
const ArrayOfString & | scat_species | ||
) |
Help function for analytical jacobian calculations.
The function determines which terms in jacobian_quantities that are analytical absorption species and temperature jacobians.
abs_species_i* and is_t shall be sized to have the same length as jacobian_quantities. For analytical absorption species jacobians, abs_species_i is set to the matching index in abs_species*. Otherwise, to -1. For analytical temperature jacobians, is_t is set to 1. Otherwise to 0.
[out] | abs_species_i | Matching index in abs_species |
[out] | scat_species_i | Matching index among scattering species |
[out] | is_t | Flag for: Is a temperature jacobian? |
[in] | jacobian_quantities | As the WSV. |
[in] | abs_species | As the WSV. |
[in] | cloudbox_on | As the WSV. |
[in] | scat_species | As the WSV. |
Definition at line 596 of file jacobian.cc.
References array_species_tag_from_string(), chk_contains(), find_first(), FOR_ANALYTICAL_JACOBIANS_DO, Array< base >::nelem(), None, PROPMAT_SUBSUBTAG, SpeciesTag::Species(), Species, _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and Temperature.
Referenced by rtmethods_jacobian_init().
|
noexcept |
Returns if the Retrieval quantity is a derived magnetic parameter.
[in] | t | A retrieval quantity |
Definition at line 1124 of file jacobian.cc.
References MagneticMagnitude.
Referenced by is_magnetic_parameter(), and supports_faraday().
|
noexcept |
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
[in] | t | A retrieval quantity |
Definition at line 1120 of file jacobian.cc.
References Frequency, and is_wind_parameter().
Referenced by abs_xsec_per_speciesAddConts(), Linefunctions::apply_rosenkranz_quadratic_scaling(), Linefunctions::apply_VVH_scaling(), Linefunctions::apply_VVW_scaling(), do_frequency_jacobian(), frequency_perturbation(), nlte_sourceFromTemperatureAndSrcCoefPerSpecies(), partial_derivatives_lineshape_dependency(), propmat_clearskyAddFaraday(), propmat_clearskyAddFromLookup(), Linefunctions::set_doppler(), Linefunctions::set_lorentz(), Linefunctions::set_voigt(), supports_CIA(), supports_continuum(), supports_faraday(), supports_hitran_xsec(), supports_lookup(), and supports_relaxation_matrix().
|
noexcept |
Returns if the Retrieval quantity is related to the absorption line.
[in] | t | A retrieval quantity |
Definition at line 1195 of file jacobian.cc.
References is_lineshape_parameter(), is_nlte_parameter(), LineCenter, and LineStrength.
Referenced by supports_continuum(), supports_lookup(), and supports_relaxation_matrix().
|
noexcept |
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC, Y, G, DV derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Definition at line 1187 of file jacobian.cc.
References is_pressure_broadening_D0(), is_pressure_broadening_D2(), is_pressure_broadening_DV(), is_pressure_broadening_ETA(), is_pressure_broadening_FVC(), is_pressure_broadening_G(), is_pressure_broadening_G0(), is_pressure_broadening_G2(), and is_pressure_broadening_Y().
Referenced by Linefunctions::apply_lineshapemodel_jacobian_scaling(), and is_line_parameter().
|
noexcept |
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Definition at line 1180 of file jacobian.cc.
References is_pressure_broadening_D0(), is_pressure_broadening_D2(), is_pressure_broadening_ETA(), is_pressure_broadening_FVC(), is_pressure_broadening_G0(), and is_pressure_broadening_G2().
|
noexcept |
Returns if the Retrieval quantity is a X0 derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Definition at line 1155 of file jacobian.cc.
References VARISLINESHAPEPARAM.
|
noexcept |
Returns if the Retrieval quantity is a X1 derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Definition at line 1163 of file jacobian.cc.
References VARISLINESHAPEPARAM.
|
noexcept |
Returns if the Retrieval quantity is a X2 derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Definition at line 1171 of file jacobian.cc.
References VARISLINESHAPEPARAM.
|
noexcept |
Returns if the Retrieval quantity is a magnetic parameter.
[in] | t | A retrieval quantity |
Definition at line 1128 of file jacobian.cc.
References is_derived_magnetic_parameter(), MagneticU, MagneticV, and MagneticW.
Referenced by do_magnetic_jacobian(), magnetic_field_perturbation(), Linefunctions::set_lorentz(), and Linefunctions::set_voigt().
|
noexcept |
Returns if the Retrieval quantity is a NLTE parameter.
[in] | t | A retrieval quantity |
Definition at line 1133 of file jacobian.cc.
References NLTE.
Referenced by is_line_parameter(), and supports_LBL_without_phase().
|
noexcept |
Returns if the Retrieval quantity is a D0 derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), is_lineshape_parameter_bar_linemixing(), Linefunctions::set_lorentz(), and Linefunctions::set_voigt().
|
noexcept |
Returns if the Retrieval quantity is a D2 derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), and is_lineshape_parameter_bar_linemixing().
|
noexcept |
Returns if the Retrieval quantity is a DV derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), Linefunctions::set_lorentz(), and Linefunctions::set_voigt().
|
noexcept |
Returns if the Retrieval quantity is a ETA derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), and is_lineshape_parameter_bar_linemixing().
|
noexcept |
Returns if the Retrieval quantity is a FVC derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), and is_lineshape_parameter_bar_linemixing().
|
noexcept |
Returns if the Retrieval quantity is a G derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter().
|
noexcept |
Returns if the Retrieval quantity is a G0 derivative.
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), is_lineshape_parameter_bar_linemixing(), Linefunctions::set_lorentz(), and Linefunctions::set_voigt().
|
noexcept |
Returns if the Retrieval quantity is a G0 derivative.
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter(), and is_lineshape_parameter_bar_linemixing().
|
noexcept |
Returns if the Retrieval quantity is a Y derivative.
See LineShape::Model for details on parameter
[in] | t | A retrieval quantity |
Referenced by is_lineshape_parameter().
|
noexcept |
Returns if the Retrieval quantity is a wind parameter.
[in] | t | A retrieval quantity |
Definition at line 1115 of file jacobian.cc.
References WindMagnitude, WindU, WindV, and WindW.
Referenced by is_frequency_parameter().
void jac_ranges_indices | ( | ArrayOfArrayOfIndex & | jis, |
bool & | any_affine, | ||
const ArrayOfRetrievalQuantity & | jqs, | ||
const bool & | before_affine = false |
||
) |
Determines the index range inside x and the Jacobian for each retrieval quantity.
The ranges are given as an ArrayOfArrayOfIndex, where outermost dimension corresponds to retrieval quantity. The inner dimension has throughout size 2, where element 0 is the first index and element 1 is the last index of the range.
[out] | jis | Indices, as described above |
[in] | any_affine | True if at least one quantity has affine transformation. |
[in] | jqs | The WSV jacobian_quantities |
[in] | before_affine | Set to true to get indices without any affine transformation. Default is false. |
Definition at line 58 of file jacobian.cc.
References RetrievalQuantity::HasAffine(), i, ConstMatrixView::ncols(), Array< base >::nelem(), RetrievalQuantity::nelem(), and RetrievalQuantity::TransformationMatrix().
Referenced by covmat_sxAddBlock(), covmat_sxAddInverseBlock(), jacobianAdjustAndTransform(), jacobianCalcFreqShift(), jacobianCalcFreqStretch(), jacobianCalcPointingZaInterp(), jacobianCalcPointingZaRecalc(), jacobianCalcPolyfit(), OEM_checks(), retrievalDefClose(), rtmethods_jacobian_init(), transform_jacobian(), transform_x(), transform_x_back(), x2artsAtmAndSurf(), x2artsSensor(), xaStandard(), xClip(), yActive(), yCalc(), and yCalcAppend().
void jacobian_type_extrapol | ( | ArrayOfGridPos & | gp | ) |
Adopts grid positions to extrapolation used for jacobians.
The standard interpolation scheme applies a linear extrapolation, while for the jacobians the extrapolation can be seen as a "closest" interpolation. That is, for points outisde the covered grid, the value at closest end point is taken. And here extrapolation to +-Inf is allowed.
This function modifies grid positions to jacobaina extrapolation approach. For efficiency, the input grid positions are not asserted at all, and "extrapolation points" are identified simply by a fd outside [0,1].
Definition at line 885 of file jacobian.cc.
References i, and Array< base >::nelem().
Referenced by diy_from_path_to_rgrids(), diy_from_pos_to_rgrids(), and get_gp_rq_to_atmgrids().
|
noexcept |
Returns the magnetic field perturbation if it exists.
[in] | js | As jacobian_quantities WSV |
Definition at line 1320 of file jacobian.cc.
References is_magnetic_parameter().
Referenced by propmat_clearskyAddFaraday().
ostream& operator<< | ( | ostream & | os, |
const RetrievalQuantity & | ot | ||
) |
Output operator for RetrievalQuantity.
Definition at line 51 of file jacobian.cc.
References RetrievalQuantity::Analytical(), RetrievalQuantity::MainTag(), RetrievalQuantity::Mode(), and RetrievalQuantity::Subtag().
Calculates polynomial basis functions.
The basis function is b(x) = 1 for poly_coeff = 0. For higher coefficients, x^poly_coeff - m, where first the range covered by x* is normalised to [-1,1] and m is selected in such way that sum(b) = 0.
[out] | b | Calculated basis function. |
[in] | x | The grid over which the fit shall be performed. |
[in] | poly_coeff | Polynomial coefficient. |
Definition at line 897 of file jacobian.cc.
References dx, i, max, mean(), min, ConstVectorView::nelem(), pow(), and Vector::resize().
Referenced by jacobianCalcFreqStretch(), and jacobianCalcPolyfit().
String propmattype_string | ( | const RetrievalQuantity & | rq | ) |
Returns a string of the retrieval quantity propagation matrix type.
Only use for debugging purpose
[in] | rq | A retrieval quantity |
Definition at line 1328 of file jacobian.cc.
References Electrons, Frequency, LineCenter, lineshapevariable, LineSpecialParameter1, LineStrength, MagneticMagnitude, MagneticU, MagneticV, MagneticW, NLTE, NotPropagationMatrixType, Particulates, RetrievalQuantity::PropMatType(), Temperature, VMR, WindMagnitude, WindU, WindV, and WindW.
bool species_iso_match | ( | const RetrievalQuantity & | rq, |
const Index | species, | ||
const Index | iso | ||
) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
[in] | rq | A retrieval quantity |
[in] | species | An index-mapped species |
[in] | iso | An index-mapped isotopologue |
Definition at line 1268 of file jacobian.cc.
References SpeciesRecord::Isotopologue(), QuantumIdentifier::Isotopologue(), Array< base >::nelem(), RetrievalQuantity::QuantumIdentity(), global_data::species_data, and species_match().
bool species_match | ( | const RetrievalQuantity & | rq, |
const ArrayOfSpeciesTag & | ast | ||
) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
Very slow compared to index input
[in] | rq | A retrieval quantity |
[in] | ast | A list of species tags |
Definition at line 1244 of file jacobian.cc.
References QuantumIdentifier::ALL, array_species_tag_from_string(), QuantumIdentifier::Isotopologue(), RetrievalQuantity::QuantumIdentity(), QuantumIdentifier::Species(), RetrievalQuantity::Subtag(), and QuantumIdentifier::Type().
Referenced by species_iso_match().
bool species_match | ( | const RetrievalQuantity & | rq, |
const Index | species | ||
) |
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
[in] | rq | A retrieval quantity |
[in] | species | An index-mapped species |
Definition at line 1262 of file jacobian.cc.
References RetrievalQuantity::QuantumIdentity(), QuantumIdentifier::Species(), and VMR.
bool supports_CIA | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports CIA derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1200 of file jacobian.cc.
References is_frequency_parameter(), Temperature, and VMR.
Referenced by abs_xsec_per_speciesAddCIA().
bool supports_continuum | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports continuum derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1208 of file jacobian.cc.
References is_frequency_parameter(), is_line_parameter(), Temperature, and VMR.
Referenced by abs_xsec_per_speciesAddConts().
bool supports_faraday | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports Faraday derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1230 of file jacobian.cc.
References Electrons, is_derived_magnetic_parameter(), is_frequency_parameter(), MagneticU, MagneticV, and MagneticW.
Referenced by propmat_clearskyAddFaraday().
bool supports_hitran_xsec | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports HITRAN cross-section derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1204 of file jacobian.cc.
References is_frequency_parameter(), Temperature, and VMR.
Referenced by abs_xsec_per_speciesAddHitranXsec().
bool supports_LBL_without_phase | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports line-by-line derivatives without requiring the phase.
FIXME: This should be removed when updating away from the old XSEC routine
[in] | js | As jacobian_quantities WSV |
Definition at line 1214 of file jacobian.cc.
References is_nlte_parameter(), LineStrength, and VMR.
bool supports_lookup | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports lookup table derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1224 of file jacobian.cc.
References is_frequency_parameter(), is_line_parameter(), Temperature, and VMR.
Referenced by propmat_clearskyAddFromLookup().
bool supports_particles | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports particulate derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1236 of file jacobian.cc.
References NotPropagationMatrixType.
Referenced by propmat_clearskyAddParticles().
bool supports_propmat_clearsky | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports propagation matrix derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1240 of file jacobian.cc.
References NotPropagationMatrixType.
Referenced by abs_xsec_per_speciesAddLines(), and abs_xsec_per_speciesInit().
bool supports_relaxation_matrix | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports relaxation matrix derivatives.
[in] | js | As jacobian_quantities WSV |
Definition at line 1218 of file jacobian.cc.
References is_frequency_parameter(), is_line_parameter(), and Temperature.
bool supports_zeeman | ( | const ArrayOfRetrievalQuantity & | js | ) |
Returns if the array supports Zeeman derivatives.
[in] | js | As jacobian_quantities WSV |
|
noexcept |
Returns the temperature perturbation if it exists.
[in] | js | As jacobian_quantities WSV |
Definition at line 1304 of file jacobian.cc.
References Temperature.
Referenced by abs_xsec_per_speciesAddCIA(), abs_xsec_per_speciesAddConts(), propmat_clearskyAddFromLookup(), propmat_clearskyAddParticles(), xsec_species(), and zeeman_on_the_fly().
void transform_jacobian | ( | Matrix & | jacobian, |
const Vector | x, | ||
const ArrayOfRetrievalQuantity & | jqs | ||
) |
Applies both functional and affine transformations.
[in] | jacobian | As the WSV jacobian |
[in] | jqs | As the WSV jacobian_quantities |
Definition at line 103 of file jacobian.cc.
References i, jac_ranges_indices(), Array< base >::nelem(), transform_x_back(), and RetrievalQuantity::TransformationFunc().
Referenced by jacobianAdjustAndTransform().
void transform_x | ( | Vector & | x, |
const ArrayOfRetrievalQuantity & | jqs | ||
) |
Handles transformations of the state vector.
Applies both functional and affine transformations.
[in,out] | x | As the WSV x |
[in] | jqs | As the WSV jacobian_quantities |
Definition at line 168 of file jacobian.cc.
References RetrievalQuantity::HasAffine(), i, jac_ranges_indices(), mult(), Array< base >::nelem(), RetrievalQuantity::OffsetVector(), r, _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), swap(), RetrievalQuantity::TFuncParameters(), RetrievalQuantity::TransformationFunc(), RetrievalQuantity::TransformationMatrix(), and transpose().
void transform_x_back | ( | Vector & | x_t, |
const ArrayOfRetrievalQuantity & | jqs, | ||
bool | revert_functional_transforms = true |
||
) |
Handles back-transformations of the state vector.
Applies both functional and affine transformations.
[in] | x | As the WSV x |
[in] | jqs | As the WSV jacobian_quantities |
Definition at line 257 of file jacobian.cc.
References RetrievalQuantity::HasAffine(), i, jac_ranges_indices(), mult(), Array< base >::nelem(), RetrievalQuantity::OffsetVector(), pow(), r, swap(), RetrievalQuantity::TFuncParameters(), RetrievalQuantity::TransformationFunc(), and RetrievalQuantity::TransformationMatrix().
Referenced by jacobianAdjustAndTransform(), transform_jacobian(), x2artsAtmAndSurf(), and x2artsSensor().
void vmrunitscf | ( | Numeric & | x, |
const String & | unit, | ||
const Numeric & | vmr, | ||
const Numeric & | p, | ||
const Numeric & | t | ||
) |
Scale factor for conversion between gas species units.
The function finds the factor with which the total absorption of a gas species shall be multiplicated to match the selected (jacobian) unit.
[out] | x | Scale factor |
[in] | unit | Unit selected. |
[in] | vmr | VMR value. |
[in] | p | Pressure |
[in] | t | Temperature. |
Definition at line 1001 of file jacobian.cc.
References number_density(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by adapt_stepwise_partial_derivatives().