71 ShapeG0X0, ShapeG0X1, ShapeG0X2, ShapeG0X3,
72 ShapeD0X0, ShapeD0X1, ShapeD0X2, ShapeD0X3,
73 ShapeG2X0, ShapeG2X1, ShapeG2X2, ShapeG2X3,
74 ShapeD2X0, ShapeD2X1, ShapeD2X2, ShapeD2X3,
75 ShapeFVCX0, ShapeFVCX1, ShapeFVCX2, ShapeFVCX3,
76 ShapeETAX0, ShapeETAX1, ShapeETAX2, ShapeETAX3,
77 ShapeYX0, ShapeYX1, ShapeYX2, ShapeYX3,
78 ShapeGX0, ShapeGX1, ShapeGX2, ShapeGX3,
79 ShapeDVX0, ShapeDVX1, ShapeDVX2, ShapeDVX3,
80 ECS_SCALINGX0, ECS_SCALINGX1, ECS_SCALINGX2, ECS_SCALINGX3,
81 ECS_BETAX0, ECS_BETAX1, ECS_BETAX2, ECS_BETAX3,
82 ECS_LAMBDAX0, ECS_LAMBDAX1, ECS_LAMBDAX2, ECS_LAMBDAX3,
83 ECS_DCX0, ECS_DCX1, ECS_DCX2, ECS_DCX3,
88 "Either you have added some \"Line\" parameter(s) or changed the temperature model");
110 Type type{Type::FINAL};
116 Line line{Line::FINAL};
119 Sensor sensor{Sensor::FINAL};
122 Special special{Special::FINAL};
125 Numeric perturbation{std::numeric_limits<Numeric>::quiet_NaN()};
137 Species::Species species_id{Species::Species::FINAL};
140 explicit Target(Atm atype) : type(Type::Atm), atm(atype) {
147 Species::Species specid)
148 : type(Type::Line), line(ltype), qid(iqid), species_id(specid) {
153 explicit Target(Sensor stype) : type(Type::Sensor), sensor(stype) {
159 : type(Type::Special), special(stype), species_array_id(std::move(aostid)) {
160 ARTS_ASSERT(stype == Special::ArrayOfSpeciesTagVMR,
161 "Only for Special::ArrayOfSpeciesTagVMR, but you fed: ",
167 : type(Type::Special), special(stype), string_id(std::move(sid)) {
169 stype == Special::SurfaceString or stype == Special::ScatteringString,
170 "Only for Special::ScatteringString or Special::SurfaceString, but you fed: ",
178 bool operator==(Atm other)
const noexcept {
return other == atm; }
181 bool operator==(Line other)
const noexcept {
return other == line; }
184 bool operator==(Sensor other)
const noexcept {
return other == sensor; }
187 bool operator==(Special other)
const noexcept {
return other == special; }
190 bool operator==(Type other)
const noexcept {
return other == type; }
193 return type == other.type and atm == other.atm and
194 line == other.line and sensor == other.sensor and
195 special == other.special;
204 void TargetType(
const std::string_view& s)
noexcept { type = toType(s); }
210 sensor = Sensor::FINAL;
211 special = Special::FINAL;
221 sensor = toSensor(s);
224 special = toSpecial(s);
244 return "BAD SUBTYPE";
274 return line == Line::VMR or special == Special::ArrayOfSpeciesTagVMR;
278 [[nodiscard]]
bool isWind() const noexcept {
279 return atm == Atm::WindMagnitude or atm == Atm::WindU or
280 atm == Atm::WindV or atm == Atm::WindW;
285 return atm == Atm::MagneticMagnitude or atm == Atm::MagneticU or
286 atm == Atm::MagneticV or atm == Atm::MagneticW;
291 return sensor == Sensor::FrequencyStretch or
292 sensor == Sensor::FrequencyShift;
297 return sensor == Sensor::PointingZenithInterp or
298 sensor == Sensor::PointingZenithRecalc;
303 return type == Type::Line;
308 return special == Special::ArrayOfSpeciesTagVMR;
313 return special == Special::ScatteringString or
314 special == Special::SurfaceString;
353 mmode(std::move(mode)),
355 mjac(std::move(target)) {
478 return mjac == Jacobian::Type::Line or
479 mjac == Jacobian::Type::Atm or
480 mjac == Jacobian::Special::ArrayOfSpeciesTagVMR;
511 a.mjac.sameTargetType(
mjac);
547#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do) \
548 for (Index iq = 0; iq < jacobian_quantities.nelem(); iq++) { \
549 if (not(jacobian_quantities[iq] == Jacobian::Type::Sensor) and \
550 not(jacobian_quantities[iq] == Jacobian::Special::SurfaceString)) { \
555#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do) \
556 for (Index iq = 0; iq < jacobian_quantities.nelem(); iq++) { \
557 if (not(jacobian_quantities[iq] == Jacobian::Type::Sensor)) { \
586 const bool& before_affine =
false);
624 bool revert_functional_transforms =
true);
667 const String& p_retr_name,
668 const String& lat_retr_name,
669 const String& lon_retr_name,
704 const String& lat_retr_name,
705 const String& lon_retr_name,
724 const Index& atmosphere_dim,
744 const Index& atmosphere_dim,
825 const bool cloudbox_on);
841template <std::
size_t N>
843 static_assert(
N == 1 or
N == 2,
"FOR_ANALYTICAL_JACOBIANS_DO or FOR_ANALYTICAL_JACOBIANS_DO2");
905 const Index& mblock_index,
906 const Sparse& sensor_response,
908 const Vector& sensor_response_f_grid,
909 const Matrix& sensor_response_dlos_grid,
911 const Index rq_index,
This file contains the definition of Array.
Options for ARTS from enumeration (including error handling)
This file contains the class declaration of bifstream.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
A constant view of a Matrix.
bool empty() const noexcept
A constant view of a Tensor3.
A constant view of a Vector.
Deals with internal derivatives, Jacobian definition, and OEM calculations.
const Matrix & TransformationMatrix() const
bool operator==(const ArrayOfSpeciesTag &st) const noexcept
Return special type equality.
const Vector & Offset() const
bool is_wind() const noexcept
void Subtag(const String &st)
Sets the sub-tag.
const String & Mode() const
Returns the mode.
const String & TransformationFunc() const
bool operator==(Jacobian::Type other) const noexcept
Return special type equality.
void SetTransformationMatrix(const Matrix &A)
void Target(const Jacobian::Target &jac)
Set the Jacobian Target.
void SetTFuncParameters(const Vector &p)
Vector & TFuncParameters()
Matrix & Transformation()
Index nelem() const
Number of elements in the grids.
bool operator==(Jacobian::Special other) const noexcept
Return special type equality.
void QuantumIdentity(const QuantumIdentifier &qi)
Sets the identity of this Jacobian.
String & TransformationFunc()
void SetTransformationFunc(const String &s)
Transformation.
const Vector & TFuncParameters() const
Matrix transformation_matrix
const Vector & OffsetVector() const
const String & SubTag() const
Jacobian::Target & Target()
Get the Jacobian Target.
bool HasSameInternalsAs(const RetrievalQuantity &a) const
Checks that all the internal variables of *this match with those of the input.
const String & SubSubTag() const
void SubSubtag(const String &sst)
Sets the sub-sub-tag.
const String & SubSubtag() const
Returns the sub-sub-tag.
String transformation_func
const Matrix & Transformation() const
bool operator==(Jacobian::Line other) const noexcept
Return line type equality.
const QuantumIdentifier & QuantumIdentity() const
Returns the identity of this Jacobian.
void SetOffsetVector(const Vector &b)
RetrievalQuantity(Jacobian::Target target, String subtag, String subsubtag, String mode, const Numeric &perturbation, ArrayOfVector grids)
Constructor that sets the values.
bool is_mag() const noexcept
void Grids(const ArrayOfVector &g)
Sets the grids of the retrieval.
void Mode(const String &m)
Sets the mode.
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
bool operator==(Jacobian::Sensor other) const noexcept
Return sensor type equality.
const String & Subtag() const
Returns the sub-tag.
const Jacobian::Target & Target() const
Get the Jacobian Target.
bool operator==(Jacobian::Atm other) const noexcept
Return atm type equality.
bool propmattype() const noexcept
Returns if this is a propagation matrix type.
RetrievalQuantity()
Default constructor.
friend ostream & operator<<(ostream &os, const RetrievalQuantity &ot)
Jacobian::Line LineType() const noexcept
Return line type.
#define ARTS_ASSERT(condition,...)
constexpr std::string_view toString(EnergyLevelMapType x) noexcept
#define ENUMCLASS(ENUMTYPE, TYPE,...)
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
Header file for interpolation.cc.
void transform_x_back(Vector &x_t, const ArrayOfRetrievalQuantity &jqs, bool revert_functional_transforms=true)
Handles back-transformations of the state vector.
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.
bool species_iso_match(const RetrievalQuantity &rq, const Species::IsotopeRecord &ir)
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
ArrayOfIndex get_pointers_for_analytical_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
void vmrunitscf(Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
Scale factor for conversion between gas species units.
bool is_pressure_broadening_D0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D0 derivative.
bool supports_propmat_clearsky(const ArrayOfRetrievalQuantity &js)
Returns if the array supports propagation matrix derivatives.
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
bool is_pressure_broadening_Y(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a Y derivative.
bool do_line_center_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a line center derivative.
ArrayOfTensor3 get_standard_starting_diy_dx(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
void polynomial_basis_func(Vector &b, const Vector &x, const Index &poly_coeff)
Calculates polynomial basis functions.
bool supports_CIA(const ArrayOfRetrievalQuantity &js)
Returns if the array supports CIA derivatives.
bool is_pressure_broadening_DV(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a DV derivative.
Index do_analytical_jacobian(const ArrayOfRetrievalQuantity &jacobian_quantities)
Checks if analytical calculations are needed at all.
void transform_jacobian(Matrix &jacobian, const Vector x, const ArrayOfRetrievalQuantity &jqs)
Applies both functional and affine transformations.
bool is_pressure_broadening_G0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0 derivative.
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.
bool is_pressure_broadening_FVC(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a FVC derivative.
bool is_wind_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a wind parameter in propagation matrix calculations.
bool is_lineshape_parameter_X1(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X1 derivative.
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.
bool supports_relaxation_matrix(const ArrayOfRetrievalQuantity &js)
Returns if the array supports relaxation matrix derivatives.
bool supports_zeeman(const ArrayOfRetrievalQuantity &js)
Returns if the array supports Zeeman derivatives.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
bool is_pressure_broadening_D2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D2 derivative.
bool is_derived_magnetic_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a derived magnetic parameter.
bool supports_continuum(const ArrayOfRetrievalQuantity &js)
Returns if the array supports continuum derivatives.
bool is_pressure_broadening_G(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G derivative.
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.
bool do_magnetic_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a magnetic derivative.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
ArrayOfTensor3 get_standard_diy_dpath(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
bool supports_hitran_xsec(const ArrayOfRetrievalQuantity &js)
Returns if the array supports HITRAN cross-section derivatives.
bool supports_lookup(const ArrayOfRetrievalQuantity &js)
Returns if the array supports lookup table derivatives.
ArrayOfIndex get_pointers_for_scat_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &scat_species, const bool cloudbox_on)
Help function for analytical jacobian calculations.
bool is_lineshape_parameter_X2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X2 derivative.
bool is_pressure_broadening_G2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0 derivative.
bool is_pressure_broadening_ETA(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a ETA derivative.
Numeric magnetic_field_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the magnetic field perturbation if it exists.
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.
String propmattype_string(const RetrievalQuantity &rq)
Returns a string of the retrieval quantity propagation matrix type.
bool is_nlte_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a NLTE parameter.
#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do)
bool do_wind_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a wind-based frequency derivative derivative.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
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.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
jacobianVMRcheck do_vmr_jacobian(const ArrayOfRetrievalQuantity &js, const QuantumIdentifier &line_qid) noexcept
Returns the required info for VMR Jacobian.
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
void jacobian_type_extrapol(ArrayOfGridPos &gp)
Adopts grid positions to extrapolation used for jacobians.
bool is_lineshape_parameter_X0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X0 derivative.
void transform_x(Vector &x, const ArrayOfRetrievalQuantity &jqs)
Handles transformations of the state vector.
bool supports_faraday(const ArrayOfRetrievalQuantity &js)
Returns if the array supports Faraday derivatives.
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.
bool is_lineshape_parameter_bar_linemixing(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC derivative.
bool is_line_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is related to the absorption line.
Header file for logic.cc.
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declaration of the class MdRecord.
This file contains the definition of String, the ARTS string class.
std::ostream & operator<<(std::ostream &os, const Target &x)
Particulates ENUMCLASS(Line, char, VMR, Strength, Center, ShapeG0X0, ShapeG0X1, ShapeG0X2, ShapeG0X3, ShapeD0X0, ShapeD0X1, ShapeD0X2, ShapeD0X3, ShapeG2X0, ShapeG2X1, ShapeG2X2, ShapeG2X3, ShapeD2X0, ShapeD2X1, ShapeD2X2, ShapeD2X3, ShapeFVCX0, ShapeFVCX1, ShapeFVCX2, ShapeFVCX3, ShapeETAX0, ShapeETAX1, ShapeETAX2, ShapeETAX3, ShapeYX0, ShapeYX1, ShapeYX2, ShapeYX3, ShapeGX0, ShapeGX1, ShapeGX2, ShapeGX3, ShapeDVX0, ShapeDVX1, ShapeDVX2, ShapeDVX3, ECS_SCALINGX0, ECS_SCALINGX1, ECS_SCALINGX2, ECS_SCALINGX3, ECS_BETAX0, ECS_BETAX1, ECS_BETAX2, ECS_BETAX3, ECS_LAMBDAX0, ECS_LAMBDAX1, ECS_LAMBDAX2, ECS_LAMBDAX3, ECS_DCX0, ECS_DCX1, ECS_DCX2, ECS_DCX3, NLTE) static_assert(Index(Line ArrayOfSpeciesTagVMR
Particulates ENUMCLASS(Line, char, VMR, Strength, Center, ShapeG0X0, ShapeG0X1, ShapeG0X2, ShapeG0X3, ShapeD0X0, ShapeD0X1, ShapeD0X2, ShapeD0X3, ShapeG2X0, ShapeG2X1, ShapeG2X2, ShapeG2X3, ShapeD2X0, ShapeD2X1, ShapeD2X2, ShapeD2X3, ShapeFVCX0, ShapeFVCX1, ShapeFVCX2, ShapeFVCX3, ShapeETAX0, ShapeETAX1, ShapeETAX2, ShapeETAX3, ShapeYX0, ShapeYX1, ShapeYX2, ShapeYX3, ShapeGX0, ShapeGX1, ShapeGX2, ShapeGX3, ShapeDVX0, ShapeDVX1, ShapeDVX2, ShapeDVX3, ECS_SCALINGX0, ECS_SCALINGX1, ECS_SCALINGX2, ECS_SCALINGX3, ECS_BETAX0, ECS_BETAX1, ECS_BETAX2, ECS_BETAX3, ECS_LAMBDAX0, ECS_LAMBDAX1, ECS_LAMBDAX2, ECS_LAMBDAX3, ECS_DCX0, ECS_DCX1, ECS_DCX2, ECS_DCX3, NLTE) static_assert(Index(Line ScatteringString
Holds all information required for individual partial derivatives.
bool isFrequency() const noexcept
Special frequency case.
void TargetType(const std::string_view &s) noexcept
Sets target based on a string.
bool isMagnetic() const noexcept
Special magnetic field case.
Numeric perturbation
Perturbations for methods where theoretical computations are impossible or plain slow.
bool operator==(Special other) const noexcept
Checks if the type of jacobian is the input sensor parameter.
Target(Sensor stype)
Sensor type.
Target(Special stype, String sid)
Special type.
bool isSpeciesVMR() const noexcept
Special species case.
bool isPointing() const noexcept
Special pointing case.
bool needArrayOfSpeciesTag() const noexcept
Does this type need the ArrayOfSpeciesTag?
void TargetSubType(const std::string_view &s) noexcept
Sets sub target based on a string.
std::string_view TargetSubType() const noexcept
bool TargetSubTypeOK() const noexcept
Are we good?
Line line
Type of line quantity.
ArrayOfSpeciesTag species_array_id
ID for some of the Special types of partial derivatives.
bool operator==(Type other) const noexcept
Checks if the type is correct.
bool sameTargetType(const Target &other) const noexcept
std::string_view TargetType() const noexcept
Return type as string.
bool operator==(Line other) const noexcept
Checks if the type of jacobian is the input line parameter.
bool operator==(Sensor other) const noexcept
Checks if the type of jacobian is the input sensor parameter.
bool needString() const noexcept
Does this type need the String?
QuantumIdentifier qid
ID for the Line types of partial derivatives.
Target(Line ltype, const QuantumIdentifier &iqid, Species::Species specid)
Line type.
Target(Special stype, ArrayOfSpeciesTag aostid)
Special type.
bool TargetTypeOK() const noexcept
Are we good?
Target(Atm atype)
Atmospheric type.
bool operator==(Atm other) const noexcept
Checks if the type of jacobian is the input atmospheric parameter.
Target()=default
A defaultable none-type.
bool isWind() const noexcept
Special wind case.
bool needQuantumIdentity() const noexcept
Does this type need the QuantumIdentifier?
The structure to describe a propagation path and releated quantities.
A logical struct for global quantum numbers with species identifiers.
Struct containing all information needed about one isotope.
Deals with whether or not we should do a VMR derivative.
const QuantumIdentifier & qid