ARTS  2.3.1285(git:92a29ea9-dirty)
jacobian.cc File Reference

Routines for setting up the jacobian. More...

#include "jacobian.h"
#include "arts.h"
#include "auto_md.h"
#include "check_input.h"
#include "global_data.h"
#include "lin_alg.h"
#include "physics_funcs.h"
#include "rte.h"
#include "special_interp.h"

Go to the source code of this file.

Macros

#define ISLINESHAPETYPE(X)
 
#define VARISLINESHAPEPARAM(X, Y)   (t == JacPropMatType::LineShape##X##Y)
 
#define lineshapevariable(X1, X2)   JacPropMatType::LineShape##X1##X2 : return "Line-Shape: " #X1 " " #X2
 

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)
 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)
 Handles back-transformations of the state vector. More...
 
void from_dpath_to_dx (MatrixView diy_dx, ConstMatrixView diy_dq, const Numeric &w)
 
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...
 
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 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)
 
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...
 
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_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_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...
 
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...
 

Variables

const Numeric NAT_LOG_TEN
 
const Numeric PI
 
const String ABSSPECIES_MAINTAG
 
const String SCATSPECIES_MAINTAG
 
const String TEMPERATURE_MAINTAG
 
const String WIND_MAINTAG
 
const String MAGFIELD_MAINTAG
 
const String FLUX_MAINTAG
 
const String PROPMAT_SUBSUBTAG
 
const String ELECTRONS_MAINTAG
 
const String PARTICULATES_MAINTAG
 
const String POLYFIT_MAINTAG
 
const String SINEFIT_MAINTAG
 

Detailed Description

Routines for setting up the jacobian.

Author
Mattias Ekstrom ekstr.nosp@m.om@r.nosp@m.ss.ch.nosp@m.alme.nosp@m.rs.se
Date
2004-09-14

Definition in file jacobian.cc.

Macro Definition Documentation

◆ ISLINESHAPETYPE

#define ISLINESHAPETYPE (   X)
Value:
bool is_pressure_broadening_##X(const RetrievalQuantity& t) noexcept { \
return t == JacPropMatType::LineShape##X##X0 or \
t == JacPropMatType::LineShape##X##X1 or \
t == JacPropMatType::LineShape##X##X2; \
}
Deals with internal derivatives, Jacobian definition, and OEM calculations.
Definition: jacobian.h:120

Definition at line 1137 of file jacobian.cc.

◆ lineshapevariable

#define lineshapevariable (   X1,
  X2 
)    JacPropMatType::LineShape##X1##X2 : return "Line-Shape: " #X1 " " #X2

Referenced by propmattype_string().

◆ VARISLINESHAPEPARAM

#define VARISLINESHAPEPARAM (   X,
 
)    (t == JacPropMatType::LineShape##X##Y)

Function Documentation

◆ calcBaselineFit()

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.

Parameters
[out]y_baselineThe computed baseline offset. Computed baseline offset are accumulated into this vector, so it must be initialized externally!
[in]xState vector consisten with given retrieval quantity
[in]mblock_indexThe index of the measurement block.
[in]sensor_responseMust be consistent with size of y_baseline.
[in]sensor_response_pol_gridMust be consistent with size of y_baseline.
[in]sensor_response_f_gridMust be consistent with size of y_baseline.
[in]sensor_dlos_gridMust be consistent with size of y_baseline.
[in]rqThe poly- or sinefit retrieval quantity
[in]rq_indexThe 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().

◆ check_retrieval_grids() [1/2]

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.

Parameters
[out]gridsThe array of retrieval grids.
[in,out]osThe output string stream.
[in]p_gridThe atmospheric pressure grid
[in]lat_gridThe atmospheric latitude grid
[in]lon_gridThe atmospheric longitude grid
[in]p_retrThe pressure retrieval grid.
[in]lat_retrThe latitude retrieval grid.
[in]lon_retrThe longitude retrieval grid.
[in]p_retr_nameThe control file name used for the pressure retrieval grid.
[in]lat_retr_nameThe control file name for the latitude retrieval grid.
[in]lon_retr_nameThe control file name for the longitude retrieval grid.
[in]dimThe atmosphere dimension
Returns
Boolean for check.
Author
Mattias Ekstrom
Date
2005-05-11

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().

◆ check_retrieval_grids() [2/2]

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.

Parameters
[out]gridsThe array of retrieval grids.
[in,out]osThe output string stream.
[in]lat_gridThe atmospheric latitude grid
[in]lon_gridThe atmospheric longitude grid
[in]lat_retrThe latitude retrieval grid.
[in]lon_retrThe longitude retrieval grid.
[in]lat_retr_nameThe control file name for the latitude retrieval grid.
[in]lon_retr_nameThe control file name for the longitude retrieval grid.
[in]dimThe atmosphere dimension
Returns
Boolean for check.
Author
Mattias Ekstrom
Date
2005-05-11

Definition at line 800 of file jacobian.cc.

References is_increasing(), max, Array< base >::nelem(), and ConstVectorView::nelem().

◆ diy_from_path_to_rgrids()

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.

Parameters
[out]diy_dxOne element of the WSV diy_dx.
[in]jacobian_quantityOne element of of the WSV jacobian_quantities.
[in]diy_dpathJacobians along the propagation path.
[in]atmosphere_dimAs the WSV.
[in]ppathAs the WSV.
[in]ppath_pThe pressure at each ppath point.
Author
Patrick Eriksson
Date
2009-10-08

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().

◆ diy_from_pos_to_rgrids()

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.

Parameters
[out]diy_dxOne element of the WSV diy_dx.
[in]jacobian_quantityOne element of of the WSV jacobian_quantities.
[in]diy_dposJacobian for the position itself.
[in]atmosphere_dimAs the WSV.
[in]rtp_posAs the WSV.
Author
Patrick Eriksson
Date
2018-04-10

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().

◆ do_frequency_jacobian()

bool do_frequency_jacobian ( const ArrayOfRetrievalQuantity js)
noexcept

Returns if the array wants a frequency derivative.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

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().

◆ do_line_center_jacobian()

bool do_line_center_jacobian ( const ArrayOfRetrievalQuantity js)
noexcept

Returns if the array wants a line center derivative.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1292 of file jacobian.cc.

References LineCenter.

◆ do_magnetic_jacobian()

bool do_magnetic_jacobian ( const ArrayOfRetrievalQuantity js)
noexcept

Returns if the array wants a magnetic derivative.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1300 of file jacobian.cc.

References is_magnetic_parameter().

Referenced by propmat_clearskyAddFaraday().

◆ do_temperature_jacobian()

bool do_temperature_jacobian ( const ArrayOfRetrievalQuantity js)
noexcept

◆ do_vmr_jacobian()

jacobianVMRcheck do_vmr_jacobian ( const ArrayOfRetrievalQuantity js,
const QuantumIdentifier line_qid 
)
noexcept

Returns the required info for VMR Jacobian.

Parameters
[in]jsAs jacobian_quantities WSV
[in]line_qidA line identifier
Returns
true and retrieval quantity quantum identity pointer if available
false and line_qid pointer if not available

Definition at line 1283 of file jacobian.cc.

References VMR.

Referenced by Linefunctions::set_cross_section_of_band().

◆ dxdvmrscf()

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.

Parameters
[out]xScale factor
[in]unitUnit selected.
[in]vmrVMR value.
[in]pPressure
[in]tTemperature.
Author
Patrick Eriksson
Date
2015-12-11

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().

◆ equivalent_propmattype_index()

Index equivalent_propmattype_index ( const ArrayOfRetrievalQuantity js,
const Index  i 
)
noexcept

Returns a list of positions for the derivatives in Propagation Matrix calculations.

Parameters
[in]jsAs jacobian_quantities WSV
[in]iA position in jacobian_quantities
Returns
List of position

Definition at line 1107 of file jacobian.cc.

Referenced by get_stepwise_clearsky_propmat().

◆ equivalent_propmattype_indexes()

◆ frequency_perturbation()

Numeric frequency_perturbation ( const ArrayOfRetrievalQuantity js)
noexcept

Returns the frequency perturbation if it exists.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
Frequency perturbation

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().

◆ from_dpath_to_dx()

void from_dpath_to_dx ( MatrixView  diy_dx,
ConstMatrixView  diy_dq,
const Numeric w 
)

◆ get_diydx()

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

Parameters
[in,out]diy1Derivative if iy for level 1
[in,out]diy2Derivative if iy for level 2
[in]ImTIdentity matrix minus the transmission matrix
[in]cumulative_transmissionAccumulative transmission from level to sensor
[in]dT1Transmission matrix derivative for level 1
[in]dT2Transmission matrix derivative for level 2
[in]iYmJiy minus the source
[in]dJ1Source vector derivative for level 1
[in]dJ2Source vector derivative for level 2
[in]stokes_dimAs WSV
[in]transmission_onlyBool for not doing emission calculations
Author
Richard Larsson
Date
2017-09-20

Definition at line 1049 of file jacobian.cc.

References mult().

Referenced by iyHybrid().

◆ get_pointers_for_analytical_jacobians()

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.

Parameters
[out]abs_species_iMatching index in abs_species
[out]scat_species_iMatching index among scattering species
[out]is_tFlag for: Is a temperature jacobian?
[in]jacobian_quantitiesAs the WSV.
[in]abs_speciesAs the WSV.
[in]cloudbox_onAs the WSV.
[in]scat_speciesAs the WSV.
Author
Patrick Eriksson
Date
2009-10-07

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().

◆ is_derived_magnetic_parameter()

bool is_derived_magnetic_parameter ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a derived magnetic parameter.

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1124 of file jacobian.cc.

References MagneticMagnitude.

Referenced by is_magnetic_parameter(), and supports_faraday().

◆ is_frequency_parameter()

◆ is_line_parameter()

bool is_line_parameter ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is related to the absorption line.

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

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().

◆ is_lineshape_parameter()

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.

See LineShape::Model for details on parameter

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

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().

◆ is_lineshape_parameter_bar_linemixing()

bool is_lineshape_parameter_bar_linemixing ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC derivative.

See LineShape::Model for details on parameter

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

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().

◆ is_lineshape_parameter_X0()

bool is_lineshape_parameter_X0 ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a X0 derivative.

See LineShape::Model for details on parameter

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1155 of file jacobian.cc.

References VARISLINESHAPEPARAM.

◆ is_lineshape_parameter_X1()

bool is_lineshape_parameter_X1 ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a X1 derivative.

See LineShape::Model for details on parameter

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1163 of file jacobian.cc.

References VARISLINESHAPEPARAM.

◆ is_lineshape_parameter_X2()

bool is_lineshape_parameter_X2 ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a X2 derivative.

See LineShape::Model for details on parameter

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1171 of file jacobian.cc.

References VARISLINESHAPEPARAM.

◆ is_magnetic_parameter()

bool is_magnetic_parameter ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a magnetic parameter.

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

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().

◆ is_nlte_parameter()

bool is_nlte_parameter ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a NLTE parameter.

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1133 of file jacobian.cc.

References NLTE.

Referenced by is_line_parameter(), and supports_LBL_without_phase().

◆ is_wind_parameter()

bool is_wind_parameter ( const RetrievalQuantity t)
noexcept

Returns if the Retrieval quantity is a wind parameter.

Parameters
[in]tA retrieval quantity
Returns
true if it is
false if it is not

Definition at line 1115 of file jacobian.cc.

References WindMagnitude, WindU, WindV, and WindW.

Referenced by is_frequency_parameter().

◆ jac_ranges_indices()

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.

Parameters
[out]jisIndices, as described above
[in]any_affineTrue if at least one quantity has affine transformation.
[in]jqsThe WSV jacobian_quantities
[in]before_affineSet to true to get indices without any affine transformation. Default is false.
Author
Simon Pfreundschuh and Patrick Eriksson
Date
2017-12-30

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().

◆ jacobian_type_extrapol()

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].

Parameters

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().

◆ magnetic_field_perturbation()

Numeric magnetic_field_perturbation ( const ArrayOfRetrievalQuantity js)
noexcept

Returns the magnetic field perturbation if it exists.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
Magnetic field perturbation

Definition at line 1320 of file jacobian.cc.

References is_magnetic_parameter().

Referenced by propmat_clearskyAddFaraday().

◆ operator<<()

ostream& operator<< ( ostream &  os,
const RetrievalQuantity ot 
)

◆ polynomial_basis_func()

void polynomial_basis_func ( Vector b,
const Vector x,
const Index poly_coeff 
)

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.

Parameters
[out]bCalculated basis function.
[in]xThe grid over which the fit shall be performed.
[in]poly_coeffPolynomial coefficient.
Author
Patrick Eriksson
Date
2008-11-07

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().

◆ propmattype_string()

String propmattype_string ( const RetrievalQuantity rq)

Returns a string of the retrieval quantity propagation matrix type.

Only use for debugging purpose

Parameters
[in]rqA retrieval quantity
Returns
Text representation

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.

◆ species_iso_match()

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.

Parameters
[in]rqA retrieval quantity
[in]speciesAn index-mapped species
[in]isoAn index-mapped isotopologue
Returns
true the species and isotopologue match the species and isotopologue in the retrieval quantity
false otherwise

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().

◆ species_match() [1/2]

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

Parameters
[in]rqA retrieval quantity
[in]astA list of species tags
Returns
true if all species in the tags list matches the species in the retrieval quantity
false otherwise

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().

◆ species_match() [2/2]

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.

Parameters
[in]rqA retrieval quantity
[in]speciesAn index-mapped species
Returns
true the species match the species in the retrieval quantity
false otherwise

Definition at line 1262 of file jacobian.cc.

References RetrievalQuantity::QuantumIdentity(), QuantumIdentifier::Species(), and VMR.

◆ supports_CIA()

bool supports_CIA ( const ArrayOfRetrievalQuantity js)

Returns if the array supports CIA derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1200 of file jacobian.cc.

References is_frequency_parameter(), Temperature, and VMR.

Referenced by abs_xsec_per_speciesAddCIA().

◆ supports_continuum()

bool supports_continuum ( const ArrayOfRetrievalQuantity js)

Returns if the array supports continuum derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1208 of file jacobian.cc.

References is_frequency_parameter(), is_line_parameter(), Temperature, and VMR.

Referenced by abs_xsec_per_speciesAddConts().

◆ supports_faraday()

bool supports_faraday ( const ArrayOfRetrievalQuantity js)

Returns if the array supports Faraday derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

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().

◆ supports_hitran_xsec()

bool supports_hitran_xsec ( const ArrayOfRetrievalQuantity js)

Returns if the array supports HITRAN cross-section derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1204 of file jacobian.cc.

References is_frequency_parameter(), Temperature, and VMR.

Referenced by abs_xsec_per_speciesAddHitranXsec().

◆ supports_LBL_without_phase()

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

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1214 of file jacobian.cc.

References is_nlte_parameter(), LineStrength, and VMR.

◆ supports_lookup()

bool supports_lookup ( const ArrayOfRetrievalQuantity js)

Returns if the array supports lookup table derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1224 of file jacobian.cc.

References is_frequency_parameter(), is_line_parameter(), Temperature, and VMR.

Referenced by propmat_clearskyAddFromLookup().

◆ supports_particles()

bool supports_particles ( const ArrayOfRetrievalQuantity js)

Returns if the array supports particulate derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1236 of file jacobian.cc.

References NotPropagationMatrixType.

Referenced by propmat_clearskyAddParticles().

◆ supports_propmat_clearsky()

bool supports_propmat_clearsky ( const ArrayOfRetrievalQuantity js)

Returns if the array supports propagation matrix derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1240 of file jacobian.cc.

References NotPropagationMatrixType.

Referenced by abs_xsec_per_speciesAddLines(), and abs_xsec_per_speciesInit().

◆ supports_relaxation_matrix()

bool supports_relaxation_matrix ( const ArrayOfRetrievalQuantity js)

Returns if the array supports relaxation matrix derivatives.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
true if it does
false if it does not

Definition at line 1218 of file jacobian.cc.

References is_frequency_parameter(), is_line_parameter(), and Temperature.

◆ temperature_perturbation()

Numeric temperature_perturbation ( const ArrayOfRetrievalQuantity js)
noexcept

Returns the temperature perturbation if it exists.

Parameters
[in]jsAs jacobian_quantities WSV
Returns
Temperature perturbation

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().

◆ transform_jacobian()

void transform_jacobian ( Matrix jacobian,
const Vector  x,
const ArrayOfRetrievalQuantity jqs 
)

Applies both functional and affine transformations.

Parameters
[in]jacobianAs the WSV jacobian
[in]jqsAs the WSV jacobian_quantities
Author
Simon Pfreundschuh and Patrick Eriksson
Date
2017-12-30

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().

◆ transform_x()

void transform_x ( Vector x,
const ArrayOfRetrievalQuantity jqs 
)

Handles transformations of the state vector.

Applies both functional and affine transformations.

Parameters
[in,out]xAs the WSV x
[in]jqsAs the WSV jacobian_quantities
Author
Simon Pfreundschuh and Patrick Eriksson
Date
2017-12-30

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().

◆ transform_x_back()

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.

Parameters
[in]xAs the WSV x
[in]jqsAs the WSV jacobian_quantities
Author
Simon Pfreundschuh and Patrick Eriksson
Date
2017-12-30

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().

◆ vmrunitscf()

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.

Parameters
[out]xScale factor
[in]unitUnit selected.
[in]vmrVMR value.
[in]pPressure
[in]tTemperature.
Author
Patrick Eriksson
Date
2009-10-08

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().

Variable Documentation

◆ ABSSPECIES_MAINTAG

const String ABSSPECIES_MAINTAG

◆ ELECTRONS_MAINTAG

const String ELECTRONS_MAINTAG

◆ FLUX_MAINTAG

const String FLUX_MAINTAG

◆ MAGFIELD_MAINTAG

const String MAGFIELD_MAINTAG

◆ NAT_LOG_TEN

const Numeric NAT_LOG_TEN

◆ PARTICULATES_MAINTAG

const String PARTICULATES_MAINTAG

◆ PI

const Numeric PI

◆ POLYFIT_MAINTAG

const String POLYFIT_MAINTAG

Referenced by calcBaselineFit().

◆ PROPMAT_SUBSUBTAG

const String PROPMAT_SUBSUBTAG

◆ SCATSPECIES_MAINTAG

const String SCATSPECIES_MAINTAG

◆ SINEFIT_MAINTAG

const String SINEFIT_MAINTAG

Referenced by calcBaselineFit().

◆ TEMPERATURE_MAINTAG

const String TEMPERATURE_MAINTAG

◆ WIND_MAINTAG

const String WIND_MAINTAG