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

Workspace functions related to making OEM inversions. More...

#include <cmath>
#include <iterator>
#include <sstream>
#include <stdexcept>
#include <string>
#include "array.h"
#include "arts.h"
#include "arts_omp.h"
#include "auto_md.h"
#include "jacobian.h"
#include "math_funcs.h"
#include "physics_funcs.h"
#include "rte.h"
#include "special_interp.h"
#include "surface.h"

Go to the source code of this file.

Functions

void particle_bulkprop_fieldClip (Tensor4 &particle_bulkprop_field, const ArrayOfString &particle_bulkprop_names, const String &bulkprop_name, const Numeric &limit_low, const Numeric &limit_high, const Verbosity &)
 WORKSPACE METHOD: particle_bulkprop_fieldClip. More...
 
void vmr_fieldClip (Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const String &species, const Numeric &limit_low, const Numeric &limit_high, const Verbosity &)
 WORKSPACE METHOD: vmr_fieldClip. More...
 
void xClip (Vector &x, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &ijq, const Numeric &limit_low, const Numeric &limit_high, const Verbosity &)
 WORKSPACE METHOD: xClip. More...
 
void xaStandard (Workspace &ws, Vector &xa, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &cloudbox_on, const Index &cloudbox_checked, const Tensor4 &particle_bulkprop_field, const ArrayOfString &particle_bulkprop_names, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const Agenda &water_p_eq_agenda, const Verbosity &)
 WORKSPACE METHOD: xaStandard. More...
 
void x2artsAtmAndSurf (Workspace &ws, Tensor4 &vmr_field, Tensor3 &t_field, Tensor4 &particle_bulkprop_field, Tensor3 &wind_u_field, Tensor3 &wind_v_field, Tensor3 &wind_w_field, Tensor3 &mag_u_field, Tensor3 &mag_v_field, Tensor3 &mag_w_field, Tensor3 &surface_props_data, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &x, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &cloudbox_on, const Index &cloudbox_checked, const ArrayOfString &particle_bulkprop_names, const ArrayOfString &surface_props_names, const Agenda &water_p_eq_agenda, const Verbosity &)
 WORKSPACE METHOD: x2artsAtmAndSurf. More...
 
void x2artsSensor (Workspace &ws, Matrix &sensor_los, Vector &f_backend, Vector &y_baseline, Sparse &sensor_response, Vector &sensor_response_f, ArrayOfIndex &sensor_response_pol, Matrix &sensor_response_dlos, Vector &sensor_response_f_grid, ArrayOfIndex &sensor_response_pol_grid, Matrix &sensor_response_dlos_grid, Matrix &mblock_dlos_grid, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &x, const Agenda &sensor_response_agenda, const Index &sensor_checked, const Vector &sensor_time, const Verbosity &)
 WORKSPACE METHOD: x2artsSensor. More...
 
void x2artsSpectroscopy (const Verbosity &)
 WORKSPACE METHOD: x2artsSpectroscopy. More...
 
void covmat_soCalc (Matrix &, const Matrix &, const CovarianceMatrix &, const Verbosity &)
 WORKSPACE METHOD: covmat_soCalc. More...
 
void covmat_ssCalc (Matrix &, const Matrix &, const CovarianceMatrix &, const Verbosity &)
 WORKSPACE METHOD: covmat_ssCalc. More...
 
void avkCalc (Matrix &, const Matrix &, const Matrix &, const Verbosity &)
 WORKSPACE METHOD: avkCalc. More...
 
void OEM (Workspace &, Vector &, Vector &, Matrix &, Matrix &, Vector &, Vector &, ArrayOfString &, const Vector &, const CovarianceMatrix &, const Vector &, const CovarianceMatrix &, const Index &, const ArrayOfRetrievalQuantity &, const ArrayOfArrayOfIndex &, const Agenda &, const String &, const Numeric &, const Vector &, const Index &, const Numeric &, const Vector &, const Index &, const Index &, const Verbosity &)
 
void OEM_MPI (Workspace &, Vector &, Vector &, Matrix &, Matrix &, Vector &, Vector &, Matrix &, Matrix &, Vector &, CovarianceMatrix &, CovarianceMatrix &, const Vector &, const Vector &, const Index &, const ArrayOfRetrievalQuantity &, const Agenda &, const String &, const Numeric &, const Vector &, const Index &, const Numeric &, const Vector &, const Index &, const Index &, const Verbosity &)
 

Variables

const String ABSSPECIES_MAINTAG
 
const String TEMPERATURE_MAINTAG
 
const String POINTING_MAINTAG
 
const String POINTING_SUBTAG_A
 
const String FREQUENCY_MAINTAG
 
const String FREQUENCY_SUBTAG_0
 
const String FREQUENCY_SUBTAG_1
 
const String POLYFIT_MAINTAG
 
const String SCATSPECIES_MAINTAG
 
const String SINEFIT_MAINTAG
 
const String SURFACE_MAINTAG
 
const String WIND_MAINTAG
 
const String MAGFIELD_MAINTAG
 

Detailed Description

Workspace functions related to making OEM inversions.

Author
Patrick Eriksson patri.nosp@m.ck.e.nosp@m.rikss.nosp@m.on@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e
Date
2015-09-08

These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_oem.cc.

Function Documentation

◆ avkCalc()

void avkCalc ( Matrix avk,
const Matrix dxdy,
const Matrix jacobian,
const Verbosity verbosity 
)

WORKSPACE METHOD: avkCalc.

Calculates the averaging kernel matrix describing the sensitivity of the OEM retrieval with respect to the true state of the system. A prerequisite for the calculation of the averaging kernel matrix is a successful OEM calculation in which the jacobian and the gain matrix dxdy have been calculated.

Author
Simon Pfreundschuh
Parameters
[out]avkWS Output
[in]dxdyWS Input
[in]jacobianWS Input

Definition at line 1465 of file m_oem.cc.

Referenced by avkCalc_g().

◆ covmat_soCalc()

void covmat_soCalc ( Matrix covmat_so,
const Matrix dxdy,
const CovarianceMatrix covmat_se,
const Verbosity verbosity 
)

WORKSPACE METHOD: covmat_soCalc.

Calculates the covariance matrix describing the error due to uncertainties in the observation system. The uncertainties of the observation system are described by covmat_se, which must be set by the user to include the relevant contributions from the measurement and the forward model.

Prerequisite for the calculation of covmat_so is a successful OEM computation where also the gain matrix has been computed.

Author
Simon Pfreundschuh
Parameters
[out]covmat_soWS Output
[in]dxdyWS Input
[in]covmat_seWS Input

Definition at line 1447 of file m_oem.cc.

Referenced by covmat_soCalc_g().

◆ covmat_ssCalc()

void covmat_ssCalc ( Matrix covmat_ss,
const Matrix avk,
const CovarianceMatrix covmat_sx,
const Verbosity verbosity 
)

WORKSPACE METHOD: covmat_ssCalc.

Calculates the covariance matrix describing the error due to smoothing. The calculation of covmat_ss also requires the averaging kernel matrix avk to be computed after a successful OEM calculation.

Author
Simon Pfreundschuh
Parameters
[out]covmat_ssWS Output
[in]avkWS Input
[in]covmat_sxWS Input

Definition at line 1456 of file m_oem.cc.

Referenced by covmat_ssCalc_g().

◆ OEM()

void OEM ( Workspace ,
Vector ,
Vector ,
Matrix ,
Matrix ,
Vector ,
Vector ,
ArrayOfString ,
const Vector ,
const CovarianceMatrix ,
const Vector ,
const CovarianceMatrix ,
const Index ,
const ArrayOfRetrievalQuantity ,
const ArrayOfArrayOfIndex ,
const Agenda ,
const String ,
const Numeric ,
const Vector ,
const Index ,
const Numeric ,
const Vector ,
const Index ,
const Index ,
const Verbosity  
)

◆ OEM_MPI()

void OEM_MPI ( Workspace ,
Vector ,
Vector ,
Matrix ,
Matrix ,
Vector ,
Vector ,
Matrix ,
Matrix ,
Vector ,
CovarianceMatrix ,
CovarianceMatrix ,
const Vector ,
const Vector ,
const Index ,
const ArrayOfRetrievalQuantity ,
const Agenda ,
const String ,
const Numeric ,
const Vector ,
const Index ,
const Numeric ,
const Vector ,
const Index ,
const Index ,
const Verbosity  
)

Definition at line 1724 of file m_oem.cc.

Referenced by OEM().

◆ particle_bulkprop_fieldClip()

void particle_bulkprop_fieldClip ( Tensor4 particle_bulkprop_field,
const ArrayOfString particle_bulkprop_names,
const String bulkprop_name,
const Numeric limit_low,
const Numeric limit_high,
const Verbosity verbosity 
)

WORKSPACE METHOD: particle_bulkprop_fieldClip.

Clipping of particle_bulkprop_field.

The method allows you to apply hard limits the values of particle_bulkprop_field*. All values, of the property selected, below limit_low, are simply set to limit_low. And the same is performed with respect to limit_high. That is, the data in x for the retrieval quantity are forced to be inside the range [limit_low,limit_high].

Setting species="ALL", is a shortcut for applying the limits on all properties.

Author
Patrick Eriksson
Parameters
[in,out]particle_bulkprop_fieldWS Input/Output
[in]particle_bulkprop_namesWS Input
[in]bulkprop_nameGeneric Input
[in]limit_lowGeneric Input (Default: "-Inf")
[in]limit_highGeneric Input (Default: "Inf")

Definition at line 74 of file m_oem.cc.

References i, Array< base >::nelem(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and Tensor4Clip().

Referenced by particle_bulkprop_fieldClip_g().

◆ vmr_fieldClip()

void vmr_fieldClip ( Tensor4 vmr_field,
const ArrayOfArrayOfSpeciesTag abs_species,
const String species,
const Numeric limit_low,
const Numeric limit_high,
const Verbosity verbosity 
)

WORKSPACE METHOD: vmr_fieldClip.

Clipping of vmr_field.

The method allows you to apply hard limits the values of vmr_field. All values, of the species selected, below limit_low, are simply set to limit_low. And the same is performed with respect to limit_high*. That is, the data in x for the retrieval quantity are forced to be inside the range [limit_low,limit_high].

Setting species="ALL", is a shortcut for applying the limits on all species.

Author
Patrick Eriksson
Parameters
[in,out]vmr_fieldWS Input/Output
[in]abs_speciesWS Input
[in]speciesGeneric Input
[in]limit_lowGeneric Input (Default: "-Inf")
[in]limit_highGeneric Input (Default: "Inf")

Definition at line 103 of file m_oem.cc.

References i, Array< base >::nelem(), SpeciesTag::Species(), Species, _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and Tensor4Clip().

Referenced by vmr_fieldClip_g().

◆ x2artsAtmAndSurf()

void x2artsAtmAndSurf ( Workspace ws,
Tensor4 vmr_field,
Tensor3 t_field,
Tensor4 particle_bulkprop_field,
Tensor3 wind_u_field,
Tensor3 wind_v_field,
Tensor3 wind_w_field,
Tensor3 mag_u_field,
Tensor3 mag_v_field,
Tensor3 mag_w_field,
Tensor3 surface_props_data,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Vector x,
const Index atmfields_checked,
const Index atmgeom_checked,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const ArrayOfArrayOfSpeciesTag abs_species,
const Index cloudbox_on,
const Index cloudbox_checked,
const ArrayOfString particle_bulkprop_names,
const ArrayOfString surface_props_names,
const Agenda water_p_eq_agenda,
const Verbosity verbosity 
)

WORKSPACE METHOD: x2artsAtmAndSurf.

Maps x to atmospheric and surface variables.

Maps OEM's state vector, x, to the matching ARTS variables. This method handles atmospheric and surface variables. If you retrieve other variables, make sure that you also call x2artsSensor and/or x2artsSpectroscopy*.

The following retrieval quantities are handled by this method: <br> Temperature <br> Absorption species <br> Scattering species <br> Winds <br> Surface variables

Should only be used inside inversion_iterate_agenda.

Author
Patrick Eriksson
Parameters
[in,out]wsWorkspace
[in,out]vmr_fieldWS Input/Output
[in,out]t_fieldWS Input/Output
[in,out]particle_bulkprop_fieldWS Input/Output
[in,out]wind_u_fieldWS Input/Output
[in,out]wind_v_fieldWS Input/Output
[in,out]wind_w_fieldWS Input/Output
[in,out]mag_u_fieldWS Input/Output
[in,out]mag_v_fieldWS Input/Output
[in,out]mag_w_fieldWS Input/Output
[in,out]surface_props_dataWS Input/Output
[in]jacobian_quantitiesWS Input
[in]xWS Input
[in]atmfields_checkedWS Input
[in]atmgeom_checkedWS Input
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]abs_speciesWS Input
[in]cloudbox_onWS Input
[in]cloudbox_checkedWS Input
[in]particle_bulkprop_namesWS Input
[in]surface_props_namesWS Input
[in]water_p_eq_agendaWS Input

Definition at line 542 of file m_oem.cc.

References array_species_tag_from_string(), chk_contains(), get_gp_rq_to_atmgrids(), jac_ranges_indices(), joker, ConstTensor4View::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), ConstTensor4View::npages(), ConstTensor4View::nrows(), number_density(), q, r, regrid_atmfield_by_gp_oem(), reshape(), transform_x_back(), and water_p_eq_agendaExecute().

Referenced by x2artsAtmAndSurf_g().

◆ x2artsSensor()

void x2artsSensor ( Workspace ws,
Matrix sensor_los,
Vector f_backend,
Vector y_baseline,
Sparse sensor_response,
Vector sensor_response_f,
ArrayOfIndex sensor_response_pol,
Matrix sensor_response_dlos,
Vector sensor_response_f_grid,
ArrayOfIndex sensor_response_pol_grid,
Matrix sensor_response_dlos_grid,
Matrix mblock_dlos_grid,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Vector x,
const Agenda sensor_response_agenda,
const Index sensor_checked,
const Vector sensor_time,
const Verbosity verbosity 
)

WORKSPACE METHOD: x2artsSensor.

Maps x to sensor variables.

Maps OEM's state vector, x, to the matching ARTS variables. This method handles variables associated with the sensor. If you retrieve other variables, make sure that you also call x2artsAtmAndSurf <br> and/or x2artsSpectroscopy.

The following retrieval quantities are handled by this method: <br> Pointing <br> Frequency shift and stretch <br> Baseline fits

Should only be used inside inversion_iterate_agenda.

Elements in x representing pointing corrections are mapped to sensor_los*. Elements representing frequency corrections are mapped to f_backend. Baseline variables are mapped to y_baseline.

The sensor response is recalculated if there is any non-zero frequency correction.

Author
Patrick Eriksson
Parameters
[in,out]wsWorkspace
[in,out]sensor_losWS Input/Output
[in,out]f_backendWS Input/Output
[out]y_baselineWS Output
[in,out]sensor_responseWS Input/Output
[in,out]sensor_response_fWS Input/Output
[in,out]sensor_response_polWS Input/Output
[in,out]sensor_response_dlosWS Input/Output
[in,out]sensor_response_f_gridWS Input/Output
[in,out]sensor_response_pol_gridWS Input/Output
[in,out]sensor_response_dlos_gridWS Input/Output
[in,out]mblock_dlos_gridWS Input/Output
[in]jacobian_quantitiesWS Input
[in]xWS Input
[in]sensor_response_agendaWS Input
[in]sensor_checkedWS Input
[in]sensor_timeWS Input

Definition at line 912 of file m_oem.cc.

References i, jac_ranges_indices(), Array< base >::nelem(), ConstVectorView::nelem(), ConstMatrixView::nrows(), POINTING_MAINTAG, POINTING_SUBTAG_A, q, _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), transform_x_back(), and w().

Referenced by x2artsSensor_g().

◆ x2artsSpectroscopy()

void x2artsSpectroscopy ( const Verbosity verbosity)

WORKSPACE METHOD: x2artsSpectroscopy.

Just defined to indicate a future extensiom.

Don't call the method, it will just generate an error.

Author
Patrick Eriksson

Definition at line 1077 of file m_oem.cc.

References CovarianceMatrix::compute_inverse(), dx, i, inversion_iterate_agendaExecute(), mult(), n, ConstVectorView::nelem(), CovarianceMatrix::nrows(), OEM(), OEM_checks(), Vector::resize(), and Matrix::resize().

Referenced by x2artsSpectroscopy_g().

◆ xaStandard()

void xaStandard ( Workspace ws,
Vector xa,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Index atmfields_checked,
const Index atmgeom_checked,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor3 t_field,
const Tensor4 vmr_field,
const ArrayOfArrayOfSpeciesTag abs_species,
const Index cloudbox_on,
const Index cloudbox_checked,
const Tensor4 particle_bulkprop_field,
const ArrayOfString particle_bulkprop_names,
const Tensor3 wind_u_field,
const Tensor3 wind_v_field,
const Tensor3 wind_w_field,
const Tensor3 mag_u_field,
const Tensor3 mag_v_field,
const Tensor3 mag_w_field,
const Tensor3 surface_props_data,
const ArrayOfString surface_props_names,
const Agenda water_p_eq_agenda,
const Verbosity verbosity 
)

WORKSPACE METHOD: xaStandard.

Standard function for creating xa.

The method creates xa based on jacobian_quantities and the various atmospheric fields. In the case of scattering species, the data are taken from particle_bulkprop_field. The following retrieval quantities are handled: <br> Temperature <br> Absorption species <br> Scattering species <br> Pointing <br> Polynomial baseline fit <br> Sinusoidal baseline fit

Author
Patrick Eriksson
Parameters
[in,out]wsWorkspace
[out]xaWS Output
[in]jacobian_quantitiesWS Input
[in]atmfields_checkedWS Input
[in]atmgeom_checkedWS Input
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]t_fieldWS Input
[in]vmr_fieldWS Input
[in]abs_speciesWS Input
[in]cloudbox_onWS Input
[in]cloudbox_checkedWS Input
[in]particle_bulkprop_fieldWS Input
[in]particle_bulkprop_namesWS Input
[in]wind_u_fieldWS Input
[in]wind_v_fieldWS Input
[in]wind_w_fieldWS Input
[in]mag_u_fieldWS Input
[in]mag_v_fieldWS Input
[in]mag_w_fieldWS Input
[in]surface_props_dataWS Input
[in]surface_props_namesWS Input
[in]water_p_eq_agendaWS Input

Definition at line 176 of file m_oem.cc.

References array_species_tag_from_string(), chk_contains(), flat(), get_gp_atmgrids_to_rq(), i, jac_ranges_indices(), joker, ConstTensor3View::ncols(), Array< base >::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), number_density(), q, regrid_atmfield_by_gp(), Vector::resize(), and water_p_eq_agendaExecute().

Referenced by xaStandard_g().

◆ xClip()

void xClip ( Vector x,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Index ijq,
const Numeric limit_low,
const Numeric limit_high,
const Verbosity verbosity 
)

WORKSPACE METHOD: xClip.

Clipping of the state vector.

The method allows you to apply hard limits the values of a retrieval quantity. The retrieval quantity is specified by ijq*. All values of the quantity below limit_low, are simply set to limit_low. And the same is performed with respect to limit_high*. That is, the data in x for the retrieval quantity are forced to be inside the range [limit_low,limit_high].

Setting ijq=-1, is a shortcut for applying the limits on all retrieval quantities.

Notice that limits must be specified in the unit used in x.

Author
Patrick Eriksson
Parameters
[in,out]xWS Input/Output
[in]jacobian_quantitiesWS Input
[in]ijqGeneric Input
[in]limit_lowGeneric Input (Default: "-Inf")
[in]limit_highGeneric Input (Default: "Inf")

Definition at line 131 of file m_oem.cc.

References i, jac_ranges_indices(), Array< base >::nelem(), ConstVectorView::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().

Referenced by xClip_g().

Variable Documentation

◆ ABSSPECIES_MAINTAG

const String ABSSPECIES_MAINTAG

◆ FREQUENCY_MAINTAG

const String FREQUENCY_MAINTAG

◆ FREQUENCY_SUBTAG_0

const String FREQUENCY_SUBTAG_0

◆ FREQUENCY_SUBTAG_1

const String FREQUENCY_SUBTAG_1

◆ MAGFIELD_MAINTAG

const String MAGFIELD_MAINTAG

◆ POINTING_MAINTAG

const String POINTING_MAINTAG

Referenced by x2artsSensor().

◆ POINTING_SUBTAG_A

const String POINTING_SUBTAG_A

Referenced by x2artsSensor().

◆ POLYFIT_MAINTAG

const String POLYFIT_MAINTAG

◆ SCATSPECIES_MAINTAG

const String SCATSPECIES_MAINTAG

◆ SINEFIT_MAINTAG

const String SINEFIT_MAINTAG

◆ SURFACE_MAINTAG

const String SURFACE_MAINTAG

◆ TEMPERATURE_MAINTAG

const String TEMPERATURE_MAINTAG

◆ WIND_MAINTAG

const String WIND_MAINTAG