ARTS 2.5.4 (git: 31ce4f0e)
m_predefined_absorption_models.cc
Go to the documentation of this file.
1/* Copyright (C) 2020
2 * Richard Larsson <ric.larsson@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA. */
18
27#include <algorithm>
28
29#include "debug.h"
30#include "logic.h"
31#include "predefined/predef_data.h"
33
34void predefined_model_dataInit(PredefinedModelData& predefined_model_data,
35 const Verbosity&) {
36 predefined_model_data = PredefinedModelData{};
37}
38
40 PredefinedModelData& predefined_model_data,
41 const Vector& self_absco_ref,
42 const Vector& for_absco_ref,
43 const Vector& wavenumbers,
44 const Vector& self_texp,
45 const Verbosity&) {
46 const auto sz = self_absco_ref.size();
47
49 sz not_eq for_absco_ref.size() or sz not_eq wavenumbers.size() or
50 sz not_eq self_texp.size(),
51 "Mismatching size, all vector inputs must be the same length")
52 ARTS_USER_ERROR_IF(sz < 4, "It makes no sense to have input shorter than 4")
54 "The wavenumbers must be increasing in a regular manner")
55
56 Absorption::PredefinedModel::Hitran::MTCKD::WaterData x;
57 x.self_absco_ref.resize(sz);
58 x.for_absco_ref.resize(sz);
59 x.wavenumbers.resize(sz);
60 x.self_texp.resize(sz);
61
63 self_absco_ref.begin(), self_absco_ref.end(), x.self_absco_ref.begin());
65 for_absco_ref.begin(), for_absco_ref.end(), x.for_absco_ref.begin());
66 std::copy(wavenumbers.begin(), wavenumbers.end(), x.wavenumbers.begin());
67 std::copy(self_texp.begin(), self_texp.end(), x.self_texp.begin());
68
69 predefined_model_data.set(std::move(x));
70}
71
72/* Workspace method: Doxygen documentation will be auto-generated */
74 PropagationMatrix& propmat_clearsky,
75 ArrayOfPropagationMatrix& dpropmat_clearsky_dx,
76 const PredefinedModelData& predefined_model_data,
77 const ArrayOfArrayOfSpeciesTag& abs_species,
78 const ArrayOfSpeciesTag& select_abs_species,
79 const ArrayOfRetrievalQuantity& jacobian_quantities,
80 const Vector& f_grid,
81 const Numeric& rtp_pressure,
82 const Numeric& rtp_temperature,
83 const Vector& rtp_vmr,
84 const Verbosity&) {
85 // Forward simulations and their error handling
86 ARTS_USER_ERROR_IF(rtp_vmr.nelem() not_eq abs_species.nelem(),
87 "Mismatch dimensions on species and VMR inputs");
89 propmat_clearsky.NumberOfFrequencies() not_eq f_grid.nelem(),
90 "Mismatch dimensions on internal matrices of xsec and frequency");
91
92 // Derivatives and their error handling
93 if (dpropmat_clearsky_dx.nelem()) {
95 dpropmat_clearsky_dx.nelem() not_eq jacobian_quantities.nelem(),
96 "Mismatch dimensions on xsec derivatives and Jacobian grids");
98 std::any_of(dpropmat_clearsky_dx.cbegin(),
99 dpropmat_clearsky_dx.cend(),
100 [&f_grid](auto& x) {
101 return x.NumberOfFrequencies() not_eq f_grid.nelem();
102 }),
103 "Mismatch dimensions on internal matrices of xsec derivatives and frequency");
104 }
105
106 const Absorption::PredefinedModel::VMRS vmr(abs_species, rtp_vmr);
107 for (auto& tag_groups : abs_species) {
108 if (select_abs_species.nelem() and select_abs_species not_eq tag_groups)
109 continue;
110 for (auto& tag : tag_groups) {
112 dpropmat_clearsky_dx,
113 tag.Isotopologue(),
114 f_grid,
115 rtp_pressure,
116 rtp_temperature,
117 vmr,
118 jacobian_quantities,
119 predefined_model_data);
120 }
121 }
122}
This can be used to make arrays out of anything.
Definition: array.h:48
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:536
Index size() const noexcept
Definition: matpackI.h:539
Index NumberOfFrequencies() const
The number of frequencies of the propagation matrix.
Iterator1D begin() ARTS_NOEXCEPT
Return iterator to first element.
Definition: matpackI.cc:144
Iterator1D end() ARTS_NOEXCEPT
Return iterator behind last element.
Definition: matpackI.cc:148
The Vector class.
Definition: matpackI.h:899
Helper macros for debugging.
#define ARTS_USER_ERROR_IF(condition,...)
Definition: debug.h:134
bool is_regularly_increasing_within_epsilon(ConstVectorView x, const Numeric epsilon)
Definition: logic.cc:374
Header file for logic.cc.
void predefined_model_dataAddHitranMTCKD(PredefinedModelData &predefined_model_data, const Vector &self_absco_ref, const Vector &for_absco_ref, const Vector &wavenumbers, const Vector &self_texp, const Verbosity &)
WORKSPACE METHOD: predefined_model_dataAddHitranMTCKD.
void propmat_clearskyAddPredefined(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const PredefinedModelData &predefined_model_data, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfSpeciesTag &select_abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const Vector &rtp_vmr, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyAddPredefined.
void predefined_model_dataInit(PredefinedModelData &predefined_model_data, const Verbosity &)
WORKSPACE METHOD: predefined_model_dataInit.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
void compute(PropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const SpeciesIsotopeRecord &model, const Vector &f_grid, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const VMRS &vmr, const ArrayOfRetrievalQuantity &jacobian_quantities, const PredefinedModelData &predefined_model_data)
Compute the predefined model.
Contains known required VMR values.