ARTS  2.2.66
jacobian.cc File Reference

Routines for setting up the jacobian. More...

#include "arts.h"
#include "auto_md.h"
#include "check_input.h"
#include "jacobian.h"
#include "special_interp.h"
#include "physics_funcs.h"

Go to the source code of this file.

Functions

ostream & operator<< (ostream &os, const RetrievalQuantity &ot)
 Output operator for RetrievalQuantity. More...
 
void from_dpath_to_dx (MatrixView diy_dx, ConstMatrixView diy_dq, const Numeric &w)
 diy_from_path_to_rgrids More...
 
void gp4length1grid (ArrayOfGridPos &gp)
 
void add_extrap (ArrayOfGridPos &gp)
 
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)
 
void get_pointers_for_analytical_jacobians (ArrayOfIndex &abs_species_i, ArrayOfIndex &is_t, ArrayOfIndex &wind_i, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
 Help function for analytical jacobian calculations. More...
 
void calc_nd_field (Tensor3View &nd, const VectorView &p, const Tensor3View &t)
 Calculate the number density field. 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...
 
void get_perturbation_gridpos (ArrayOfGridPos &gp, const Vector &atm_grid, const Vector &jac_grid, const bool &is_pressure)
 Calculate array of GridPos for perturbation interpolation. More...
 
void get_perturbation_limit (ArrayOfIndex &limit, const Vector &pert_grid, const Vector &atm_limit)
 Get limits for perturbation of a box. More...
 
void get_perturbation_range (Range &range, const Index &index, const Index &length)
 Get range for perturbation. More...
 
void perturbation_field_1d (VectorView field, const ArrayOfGridPos &p_gp, const Index &p_pert_n, const Range &p_range, const Numeric &size, const Index &method)
 Calculate the 1D perturbation for a relative perturbation. More...
 
void perturbation_field_2d (MatrixView field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const Index &p_pert_n, const Index &lat_pert_n, const Range &p_range, const Range &lat_range, const Numeric &size, const Index &method)
 Calculate the 2D perturbation for a relative perturbation. More...
 
void perturbation_field_3d (Tensor3View field, const ArrayOfGridPos &p_gp, const ArrayOfGridPos &lat_gp, const ArrayOfGridPos &lon_gp, const Index &p_pert_n, const Index &lat_pert_n, const Index &lon_pert_n, const Range &p_range, const Range &lat_range, const Range &lon_range, const Numeric &size, const Index &method)
 Calculate the 3D perturbation for a relative perturbation. More...
 
void polynomial_basis_func (Vector &b, const Vector &x, const Index &poly_coeff)
 Calculates polynomial basis functions. More...
 
void vmrunitscf (Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
 vmrunitscf More...
 

Variables

const String ABSSPECIES_MAINTAG
 
const String TEMPERATURE_MAINTAG
 
const String WIND_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.

Function Documentation

◆ add_extrap()

void add_extrap ( ArrayOfGridPos gp)

Definition at line 93 of file jacobian.cc.

References Array< base >::nelem().

Referenced by diy_from_path_to_rgrids().

◆ calc_nd_field()

void calc_nd_field ( Tensor3View nd,
const VectorView p,
const Tensor3View t 
)

Calculate the number density field.

This function returns the number density for each grid point in the Tensor3View.

Parameters
ndThe number density field
pThe pressure grid
tThe temperature field
Author
Mattias Ekstrom
Date
2005-06-03

Definition at line 347 of file jacobian.cc.

References ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and number_density().

Referenced by jacobianCalcAbsSpeciesPerturbations().

◆ check_retrieval_grids()

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.

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
gridsThe array of retrieval grids.
osThe output string stream.
p_gridThe atmospheric pressure grid
lat_gridThe atmospheric latitude grid
lon_gridThe atmospheric longitude grid
p_retrThe pressure retrieval grid.
lat_retrThe latitude retrieval grid.
lon_retrThe longitude retrieval grid.
p_retr_nameThe control file name used for the pressure retrieval grid.
lat_retr_nameThe control file name for the latitude retrieval grid.
lon_retr_nameThe control file name for the longitude retrieval grid.
dimThe atmosphere dimension
Returns
Boolean for check.
Author
Mattias Ekstrom
Date
2005-05-11

Definition at line 396 of file jacobian.cc.

References is_decreasing(), is_increasing(), and ConstVectorView::nelem().

Referenced by jacobianAddAbsSpecies(), jacobianAddTemperature(), and jacobianAddWind().

◆ 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 
)

◆ from_dpath_to_dx()

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

diy_from_path_to_rgrids

Maps jacobian data for points along the propagation path, to jacobian retrieval grid data.

Parameters
diy_dxOut: Jacobians for selected retrieval grids.
jacobian_quantityAs the WSV.
diy_dpathJacobians along the propagation path.
atmosphere_dimAs the WSV.
ppathAs the WSV.
ppath_pThe pressure at each ppath point.
Author
Patrick Eriksson
Date
2009-10-08

Definition at line 70 of file jacobian.cc.

References ConstMatrixView::ncols(), ConstMatrixView::nrows(), and w().

Referenced by diy_from_path_to_rgrids().

◆ get_perturbation_gridpos()

void get_perturbation_gridpos ( ArrayOfGridPos gp,
const Vector atm_grid,
const Vector jac_grid,
const bool &  is_pressure 
)

Calculate array of GridPos for perturbation interpolation.

This function constructs a perturbation grid which consists of the given retrieval grid with an extra endpoint added at each end. These endpoints lies outside the atmospheric grid. This enables the interpolation of an perturbation on the perturbation grid to be interpolated to the atmospheric grid. For this reason the function returns an ArrayOfGridPos.

If the atmospheric grid is a pressure grid, interpolation is made in logarithm of the atmospheric grid.

Parameters
gpArray of GridPos for interpolation.
atm_gridAtmospheric grid.
jac_gridRetrieval grid.
is_pressureTrue for pressure grid
Author
Mattias Ekstrom
Date
2005-05-12

Definition at line 521 of file jacobian.cc.

References gridpos(), ConstVectorView::nelem(), and p2gridpos().

Referenced by jacobianCalcAbsSpeciesPerturbations(), and jacobianCalcTemperaturePerturbations().

◆ get_perturbation_limit()

void get_perturbation_limit ( ArrayOfIndex limit,
const Vector pert_grid,
const Vector atm_limit 
)

Get limits for perturbation of a box.

This is a helper function that calculates the limits where the perturbation should be added to the perturbation grid. This is needed for example by the particle perturbation that only should be applied for the cloudbox. The limits are defined as the outermost points lying within or just outside the box limits.

The atmospheric limits should be given in the same unit as the perturbation grid. And only the first and last element will be considered as limits.

Assertions are used to perform checks. The input grids are checked so that the atmospheric limits are containg within the perturbation grid. The limit indices are checked so that they are ordered in increasing order before return.

Parameters
limitThe limit indices in the perturbation grid
pert_gridThe perturbation grid
atm_limitThe atmospheric limits of the box.
Author
Mattias Ekstrom
Date
2005-02-25

Definition at line 580 of file jacobian.cc.

References is_decreasing(), and ConstVectorView::nelem().

◆ get_perturbation_range()

void get_perturbation_range ( Range range,
const Index index,
const Index length 
)

Get range for perturbation.

This is a helper function that calculates the range in which the perturbation should be added to the perturbation grid. This is needed to handle the edge effects. At the edges we want the perturbation to continue outwards.

Parameters
rangeThe range in the perturbation grid.
indexThe index of the perturbation in the retrieval grid.
lengthThe length of retrieval grid
Author
Mattias Ekstrom
Date
2004-10-14

Definition at line 632 of file jacobian.cc.

Referenced by jacobianCalcAbsSpeciesPerturbations(), and jacobianCalcTemperaturePerturbations().

◆ get_pointers_for_analytical_jacobians()

void get_pointers_for_analytical_jacobians ( ArrayOfIndex abs_species_i,
ArrayOfIndex is_t,
ArrayOfIndex wind_i,
const ArrayOfRetrievalQuantity jacobian_quantities,
const ArrayOfArrayOfSpeciesTag abs_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
abs_species_iOut: Matching index in abs_species
is_tOut: Flag for: Is a temperature jacobian?
jacobian_quantitiesAs the WSV.
abs_speciesAs the WSV.
Author
Patrick Eriksson
Date
2009-10-07

Definition at line 292 of file jacobian.cc.

References ABSSPECIES_MAINTAG, array_species_tag_from_string(), chk_contains(), FOR_ANALYTICAL_JACOBIANS_DO, TEMPERATURE_MAINTAG, and WIND_MAINTAG.

Referenced by iyEmissionStandard(), and iyTransmissionStandard().

◆ gp4length1grid()

void gp4length1grid ( ArrayOfGridPos gp)

Definition at line 81 of file jacobian.cc.

References Array< base >::nelem().

Referenced by diy_from_path_to_rgrids().

◆ operator<<()

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

Output operator for RetrievalQuantity.

Author
Mattias Ekstrom

Definition at line 38 of file jacobian.cc.

References RetrievalQuantity::Analytical(), RetrievalQuantity::MainTag(), RetrievalQuantity::Mode(), and RetrievalQuantity::Subtag().

◆ perturbation_field_1d()

void perturbation_field_1d ( VectorView  field,
const ArrayOfGridPos p_gp,
const Index p_pert_n,
const Range p_range,
const Numeric size,
const Index method 
)

Calculate the 1D perturbation for a relative perturbation.

This is a helper function that interpolated the perturbation field for a 1D relative perturbation onto the atmospheric field.

Parameters
fieldThe interpolated perturbation field.
p_gpThe GridPos for interpolation.
p_pert_nThe number of perturbations.
p_rangeThe perturbation range in the perturbation grid.
sizeThe size of the perturbation.
methodRelative perturbation==0, absolute==1
Author
Mattias Ekstrom
Date
2005-05-11

Definition at line 662 of file jacobian.cc.

References interp(), interpweights(), Array< base >::nelem(), and ConstVectorView::nelem().

Referenced by jacobianCalcAbsSpeciesPerturbations(), and jacobianCalcTemperaturePerturbations().

◆ perturbation_field_2d()

void perturbation_field_2d ( MatrixView  field,
const ArrayOfGridPos p_gp,
const ArrayOfGridPos lat_gp,
const Index p_pert_n,
const Index lat_pert_n,
const Range p_range,
const Range lat_range,
const Numeric size,
const Index method 
)

Calculate the 2D perturbation for a relative perturbation.

This is a helper function that interpolated the perturbation field for a 2D relative perturbation onto the atmospheric field.

Parameters
fieldThe interpolated perturbation field.
p_gpThe GridPos for interpolation in the 1st dim.
lat_gpThe GridPos for interpolation in the 2nd dim.
p_pert_nThe number of perturbations in the 1st dim.
lat_pert_nThe number of perturbations in the 2nd dim.
p_rangeThe perturbation range in the 1st dim.
lat_rangeThe perturbation range in the 2nd dim.
sizeThe size of the perturbation.
methodRelative perturbation==0, absolute==1
Author
Mattias Ekstrom
Date
2005-05-11

Definition at line 707 of file jacobian.cc.

References interp(), interpweights(), ConstMatrixView::ncols(), Array< base >::nelem(), and ConstMatrixView::nrows().

Referenced by jacobianCalcAbsSpeciesPerturbations(), and jacobianCalcTemperaturePerturbations().

◆ perturbation_field_3d()

void perturbation_field_3d ( Tensor3View  field,
const ArrayOfGridPos p_gp,
const ArrayOfGridPos lat_gp,
const ArrayOfGridPos lon_gp,
const Index p_pert_n,
const Index lat_pert_n,
const Index lon_pert_n,
const Range p_range,
const Range lat_range,
const Range lon_range,
const Numeric size,
const Index method 
)

Calculate the 3D perturbation for a relative perturbation.

This is a helper function that interpolated the perturbation field for a 3D relative perturbation onto the atmospheric field.

Parameters
fieldThe interpolated perturbation field.
p_gpThe GridPos for interpolation in the 1st dim.
lat_gpThe GridPos for interpolation in the 2nd dim.
lon_gpThe GridPos for interpolation in the 3rd dim.
p_pert_nThe number of perturbations in the 1st dim.
lat_pert_nThe number of perturbations in the 2nd dim.
lon_pert_nThe number of perturbations in the 3rd dim.
p_rangeThe perturbation range in the 1st dim.
lat_rangeThe perturbation range in the 2nd dim.
lon_rangeThe perturbation range in the 3rd dim.
sizeThe size of the perturbation.
methodSet to 0 for relative, and 1 for absolute.
Author
Mattias Ekstrom
Date
2005-05-11

Definition at line 758 of file jacobian.cc.

References interp(), interpweights(), ConstTensor3View::ncols(), Array< base >::nelem(), ConstTensor3View::npages(), and ConstTensor3View::nrows().

Referenced by jacobianCalcAbsSpeciesPerturbations(), and jacobianCalcTemperaturePerturbations().

◆ 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
bCalculated basis function.
xThe grid over which the fit shall be performed.
poly_coeffPolynomial coefficient.
Author
Patrick Eriksson
Date
2008-11-07

Definition at line 805 of file jacobian.cc.

References dx, max, mean(), min, ConstVectorView::nelem(), and Vector::resize().

Referenced by jacobianCalcFreqShift(), jacobianCalcFreqStretch(), jacobianCalcPointingZaInterp(), jacobianCalcPointingZaRecalc(), and jacobianCalcPolyfit().

◆ vmrunitscf()

void vmrunitscf ( Numeric x,
const String unit,
const Numeric vmr,
const Numeric p,
const Numeric t 
)

vmrunitscf

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
xOut: scale factor
unitUnit selected.
vmrVMR value.
pPressure
tTemperature.
Author
Patrick Eriksson
Date
2009-10-08

Definition at line 853 of file jacobian.cc.

References number_density().

Referenced by iyEmissionStandard(), and iyTransmissionStandard().

Variable Documentation

◆ ABSSPECIES_MAINTAG

const String ABSSPECIES_MAINTAG
extern

◆ TEMPERATURE_MAINTAG

const String TEMPERATURE_MAINTAG
extern

◆ WIND_MAINTAG

const String WIND_MAINTAG
extern