41 return os <<
"\n Target = " << ot.
Target()
42 <<
"\n Sub tag = " << ot.
Subtag()
43 <<
"\n Mode = " << ot.
Mode();
49 const bool& before_affine) {
50 jis.resize(jqs.
nelem());
59 jis[i][0] = jis[i - 1][1] + 1;
64 jis[i][1] = jis[i][0] + jq.
nelem() - 1;
76 jis[i][0] = jis[i - 1][1] + 1;
85 jis[i][1] = jis[i][0] + jq.
nelem() - 1;
110 }
else if (tfun ==
"log") {
111 for (
Index c = jis[i][0];
c <= jis[i][1]; ++
c) {
112 jacobian(
joker,
c) *= exp(x_t[
c]);
114 }
else if (tfun ==
"log10") {
115 for (
Index c = jis[i][0];
c <= jis[i][1]; ++
c) {
118 }
else if (tfun ==
"atanh") {
120 for (
Index c = jis[i][0];
c <= jis[i][1]; ++
c) {
122 2 * (pars[1] - pars[0]) /
pow(exp(-x_t[
c]) + exp(x_t[
c]), 2.0);
134 Matrix jacobian_t(jacobian.
nrows(), jis_t.back()[1] + 1);
138 Index col_start = jis[i][0];
139 Index col_extent = jis[i][1] - jis[i][0] + 1;
140 Range col_range(col_start, col_extent);
141 Index col_start_t = jis_t[i][0];
142 Index col_extent_t = jis_t[i][1] - jis_t[i][0] + 1;
143 Range col_range_t(col_start_t, col_extent_t);
146 jacobian(
joker, col_range),
149 jacobian_t(
joker, col_range_t) = jacobian(
joker, col_range);
152 swap(jacobian_t, jacobian);
170 }
else if (tfun ==
"log") {
172 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
174 "log-transformation selected for retrieval quantity with\n"
175 "index ", i,
" (0-based), but at least one value <= z_min\n"
176 "found for this quantity. This is not allowed.")
177 x[r] = log(x[r] - pars[0]);
179 }
else if (tfun ==
"log10") {
181 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
183 "log10-transformation selected for retrieval quantity with\n"
184 "index ", i,
" (0-based), but at least one value <= z_min\n"
185 "found for this quantity. This is not allowed.")
186 x[r] = log10(x[r] - pars[0]);
188 }
else if (tfun ==
"atanh") {
190 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
192 "atanh-transformation selected for retrieval quantity with\n"
193 "index ", i,
" (0-based), but at least one value <= z_min\n"
194 "found for this quantity. This is not allowed.")
196 "atanh-transformation selected for retrieval quantity with\n"
197 "index ", i,
" (0-based), but at least one value is\n"
198 ">= z_max. This is not allowed.")
199 x[r] = atanh(2 * (x[r] - pars[0]) / (pars[1] - pars[0]) - 1);
211 Vector x_t(jis_t.back()[1] + 1);
215 Index col_start = jis[i][0];
216 Index col_extent = jis[i][1] - jis[i][0] + 1;
217 Range col_range(col_start, col_extent);
218 Index col_start_t = jis_t[i][0];
219 Index col_extent_t = jis_t[i][1] - jis_t[i][0] + 1;
220 Range col_range_t(col_start_t, col_extent_t);
226 x_t[col_range_t] = x[col_range];
235 bool revert_functional_transforms) {
248 Vector x(jis.back()[1] + 1);
252 Index col_start = jis[i][0];
253 Index col_extent = jis[i][1] - jis[i][0] + 1;
254 Range col_range(col_start, col_extent);
255 Index col_start_t = jis_t[i][0];
256 Index col_extent_t = jis_t[i][1] - jis_t[i][0] + 1;
257 Range col_range_t(col_start_t, col_extent_t);
262 x[col_range] = x_t[col_range_t];
268 if (revert_functional_transforms) {
276 }
else if (tfun ==
"log") {
278 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
279 x_t[r] = pars[0] + exp(x_t[r]);
281 }
else if (tfun ==
"log10") {
283 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
284 x_t[r] = pars[0] +
pow(10.0, x_t[r]);
286 }
else if (tfun ==
"atanh") {
288 for (
Index r = jis[i][0]; r <= jis[i][1]; ++r) {
289 x_t[r] = pars[0] + ((pars[1] - pars[0]) / 2) * (1 + tanh(x_t[r]));
306 for (
Index irow = 0; irow < diy_dx.
nrows(); irow++) {
307 for (
Index icol = 0; icol < diy_dx.
ncols(); icol++) {
308 diy_dx(irow, icol) +=
w * diy_dq(irow, icol);
316 const Index& atmosphere_dim,
323 const Numeric extpolfac = 1.0e99;
331 p2gridpos(gp_p, jacobian_quantity.
Grids()[0], ppath_p, extpolfac);
340 if (atmosphere_dim > 1) {
341 gp_lat.resize(ppath.
np);
342 nr2 = jacobian_quantity.
Grids().empty() ? 0 : jacobian_quantity.
Grids()[1].
nelem();
345 jacobian_quantity.
Grids()[1],
356 if (atmosphere_dim > 2) {
358 gp_lon.resize(ppath.
np);
361 jacobian_quantity.
Grids()[2],
371 if (atmosphere_dim == 1) {
372 for (
Index ip = 0; ip < ppath.
np; ip++) {
373 if (gp_p[ip].fd[1] > 0) {
378 if (gp_p[ip].fd[0] > 0) {
387 else if (atmosphere_dim == 2) {
388 for (
Index ip = 0; ip < ppath.
np; ip++) {
389 Index ix = nr1 * gp_lat[ip].idx + gp_p[ip].idx;
391 if (gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[1] > 0)
394 gp_lat[ip].fd[1] * gp_p[ip].fd[1]);
396 if (gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[0] > 0)
399 gp_lat[ip].fd[1] * gp_p[ip].fd[0]);
401 if (gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[1] > 0)
404 gp_lat[ip].fd[0] * gp_p[ip].fd[1]);
406 if (gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[0] > 0)
409 gp_lat[ip].fd[0] * gp_p[ip].fd[0]);
414 else if (atmosphere_dim == 3) {
415 for (
Index ip = 0; ip < ppath.
np; ip++) {
417 nr2 * nr1 * gp_lon[ip].idx + nr1 * gp_lat[ip].idx + gp_p[ip].idx;
419 if (gp_lon[ip].fd[1] > 0 && gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[1] > 0)
423 gp_lon[ip].fd[1] * gp_lat[ip].fd[1] * gp_p[ip].fd[1]);
425 if (gp_lon[ip].fd[1] > 0 && gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[0] > 0)
429 gp_lon[ip].fd[1] * gp_lat[ip].fd[1] * gp_p[ip].fd[0]);
431 if (gp_lon[ip].fd[1] > 0 && gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[1] > 0)
435 gp_lon[ip].fd[1] * gp_lat[ip].fd[0] * gp_p[ip].fd[1]);
437 if (gp_lon[ip].fd[1] > 0 && gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[0] > 0)
441 gp_lon[ip].fd[1] * gp_lat[ip].fd[0] * gp_p[ip].fd[0]);
447 if (gp_lon[ip].fd[0] > 0 && gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[1] > 0)
451 gp_lon[ip].fd[0] * gp_lat[ip].fd[1] * gp_p[ip].fd[1]);
453 if (gp_lon[ip].fd[0] > 0 && gp_lat[ip].fd[1] > 0 && gp_p[ip].fd[0] > 0)
457 gp_lon[ip].fd[0] * gp_lat[ip].fd[1] * gp_p[ip].fd[0]);
459 if (gp_lon[ip].fd[0] > 0 && gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[1] > 0)
463 gp_lon[ip].fd[0] * gp_lat[ip].fd[0] * gp_p[ip].fd[1]);
465 if (gp_lon[ip].fd[0] > 0 && gp_lat[ip].fd[0] > 0 && gp_p[ip].fd[0] > 0)
469 gp_lon[ip].fd[0] * gp_lat[ip].fd[0] * gp_p[ip].fd[0]);
478 const Index& atmosphere_dim,
486 const Numeric extpolfac = 1.0e99;
489 if (atmosphere_dim == 1) {
502 jacobian_quantity.
Grids()[0],
513 if (atmosphere_dim > 2) {
515 if (jacobian_quantity.
Grids()[1].
nelem() > 1) {
517 jacobian_quantity.
Grids()[1],
527 if (atmosphere_dim == 2) {
528 if (gp_lat[0].fd[1] > 0) {
533 if (gp_lat[0].fd[0] > 0) {
541 Index ix = nr1 * gp_lon[0].idx + gp_lat[0].idx;
543 if (gp_lon[0].fd[1] > 0 && gp_lat[0].fd[1] > 0)
546 gp_lon[0].fd[1] * gp_lat[0].fd[1]);
548 if (gp_lon[0].fd[1] > 0 && gp_lat[0].fd[0] > 0)
551 gp_lon[0].fd[1] * gp_lat[0].fd[0]);
553 if (gp_lon[0].fd[0] > 0 && gp_lat[0].fd[1] > 0)
556 gp_lon[0].fd[0] * gp_lat[0].fd[1]);
558 if (gp_lon[0].fd[0] > 0 && gp_lat[0].fd[0] > 0)
561 gp_lon[0].fd[0] * gp_lat[0].fd[0]);
570 if (jacobian_quantities[iq] == Jacobian::Line::VMR) {
571 auto p = std::find_if(abs_species.cbegin(), abs_species.cend(),
572 [qid=jacobian_quantities[iq].QuantumIdentity()](
auto& specs){
573 return std::any_of(specs.cbegin(), specs.cend(),
574 [qid](auto& spec){return qid.Isotopologue() == spec.Isotopologue();});
576 if (p not_eq abs_species.cend()) {
577 aoi[iq] =
Index(abs_species.cend() - p);
581 jacobian_quantities[iq].Subtag(),
582 " in species of abs_species.\n")
584 }
else if (jacobian_quantities[iq] == Jacobian::Special::ArrayOfSpeciesTagVMR) {
586 aoi[iq] =
chk_contains(
"abs_species", abs_species, atag);
587 }
else if (jacobian_quantities[iq] == Jacobian::Atm::Particulates) {
589 }
else if (jacobian_quantities[iq] == Jacobian::Atm::Electrons) {
600 const Index nn = active ? np * nf : nf;
613 const Index nn = active ? np * nf : nf;
621 const bool cloudbox_on) {
625 if (cloudbox_on and jacobian_quantities[iq] == Jacobian::Special::ScatteringString) {
626 aoi[iq] =
find_first(scat_species, jacobian_quantities[iq].Subtag());
628 "Jacobian quantity with index ", iq,
" refers to\n"
629 " ", jacobian_quantities[iq].Subtag(),
630 "\nbut this species could not be found in *scat_species*.")
649 const String& p_retr_name,
650 const String& lat_retr_name,
651 const String& lon_retr_name,
655 if (p_retr.
nelem() == 0) {
656 os <<
"The grid vector *" << p_retr_name <<
"* is empty,"
657 <<
" at least one pressure level\n"
658 <<
"should be specified.";
661 os <<
"The pressure grid vector *" << p_retr_name <<
"* is not a\n"
662 <<
"strictly decreasing vector, which is required.";
665 if (p_grid[0] not_eq p_retr[0]) {
666 os <<
"Mismatching 1-long grids for " << p_retr_name;
672 }
else if (log(p_retr[0]) > 1.5 * log(p_grid[0]) - 0.5 * log(p_grid[1]) ||
673 log(p_retr[p_retr.
nelem() - 1]) <
674 1.5 * log(p_grid[p_grid.
nelem() - 1]) -
675 0.5 * log(p_grid[p_grid.
nelem() - 2])) {
676 os <<
"The grid vector *" << p_retr_name <<
"* is not covered by the\n"
677 <<
"corresponding atmospheric grid.";
686 if (lat_retr.
nelem() == 0) {
687 os <<
"The grid vector *" << lat_retr_name <<
"* is empty,"
688 <<
" at least one latitude\n"
689 <<
"should be specified for a 2D/3D atmosphere.";
692 os <<
"The latitude grid vector *" << lat_retr_name <<
"* is not a\n"
693 <<
"strictly increasing vector, which is required.";
695 }
else if (lat_grid.
nelem() == 1 and lat_grid.
nelem() == lat_retr.
nelem()) {
696 if (lat_grid[0] not_eq lat_retr[0]) {
697 os <<
"Mismatching 1-long grids for " << lat_retr_name;
703 }
else if (lat_retr[0] < 1.5 * lat_grid[0] - 0.5 * lat_grid[1] ||
704 lat_retr[lat_retr.
nelem() - 1] >
705 1.5 * lat_grid[lat_grid.
nelem() - 1] -
706 0.5 * lat_grid[lat_grid.
nelem() - 2]) {
707 os <<
"The grid vector *" << lat_retr_name <<
"* is not covered by the\n"
708 <<
"corresponding atmospheric grid.";
716 if (lon_retr.
nelem() == 0) {
717 os <<
"The grid vector *" << lon_retr_name <<
"* is empty,"
718 <<
" at least one longitude\n"
719 <<
"should be specified for a 3D atmosphere.";
722 os <<
"The longitude grid vector *" << lon_retr_name <<
"* is not a\n"
723 <<
"strictly increasing vector, which is required.";
725 }
else if (lon_grid.
nelem() == 1 and
727 if (lon_grid[0] not_eq lon_retr[0]) {
728 os <<
"Mismatching 1-long grids for " << lon_retr_name;
734 }
else if (lon_retr[0] < 1.5 * lon_grid[0] - 0.5 * lon_grid[1] ||
735 lon_retr[lon_retr.
nelem() - 1] >
736 1.5 * lon_grid[lon_grid.
nelem() - 1] -
737 0.5 * lon_grid[lon_grid.
nelem() - 2]) {
738 os <<
"The grid vector *" << lon_retr_name
739 <<
"* is not covered by the\n"
740 <<
"corresponding atmospheric grid.";
757 const String& lat_retr_name,
758 const String& lon_retr_name,
770 if (lat_retr.
nelem() == 0) {
771 os <<
"The grid vector *" << lat_retr_name <<
"* is empty,"
772 <<
" at least one latitude\n"
773 <<
"should be specified for a 2D/3D atmosphere.";
776 os <<
"The latitude grid vector *" << lat_retr_name <<
"* is not a\n"
777 <<
"strictly increasing vector, which is required.";
779 }
else if (lat_grid.
nelem() == 1 and lat_grid.
nelem() == lat_retr.
nelem()) {
780 if (lat_grid[0] not_eq lat_retr[0]) {
781 os <<
"Mismatching 1-long grids for " << lat_retr_name;
787 }
else if (lat_retr[0] < 1.5 * lat_grid[0] - 0.5 * lat_grid[1] ||
788 lat_retr[lat_retr.
nelem() - 1] >
789 1.5 * lat_grid[lat_grid.
nelem() - 1] -
790 0.5 * lat_grid[lat_grid.
nelem() - 2]) {
791 os <<
"The grid vector *" << lat_retr_name <<
"* is not covered by the\n"
792 <<
"corresponding atmospheric grid.";
801 if (lon_retr.
nelem() == 0) {
802 os <<
"The grid vector *" << lon_retr_name <<
"* is empty,"
803 <<
" at least one longitude\n"
804 <<
"should be specified for a 3D atmosphere.";
807 os <<
"The longitude grid vector *" << lon_retr_name <<
"* is not a\n"
808 <<
"strictly increasing vector, which is required.";
810 }
else if (lon_grid.
nelem() == 1 and
812 if (lon_grid[0] not_eq lon_retr[0]) {
813 os <<
"Mismatching 1-long grids for " << lon_retr_name;
819 }
else if (lon_retr[0] < 1.5 * lon_grid[0] - 0.5 * lon_grid[1] ||
820 lon_retr[lon_retr.
nelem() - 1] >
821 1.5 * lon_grid[lon_grid.
nelem() - 1] -
822 0.5 * lon_grid[lon_grid.
nelem() - 2]) {
823 os <<
"The grid vector *" << lon_retr_name
824 <<
"* is not covered by the\n"
825 <<
"corresponding atmospheric grid.";
838 if (gp[i].fd[0] < 0) {
841 }
else if (gp[i].fd[0] > 1) {
850 const Index& poly_coeff) {
855 if (
b.nelem() != l)
b.resize(l);
857 if (poly_coeff == 0) {
863 for (
Index i = 0; i < l; i++) {
864 b[i] = (x[i] - xmin) / dx - 1.0;
865 b[i] =
pow(
b[i],
int(poly_coeff));
874 const Index& mblock_index,
875 const Sparse& sensor_response,
877 const Vector& sensor_response_f_grid,
878 const Matrix& sensor_response_dlos_grid,
880 const Index rq_index,
882 bool is_sine_fit =
false;
883 if (rq == Jacobian::Sensor::Polyfit) {
885 }
else if (rq == Jacobian::Sensor::Sinefit) {
889 "Retrieval quantity is neither a polynomial or a sine "
895 const Index nf = sensor_response_f_grid.
nelem();
896 const Index npol = sensor_response_pol_grid.
nelem();
897 const Index nlos = sensor_response_dlos_grid.
nrows();
905 for (
Index f = 0; f < nf; f++) {
906 Numeric a = (sensor_response_f_grid[f] - sensor_response_f_grid[0]) * 2 *
914 w, sensor_response_f_grid,
static_cast<Index>(poly_coeff));
924 Index col4 = jacobian_indices[rq_index][0];
927 col4 += mblock_index * n2 * n1;
930 for (
Index l = 0; l < nlos; l++) {
931 const Index row3 = row4 + l * nf * npol;
932 const Index col3 = col4 + l * n1 * (is_sine_fit ? 2 : 1);
934 for (
Index f = 0; f < nf; f++) {
935 const Index row2 = row3 + f * npol;
937 for (
Index p = 0; p < npol; p++) {
943 y_baseline[row2 + p] += x[col1] * s[f] + x[col1 + 1] *
c[f];
945 y_baseline[row2 + p] +=
w[f] * x[col1];
957 if (unit ==
"rel" || unit ==
"logrel") {
959 }
else if (unit ==
"vmr") {
965 }
else if (unit ==
"nd") {
973 "Allowed options for gas species jacobians are "
974 "\"rel\", \"vmr\" and \"nd\".\nYou have selected: ",
984 if (unit ==
"rel" || unit ==
"logrel") {
986 }
else if (unit ==
"vmr") {
988 }
else if (unit ==
"nd") {
992 "Allowed options for gas species jacobians are "
993 "\"rel\", \"vmr\" and \"nd\".\nYou have selected: ",
1003 return t.Target().isWind();
1007 return t.Target().isWind() or t.Target().isFrequency();
1011 return t == Jacobian::Atm::MagneticMagnitude;
1015 return t == Jacobian::Line::NLTE;
1018#define ISLINESHAPETYPE(X) \
1019 bool is_pressure_broadening_##X(const RetrievalQuantity& t) noexcept { \
1020 return t == Jacobian::Line::Shape##X##X0 or \
1021 t == Jacobian::Line::Shape##X##X1 or \
1022 t == Jacobian::Line::Shape##X##X2 or \
1023 t == Jacobian::Line::Shape##X##X3; \
1034#undef ISLINESHAPETYPE
1036#define VARISLINESHAPEPARAM(X, Y) (t == Jacobian::Line::Shape##X##Y)
1068#undef VARISLINESHAPEPARAM
1086 return t == Jacobian::Type::Line;
1090 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return (j == Jacobian::Atm::Temperature or j == Jacobian::Special::ArrayOfSpeciesTagVMR or j == Jacobian::Line::VMR or is_frequency_parameter(j));});
1094 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return (j == Jacobian::Atm::Temperature or j == Jacobian::Line::VMR or j == Jacobian::Special::ArrayOfSpeciesTagVMR or is_frequency_parameter(j));});
1098 ARTS_USER_ERROR_IF (std::any_of(js.cbegin(), js.cend(), [](
auto& j){return is_line_parameter(j);}),
1099 "Line specific parameters are not supported while using continuum tags.\nWe do not track what lines are in the continuum.\n")
1100 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return (j == Jacobian::Atm::Temperature or j == Jacobian::Special::ArrayOfSpeciesTagVMR or is_frequency_parameter(j));});
1104 ARTS_USER_ERROR_IF (std::any_of(js.cbegin(), js.cend(), [](
auto& j){return is_line_parameter(j);}),
1105 "Line specific parameters are not supported while\n using the relaxation matrix line mixing routine.\n We do not yet track individual lines in the relaxation matrix calculations.\n")
1106 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return (j == Jacobian::Atm::Temperature or is_frequency_parameter(j));});
1110 ARTS_USER_ERROR_IF (std::any_of(js.cbegin(), js.cend(), [](
auto& j){return is_line_parameter(j);}),
1111 "Line specific parameters are not supported while using Lookup table.\nWe do not track lines in the Lookup.\n")
1112 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return (j == Jacobian::Atm::Temperature or j == Jacobian::Special::ArrayOfSpeciesTagVMR or is_frequency_parameter(j));});
1116 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return not (j == Jacobian::Type::Sensor);});
1120 if (rq == Jacobian::Line::VMR) {
1121 for (
auto& st : ast) {
1151 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return j == Jacobian::Atm::Temperature;});
1156 auto p = std::find_if(js.cbegin(), js.cend(), [&line_qid](
auto& j) {
1157 return j == Jacobian::Line::VMR
1158 and j.QuantumIdentity().Species() == line_qid.Species()
1159 and j.QuantumIdentity().Isotopologue() == line_qid.Isotopologue();}
1161 if (p not_eq js.cend())
1162 return {
true, p -> QuantumIdentity()};
1164 return {
false, line_qid};
1168 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return j == Jacobian::Line::Center;});
1172 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return is_wind_parameter(j);});
1176 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return is_frequency_parameter(j);});
1180 return std::any_of(js.cbegin(), js.cend(), [](
auto& j){return j.is_mag();});
1184 auto p = std::find_if(js.cbegin(), js.cend(), [](
auto& j){return j == Jacobian::Atm::Temperature;});
1185 if (p not_eq js.cend())
1186 return p -> Target().perturbation;
1188 return std::numeric_limits<Numeric>::quiet_NaN();
1192 auto p = std::find_if(js.cbegin(), js.cend(), [](
auto& j){return is_frequency_parameter(j);});
1193 if (p not_eq js.cend())
1194 return p -> Target().perturbation;
1196 return std::numeric_limits<Numeric>::quiet_NaN();
1200 auto p = std::find_if(js.cbegin(), js.cend(), [](
auto& j){return j.is_mag();});
1201 if (p not_eq js.cend())
1202 return p -> Target().perturbation;
1204 return std::numeric_limits<Numeric>::quiet_NaN();
Array< Index > ArrayOfIndex
An array of Index.
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
The global header file for ARTS.
Constants of physical expressions as constexpr.
TimeStep mean(const ArrayOfTimeStep &dt)
Returns the mean time step.
Index nelem() const ARTS_NOEXCEPT
A constant view of a Matrix.
Index nrows() const noexcept
Index ncols() const noexcept
A constant view of a Tensor3.
A constant view of a Vector.
Index nelem() const noexcept
Returns the number of elements.
constexpr Index get_start() const noexcept
Returns the start index of the range.
Deals with internal derivatives, Jacobian definition, and OEM calculations.
const Matrix & TransformationMatrix() const
const String & Mode() const
Returns the mode.
const String & TransformationFunc() const
Index nelem() const
Number of elements in the grids.
const Vector & TFuncParameters() const
const Vector & OffsetVector() const
Jacobian::Target & Target()
Get the Jacobian Target.
const QuantumIdentifier & QuantumIdentity() const
Returns the identity of this Jacobian.
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
const String & Subtag() const
Returns the sub-tag.
void resize(Index n)
Resize function.
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
void gp4length1grid(ArrayOfGridPos &gp)
Grid position matching a grid of length 1.
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.
#define VARISLINESHAPEPARAM(X, Y)
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 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.
void transform_jacobian(Matrix &jacobian, const Vector x, const ArrayOfRetrievalQuantity &jqs)
Applies both functional and affine transformations.
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_X3(const RetrievalQuantity &t) noexcept
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 do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency 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 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.
#define ISLINESHAPETYPE(X)
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.
void transform_x_back(Vector &x_t, const ArrayOfRetrievalQuantity &jqs, bool revert_functional_transforms)
Handles back-transformations of the state vector.
Numeric magnetic_field_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the magnetic field perturbation if it exists.
constexpr Numeric NAT_LOG_TEN
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.
bool is_nlte_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a NLTE parameter.
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.
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.
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.
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
void from_dpath_to_dx(MatrixView diy_dx, ConstMatrixView diy_dq, const Numeric &w)
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.
ostream & operator<<(ostream &os, const RetrievalQuantity &ot)
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.
Routines for setting up the jacobian.
bool is_pressure_broadening_D0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D0 derivative.
bool is_pressure_broadening_Y(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a Y derivative.
bool is_pressure_broadening_DV(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a DV derivative.
bool is_pressure_broadening_G0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0 derivative.
bool is_pressure_broadening_FVC(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a FVC derivative.
bool is_pressure_broadening_D2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D2 derivative.
bool is_pressure_broadening_G(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G 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.
#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do)
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Linear algebra functions.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
bool is_decreasing(ConstVectorView x)
Checks if a vector is sorted in reversed order and is strictly decreasing.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
void swap(ComplexVector &v1, ComplexVector &v2) noexcept
Swaps two objects.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric ln_10
Natural logarithm of 10.
std::ostream & operator<<(std::ostream &os, const Target &x)
constexpr std::string_view Joker
This file contains declerations of functions of physical character.
constexpr Numeric number_density(Numeric p, Numeric t) noexcept
number_density
Numeric pow(const Rational base, Numeric exp)
Power of.
Range get_rowindex_for_mblock(const Sparse &sensor_response, const Index &mblock_index)
Returns the "range" of y corresponding to a measurement block.
Declaration of functions in rte.cc.
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac)
Calculates grid positions for pressure values.
Header file for special_interp.cc.
Holds all information required for individual partial derivatives.
Numeric perturbation
Perturbations for methods where theoretical computations are impossible or plain slow.
String string_id
ID for some of the Special types of partial derivatives.
bool needArrayOfSpeciesTag() const noexcept
Does this type need the ArrayOfSpeciesTag?
Line line
Type of line quantity.
ArrayOfSpeciesTag species_array_id
ID for some of the Special types of partial derivatives.
std::string_view TargetType() const noexcept
Return type as string.
Sensor sensor
Type of sensor quantity.
Atm atm
Type of atm quantity.
bool needString() const noexcept
Does this type need the String?
QuantumIdentifier qid
ID for the Line types of partial derivatives.
bool needQuantumIdentity() const noexcept
Does this type need the QuantumIdentifier?
Special special
Type of special quantity.
The structure to describe a propagation path and releated quantities.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
A logical struct for global quantum numbers with species identifiers.
Species::Species Species() const noexcept
Species::IsotopeRecord Isotopologue() const noexcept
Struct containing all information needed about one isotope.
Species spec
Species type as defined in species.h.
std::string_view isotname
A custom name that is unique for this Species type.
Deals with whether or not we should do a VMR derivative.