56 out2 <<
" Created an empty gas absorption lookup table.\n";
64 Index& abs_lookup_is_adapted,
73 const Vector& abs_nls_pert,
74 const Agenda& abs_xsec_agenda,
82 Matrix these_all_vmrs = abs_vmrs;
105 const Index n_nls_pert = abs_nls_pert.
nelem();
110 Matrix this_vmr(1, n_p_grid);
138 os <<
"If you have nonlinear species, at least one\n" 139 <<
"species must be a H2O species.";
140 throw runtime_error(os.
str());
142 out2 <<
" You have no H2O species. Absorption continua will not work.\n" 143 <<
" You should get a runtime error if you try them anyway.\n";
148 if (0 == n_species || 0 == n_f_grid || 0 == n_p_grid) {
150 os <<
"One of the required input variables is empty:\n" 151 <<
"abs_species.nelem() = " << n_species <<
",\n" 152 <<
"f_grid.nelem() = " << n_f_grid <<
",\n" 153 <<
"abs_p.nelem() = " << n_p_grid <<
".";
154 throw runtime_error(os.
str());
163 for (s = 0; s < n_species; ++s) {
164 if (abs_nls[
i] == abs_species[s]) {
165 abs_nls_idx.push_back(s);
169 if (s == n_species) {
171 os <<
"Did not find *abs_nls* tag group \"" 173 throw runtime_error(os.
str());
180 os <<
"The variable *abs_nls* must not have duplicate species.\n" 181 <<
"Value of *abs_nls*: " << abs_nls_idx;
182 throw runtime_error(os.
str());
186 chk_size(
"abs_vmrs", abs_vmrs, n_species, n_p_grid);
192 if (((0 == n_nls) && (0 != n_nls_pert)) ||
193 ((0 != n_nls) && (0 == n_nls_pert))) {
195 os <<
"You have to set both abs_nls and abs_nls_pert, or none.";
196 throw runtime_error(os.
str());
201 for (
Index s = 0; s < n_nls; ++s) {
202 non_linear[abs_nls_idx[s]] = 1;
206 abs_lookup.
species = abs_species;
209 abs_lookup.
f_grid = f_grid;
210 abs_lookup.
p_grid = abs_p;
212 abs_lookup.
t_ref = abs_t;
213 abs_lookup.
t_pert = abs_t_pert;
229 b = n_species + n_nls * (n_nls_pert - 1);
236 abs_lookup.
xsec = NAN;
243 out2 <<
" With temperature perturbations.\n";
244 these_t_pert.
resize(n_t_pert);
245 these_t_pert = abs_t_pert;
247 out2 <<
" No temperature perturbations.\n";
252 const Index these_t_pert_nelem = these_t_pert.
nelem();
262 Agenda l_abs_xsec_agenda(abs_xsec_agenda);
265 for (
Index i = 0, spec = 0;
i < n_species; ++
i) {
278 out2 <<
" Doing species " << i + 1 <<
" of " << n_species <<
": " 279 << abs_species[i] <<
".\n";
282 abs_species_active[0] = i;
285 this_species[0].resize(abs_species[i].
nelem());
286 this_species[0] = abs_species[i];
292 out2 <<
" This is a species with H2O VMR perturbations.\n";
293 these_nls_pert.
resize(n_nls_pert);
294 these_nls_pert = abs_nls_pert;
301 for (
Index s = 0; s < these_nls_pert.
nelem(); ++s, ++spec) {
306 out2 <<
" Doing H2O VMR variant " << s + 1 <<
" of " << n_nls_pert
307 <<
": " << abs_nls_pert[s] <<
".\n";
315 if (h2o_index >= 0) {
316 these_all_vmrs(h2o_index,
joker) = abs_vmrs(h2o_index,
joker);
317 these_all_vmrs(h2o_index,
joker) *=
324 this_vmr(0,
joker) = these_all_vmrs(i,
joker);
335 if (h2o_index == -1) {
341 abs_h2o = these_all_vmrs(h2o_index,
joker);
356 #pragma omp parallel for if ( \ 357 !arts_omp_in_parallel() && \ 358 these_t_pert_nelem >= \ 359 arts_omp_get_max_threads()) private(this_t, \ 360 abs_xsec_per_species, \ 361 src_xsec_per_species, \ 362 dabs_xsec_per_species_dx, \ 363 dsrc_xsec_per_species_dx) \ 364 firstprivate(l_ws, l_abs_xsec_agenda) 365 for (
Index j = 0; j < these_t_pert_nelem; ++j) {
367 if (failed)
continue;
379 os <<
" Doing temperature variant " << j + 1 <<
" of " << n_t_pert
380 <<
": " << these_t_pert[j] <<
".\n";
386 this_t = abs_lookup.
t_ref;
387 this_t += these_t_pert[j];
391 abs_xsec_per_species,
392 src_xsec_per_species,
393 dabs_xsec_per_species_dx,
394 dsrc_xsec_per_species_dx,
407 for (
Index p = 0; p < n_p_grid; ++p) {
431 catch (
const std::runtime_error& e) {
432 #pragma omp critical(abs_lookupCalc_fail) 440 if (failed)
throw runtime_error(fail_msg);
450 abs_lookup_is_adapted = 1;
485 for (
Index s = 0; s < abs_species[
i].
nelem(); ++s) {
489 const String thisname = abs_species[
i][s].Name();
491 out3 <<
" Continuum tag: " << thisname;
508 "N2-" == thisname.substr(0, 3) ||
"CO2-" == thisname.substr(0, 4) ||
509 "O2-CIA" == thisname.substr(0, 6) ||
510 "O2-v0v" == thisname.substr(0, 6) ||
511 "O2-v1v" == thisname.substr(0, 6) ||
512 "H2-CIA" == thisname.substr(0, 6) ||
513 "He-CIA" == thisname.substr(0, 6) ||
514 "CH4-CIA" == thisname.substr(0, 7) ||
515 "liquidcloud-MPM93" == thisname.substr(0, 17) ||
516 "liquidcloud-ELL07" == thisname.substr(0, 17)) {
517 out3 <<
" --> not added.\n";
522 if (
"O2-" == thisname.substr(0, 3)) {
524 out3 <<
" --> added to abs_nls.\n";
530 if (
"icecloud-" == thisname.substr(0, 9) ||
531 "rain-" == thisname.substr(0, 5)) {
533 os <<
"Tag " << thisname <<
" not allowed in absorption " 535 throw runtime_error(os.
str());
541 out3 <<
" --> unknown.\n";
543 os <<
"Unknown whether tag " << thisname
544 <<
" is a nonlinear species (i.e. uses h2o_abs) or not.\n" 545 <<
"Cannot set abs_nls automatically.";
546 throw runtime_error(os.
str());
573 abs_nls.push_back(abs_species[next_h2o]);
584 abs_nls.push_back(abs_species[cont[
i]]);
587 out2 <<
" Species marked for nonlinear treatment:\n";
591 if (j != 0) out2 <<
", ";
592 out2 << abs_nls[
i][j].Name();
617 const Index& p_interp_order,
618 const Index& t_interp_order,
634 for (
Index i = 0;
i < the_grid.nelem(); ++
i) {
645 Numeric delta_min = tmin[i] - abs_t[gp.
idx[j]] - 10;
646 Numeric delta_max = tmax[i] - abs_t[gp.
idx[j]] + 10;
648 if (delta_min < mindev) mindev = delta_min;
649 if (delta_max > maxdev) maxdev = delta_max;
653 out3 <<
" abs_t_pert: mindev/maxdev : " << mindev <<
" / " << maxdev <<
"\n";
658 Index div = t_interp_order;
661 effective_step = (maxdev - mindev) / (
Numeric)div;
663 }
while (effective_step > step);
665 abs_t_pert =
Vector(mindev, div, effective_step);
667 out2 <<
" abs_t_pert: " << abs_t_pert[0] <<
" K to " 668 << abs_t_pert[abs_t_pert.
nelem() - 1] <<
" K in steps of " 669 << effective_step <<
" K (" << abs_t_pert.
nelem() <<
" grid points)\n";
691 const Index& p_interp_order,
692 const Index& nls_interp_order,
711 for (
Index i = 0;
i < the_grid.nelem(); ++
i) {
732 Numeric delta_min = minprof[i] / refprof[gp.
idx[j]];
733 Numeric delta_max = 2 * maxprof[i] / refprof[gp.
idx[j]];
735 if (delta_min < mindev) mindev = delta_min;
738 if (!std::isinf(delta_max) && (delta_max > maxdev)) maxdev = delta_max;
742 out3 <<
" abs_nls_pert: mindev/maxdev : " << mindev <<
" / " << maxdev
745 bool allownegative =
false;
748 <<
" Warning: I am getting a negative fractional distance to the H2O\n" 749 <<
" reference profile. Some of your H2O fields may contain negative values.\n" 750 <<
" Will allow negative values also for abs_nls_pert.\n";
751 allownegative =
true;
754 if (!allownegative) {
756 out3 <<
" Adjusted mindev : " << mindev <<
"\n";
759 if (std::isinf(maxdev)) {
761 os <<
"Perturbation upper limit is infinity (likely due to the reference\n" 762 <<
"profile being 0 at at least one pressure level). Can not work\n" 764 throw runtime_error(os.
str());
770 Index div = nls_interp_order;
773 effective_step = (maxdev - mindev) / (
Numeric)div;
775 }
while (effective_step > step);
777 abs_nls_pert =
Vector(mindev, div, effective_step);
784 <<
" I am including also 0 in the abs_nls_pert, because it is a turning \n" 785 <<
" point. Consider to use a higher abs_nls_interp_order, for example 4.\n";
788 out2 <<
" abs_nls_pert: " << abs_nls_pert[0] <<
" to " 789 << abs_nls_pert[abs_nls_pert.
nelem() - 1]
790 <<
" (fractional units) in steps of " 791 << abs_nls_pert[1] - abs_nls_pert[0] <<
" (" << abs_nls_pert.
nelem()
792 <<
" grid points)\n";
804 const Index& atmosphere_dim,
810 const Index& atmfields_checked,
812 const Index& abs_p_interp_order,
813 const Index& abs_t_interp_order,
814 const Index& abs_nls_interp_order,
822 if (atmfields_checked != 1)
824 "The atmospheric fields must be flagged to have " 825 "passed a consistency check (atmfields_checked=1).");
836 if (p_grid.
nelem() < 2) {
838 os <<
"You need at least two pressure levels.";
839 throw runtime_error(os.
str());
851 if (p_step10 <= 0 || t_step <= 0 || h2o_step <= 0) {
853 os <<
"The keyword arguments p_step, t_step, and h2o_step must be >0.";
854 throw runtime_error(os.
str());
862 const Numeric p_step = log(
pow(10.0, p_step10));
882 log_abs_p_a.push_back(log_p_grid[0]);
884 for (
Index i = 1;
i < log_p_grid.nelem(); ++
i) {
886 log_p_grid[
i - 1] - log_p_grid[
i];
888 const Numeric dp_by_p_step = dp / p_step;
901 for (
Index j = 1; j <= n; ++j)
902 log_abs_p_a.push_back(log_p_grid[
i - 1] - (
Numeric)j * ddp);
908 for (
Index i = 0;
i < log_abs_p_a.
nelem(); ++
i) log_abs_p[
i] = log_abs_p_a[
i];
911 abs_p.
resize(log_abs_p.nelem());
915 if (abs_p.
nelem() < abs_p_interp_order + 1) {
917 os <<
"Your pressure grid does not have enough levels for the desired interpolation order.";
918 throw runtime_error(os.
str());
926 gridpos(gp, log_p_grid, log_abs_p);
929 Matrix itw(gp.nelem(), 2);
934 if (1 == atmosphere_dim) {
937 abs_t.
resize(log_abs_p.nelem());
945 abs_vmrs.
resize(abs_species.
nelem(), log_abs_p.nelem());
984 for (
Index s = 0; s < abs_species.
nelem(); ++s)
1002 if (0 < abs_nls.
nelem()) {
1004 if (h2o_index < 0) {
1006 os <<
"Some of your species require nonlinear treatment,\n" 1007 <<
"but you have no H2O species.";
1008 throw runtime_error(os.
str());
1025 abs_t.
resize(log_abs_p.nelem());
1026 interp(abs_t, itw, tmean, gp);
1041 abs_vmrs.
resize(abs_species.
nelem(), log_abs_p.nelem());
1045 if (0 < abs_nls.
nelem()) {
1048 vmrmean(h2o_index,
joker),
1053 abs_nls_interp_order,
1074 const Index& abs_p_interp_order,
1075 const Index& abs_t_interp_order,
1076 const Index& abs_nls_interp_order,
1077 const Index& atmosphere_dim,
1083 const Index& robust,
1084 const Index& check_gridnames,
1093 const Numeric p_step = log(
pow(10.0, p_step10));
1111 const ArrayOfString field_names = batch_fields[0].get_string_grid(0);
1115 const String delim =
"-";
1127 if (h2o_index < 0) {
1128 os <<
"One of the atmospheric fields must be H2O.\n";
1133 if (field_names.
nelem() < 3) {
1134 os <<
"Atmospheric states in batch_fields must have at\n" 1135 <<
"least three fields: T, z, and at least one absorption species.";
1136 throw runtime_error(os.
str());
1139 if (abs_species.
nelem() < 1) {
1140 os <<
"At least one absorption species needs to be defined " 1141 <<
"in abs_species.";
1142 throw runtime_error(os.
str());
1151 for (
Index fi = 0; fi < nf; ++fi) {
1153 if (species_type ==
"T") {
1155 os <<
"Only one temperature ('T') field allowed, " 1156 <<
"but found at least 2.\n";
1165 os <<
"One temperature ('T') field required, but none found.\n";
1171 for (
Index fi = 0; fi < nf; ++fi) {
1173 if (species_type ==
"z") {
1175 os <<
"Only one altitude ('z') field allowed, " 1176 <<
"but found at least 2.\n";
1185 os <<
"One altitude ('z') field required, but none found.\n";
1196 for (
Index j = 0; j < abs_species.
nelem(); ++j) {
1199 while (!found && fi < nf) {
1202 if (species_type ==
"abs_species") {
1204 if (species_name == species_names[j]) {
1206 batch_index[j] = fi;
1212 os <<
"No field for absorption species '" << species_names[j]
1218 os <<
"Your field names are:\n" << field_names;
1220 if (bail)
throw runtime_error(os.
str());
1230 Numeric minp = batch_fields[0].get_numeric_grid(
1235 for (
Index i = 0; i < batch_fields.
nelem(); ++i) {
1237 Index atmfields_checked;
1247 Tensor4 particle_bulkprop_field;
1251 Index abs_f_interp_order;
1255 atm_fields_compact = batch_fields[i];
1263 particle_bulkprop_field,
1264 particle_bulkprop_names,
1288 partition_functions,
1293 }
catch (
const std::exception& e) {
1296 out1 <<
" WARNING! Skipped invalid atmfield " 1297 <<
"at batch_atmfield index " << i <<
".\n" 1298 <<
"The runtime error produced was:\n" 1299 << e.what() <<
"\n";
1305 err <<
"Invalid atmfield at batch_atmfield index " << i <<
".\n" 1306 <<
"The runtime error produced was:\n" 1307 << e.what() <<
"\n";
1308 throw std::runtime_error(err.
str());
1311 valid_field_indices.push_back(i);
1324 if (batch_fields.
nelem() > valid_field_indices.
nelem()) {
1325 out1 <<
" " << batch_fields.
nelem() - valid_field_indices.
nelem()
1326 <<
" out of " << batch_fields.
nelem() <<
" atmospheres ignored.\n";
1330 if (valid_field_indices.
nelem() < 1) {
1332 err <<
"You need at least one valid profile.\n" 1333 <<
"It seems that no atmfield passed the checks!\n";
1334 throw std::runtime_error(err.
str());
1339 os <<
"You need at least two pressure levels.";
1340 throw runtime_error(os.
str());
1349 Index np = (
Index)ceil((log(maxp) - log(minp)) / p_step) + 1;
1354 if (np < abs_p_interp_order + 1) np = abs_p_interp_order + 1;
1356 Vector log_abs_p(log(maxp), np, -p_step);
1357 log_abs_p[np - 1] = log(minp);
1361 out2 <<
" abs_p: " << abs_p[0] <<
" Pa to " << abs_p[np - 1]
1362 <<
" Pa in log10 steps of " << p_step10 <<
" (" << np
1363 <<
" grid points)\n";
1379 Matrix datamean(n_variables, np, 0);
1392 for (
Index vi = 0; vi < valid_field_indices.
nelem(); ++vi) {
1394 Index i = valid_field_indices[vi];
1400 throw runtime_error(
1401 "All batch atmospheres must contain the same field names.");
1408 throw runtime_error(
1409 "All batch atmospheres must contain the same individual field names.");
1422 for (
Index ilat = 0; ilat < data.
nrows(); ++ilat)
1423 for (
Index ilon = 0; ilon < data.
ncols(); ++ilon) {
1425 if (
data(T_index, ip, ilat, ilon) < mint)
1426 mint =
data(T_index, ip, ilat, ilon);
1427 if (
data(T_index, ip, ilat, ilon) > maxt)
1428 maxt =
data(T_index, ip, ilat, ilon);
1430 if (
data(batch_index[h2o_index], ip, ilat, ilon) < minh2o) {
1431 minh2o =
data(batch_index[h2o_index], ip, ilat, ilon);
1433 if (
data(batch_index[h2o_index], ip, ilat, ilon) > maxh2o) {
1434 maxh2o =
data(batch_index[h2o_index], ip, ilat, ilon);
1451 const Numeric eps_bottom = (log_p_grid[0] - log_p_grid[1]) / 2.1;
1453 while (log_abs_p[first_p] > log_p_grid[0] + eps_bottom) ++first_p;
1455 const Numeric eps_top = (log_p_grid[log_p_grid.nelem() - 2] -
1456 log_p_grid[log_p_grid.nelem() - 1]) /
1459 while (log_abs_p[last_p] < log_p_grid[log_p_grid.nelem() - 1] - eps_top)
1462 const Index extent_p = last_p - first_p + 1;
1479 gridpos(gp, log_p_grid, active_log_abs_p);
1486 Matrix itw(gp.nelem(), 2);
1499 for (
Index la = 0; la < data.
nrows(); ++la) {
1511 for (
Index fi = 0; fi < abs_species.
nelem(); ++fi)
1524 for (
Index lo = 0; lo < data_interp.ncols(); ++lo)
1525 for (
Index la = 0; la < data_interp.nrows(); ++la) {
1526 for (
Index fi = 0; fi < data_interp.nbooks(); ++fi) {
1528 for (
Index pr = 0; pr < data_interp.npages(); ++pr) {
1530 if (0 == fi || (h2o_index + 2) == fi) {
1531 if (data_interp(fi, pr, la, lo) < datamin(fi, first_p + pr))
1532 datamin(fi, first_p + pr) = data_interp(fi, pr, la, lo);
1533 if (data_interp(fi, pr, la, lo) > datamax(fi, first_p + pr))
1534 datamax(fi, first_p + pr) = data_interp(fi, pr, la, lo);
1537 datamean(fi, first_p + pr) += data_interp(fi, pr, la, lo);
1546 mean_norm[
Range(first_p, extent_p)] += 1;
1550 out2 <<
" Global statistics:\n" 1551 <<
" min(p) / max(p) [Pa]: " << minp <<
" / " << maxp <<
"\n" 1552 <<
" min(T) / max(T) [K]: " << mint <<
" / " << maxt <<
"\n" 1553 <<
" min(H2O) / max(H2O) [VMR]: " << minh2o <<
" / " << maxh2o <<
"\n";
1556 assert(np == mean_norm.
nelem());
1557 for (
Index fi = 0; fi < datamean.
nrows(); ++fi)
1559 for (
Index pi = 0; pi < np; ++pi) {
1563 if (0 < mean_norm[pi])
1564 datamean(fi, pi) /= mean_norm[pi];
1567 os <<
"No data at pressure level " << pi + 1 <<
" of " << np <<
" (" 1568 << abs_p[pi] <<
" hPa).";
1569 throw runtime_error(os.
str());
1577 assert(log_abs_p.
nelem() == np);
1579 for (
Index i = 0; i < np; ++i) {
1581 gridpos_poly(gp, log_abs_p, log_abs_p[i], abs_p_interp_order);
1587 for (
Index fi = 0; fi < datamean.
nrows(); ++fi)
1591 smooth_datamean(fi, i) += datamean(fi, gp.
idx[j]);
1605 for (
Index i = 0; i < np; ++i) {
1609 species_type, field_names[batch_index[h2o_index]], delim);
1610 assert(species_type ==
"abs_species");
1612 species_name, field_names[batch_index[h2o_index]], delim);
1613 assert(
"H2O" == species_name);
1614 assert(
"H2O" == species_names[h2o_index]);
1617 Numeric& mean_h2o = smooth_datamean(h2o_index + 2, i);
1618 Numeric& max_h2o = datamax(h2o_index + 2, i);
1619 if (mean_h2o <= 0) {
1622 out3 <<
" H2O profile contained zero values, adjusted to 1e-9.\n";
1628 abs_t = smooth_datamean(0,
joker);
1634 assert(abs_species.
nelem() == smooth_datamean.nrows() - 2);
1656 abs_vmrs(h2o_index,
joker),
1661 abs_nls_interp_order,
1666 if (0 != extremes.
nelem()) {
1668 if (4 != extremes.
nelem()) {
1670 os <<
"There must be exactly 4 elements in extremes:\n" 1671 <<
"min(abs_t_pert), max(abs_t_pert), min(abs_nls_pert), max(abs_nls_pert)";
1672 throw runtime_error(os.
str());
1676 if (extremes[0] < abs_t_pert[0]) {
1677 Vector dummy = abs_t_pert;
1679 abs_t_pert[0] = extremes[0];
1681 out2 <<
" Added min extreme value for abs_t_pert: " << abs_t_pert[0]
1686 if (extremes[1] > abs_t_pert[abs_t_pert.
nelem() - 1]) {
1687 Vector dummy = abs_t_pert;
1690 abs_t_pert[abs_t_pert.
nelem() - 1] = extremes[1];
1691 out2 <<
" Added max extreme value for abs_t_pert: " 1692 << abs_t_pert[abs_t_pert.nelem() - 1] <<
"\n";
1696 if (extremes[2] < abs_nls_pert[0]) {
1697 Vector dummy = abs_nls_pert;
1699 abs_nls_pert[0] = extremes[2];
1700 abs_nls_pert[
Range(1, dummy.
nelem())] = dummy;
1701 out2 <<
" Added min extreme value for abs_nls_pert: " << abs_nls_pert[0]
1706 if (extremes[3] > abs_nls_pert[abs_nls_pert.
nelem() - 1]) {
1707 Vector dummy = abs_nls_pert;
1709 abs_nls_pert[
Range(0, dummy.
nelem())] = dummy;
1710 abs_nls_pert[abs_nls_pert.
nelem() - 1] = extremes[3];
1711 out2 <<
" Added max extreme value for abs_nls_pert: " 1712 << abs_nls_pert[abs_nls_pert.nelem() - 1] <<
"\n";
1726 const Index& abs_p_interp_order,
1727 const Index& abs_t_interp_order,
1728 const Index& abs_nls_interp_order,
1743 const Numeric p_step = log(
pow(10.0, p_step10));
1755 Index np = (
Index)ceil((log(p_max) - log(p_min)) / p_step) + 1;
1760 if (np < abs_p_interp_order + 1) np = abs_p_interp_order + 1;
1762 Vector log_abs_p(log(p_max), np, -p_step);
1766 out2 <<
" abs_p: " << abs_p[0] <<
" Pa to " << abs_p[np - 1]
1767 <<
" Pa in log10 steps of " << p_step10 <<
" (" << np
1768 <<
" grid points)\n";
1775 Numeric t_ref = (t_min + t_max) / 2;
1782 Vector min_prof(np), max_prof(np);
1803 Numeric const other_ref = 1e-9;
1810 abs_vmrs = other_ref;
1815 const Index o2_index =
1817 if (o2_index >= 0) {
1818 abs_vmrs(o2_index,
joker) = 0.2095;
1821 const Index n2_index =
1823 if (n2_index >= 0) {
1824 abs_vmrs(n2_index,
joker) = 0.7808;
1833 if (0 < abs_nls.
nelem()) {
1834 if (h2o_index < 0) {
1836 os <<
"Some of your species require nonlinear treatment,\n" 1837 <<
"but you have no H2O species.";
1838 throw runtime_error(os.
str());
1842 abs_vmrs(h2o_index,
joker) = h2o_ref;
1853 abs_vmrs(h2o_index,
joker),
1858 abs_nls_interp_order,
1862 out1 <<
" WARNING:\n" 1863 <<
" You have no species that require H2O variations.\n" 1864 <<
" This case might work, but it has never been tested.\n" 1865 <<
" Please test it, then remove this warning.\n";
1872 Index& propmat_clearsky_agenda_checked,
1873 Index& abs_xsec_agenda_checked,
1880 propmat_clearsky_agenda_checked =
false;
1881 abs_xsec_agenda_checked =
false;
1893 abs_species.push_back(temp);
1899 out3 <<
" Added tag groups:";
1901 out3 <<
"\n " <<
i <<
":";
1902 for (
Index s = 0; s < abs_species[i].
nelem(); ++s) {
1903 out3 <<
" " << abs_species[i][s].Name();
1915 Index& propmat_clearsky_agenda_checked,
1916 Index& abs_xsec_agenda_checked,
1918 const Index& atmosphere_dim,
1924 const Vector& rq_lat_grid,
1925 const Vector& rq_lon_grid,
1933 propmat_clearsky_agenda_checked =
false;
1934 abs_xsec_agenda_checked =
false;
1939 abs_species.push_back(tags);
1944 out3 <<
" Appended tag group:";
1945 out3 <<
"\n " << abs_species.
nelem() - 1 <<
":";
1947 out3 <<
" " << tags[s].Name();
1970 abs_species.resize(0);
1976 Index& abs_xsec_agenda_checked,
1977 Index& propmat_clearsky_agenda_checked,
1984 propmat_clearsky_agenda_checked =
false;
1985 abs_xsec_agenda_checked =
false;
1987 abs_species.resize(names.
nelem());
2002 out3 <<
" Defined tag groups: ";
2004 out3 <<
"\n " <<
i <<
":";
2005 for (
Index s = 0; s < abs_species[i].
nelem(); ++s)
2006 out3 <<
" " << abs_species[i][s].Name();
2013 Index& abs_lookup_is_adapted,
2017 abs_lookup.
Adapt(abs_species, f_grid, verbosity);
2018 abs_lookup_is_adapted = 1;
2026 const Index& abs_lookup_is_adapted,
2027 const Index& abs_p_interp_order,
2028 const Index& abs_t_interp_order,
2029 const Index& abs_nls_interp_order,
2030 const Index& abs_f_interp_order,
2034 const Vector& a_vmr_list,
2041 Matrix abs_scalar_gas, dabs_scalar_gas_df, dabs_scalar_gas_dt;
2044 if (1 != abs_lookup_is_adapted)
2045 throw runtime_error(
2046 "Gas absorption lookup table must be adapted,\n" 2047 "use method abs_lookupAdapt.");
2062 if (do_freq_jac and (1 > abs_f_interp_order))
2063 throw std::runtime_error(
"Wind/frequency Jacobian is not possible without at least first\n" 2064 "order frequency interpolation in the lookup table. Please use\n" 2065 "abs_f_interp_order>0 or remove wind/frequency Jacobian.");
2070 abs_lookup.
Extract(abs_scalar_gas,
2073 abs_nls_interp_order,
2083 abs_lookup.
Extract(dabs_scalar_gas_df,
2086 abs_nls_interp_order,
2095 const Numeric dtemp = a_temperature + dt;
2096 abs_lookup.
Extract(dabs_scalar_gas_dt,
2099 abs_nls_interp_order,
2111 for (
Index ii = 0; ii < propmat_clearsky.
nelem(); ii++) {
2112 propmat_clearsky[ii].Kjj() += abs_scalar_gas(ii,
joker);
2115 for (
Index isp = 0; isp < propmat_clearsky.
nelem(); isp++) {
2116 propmat_clearsky[isp].Kjj() += abs_scalar_gas(isp,
joker);
2118 for (
Index iv = 0; iv < propmat_clearsky[isp].NumberOfFrequencies();
2120 for (
Index iq = 0; iq < jacobian_quantities_position.
nelem(); iq++) {
2121 if (jacobian_quantities[jacobian_quantities_position[iq]] ==
2123 dpropmat_clearsky_dx[iq].Kjj()[iv] +=
2124 (dabs_scalar_gas_dt(isp, iv) - abs_scalar_gas(isp, iv)) / dt;
2127 [jacobian_quantities_position[iq]])) {
2128 dpropmat_clearsky_dx[iq].Kjj()[iv] +=
2129 (dabs_scalar_gas_df(isp, iv) - abs_scalar_gas(isp, iv)) / df;
2130 }
else if (jacobian_quantities[jacobian_quantities_position[iq]] ==
2132 if (jacobian_quantities[jacobian_quantities_position[iq]]
2138 dpropmat_clearsky_dx[iq].Kjj()[iv] +=
2139 abs_scalar_gas(isp, iv) / a_vmr_list[isp];
2150 Tensor7& propmat_clearsky_field,
2153 const Index& atmfields_checked,
2155 const Index& stokes_dim,
2165 const Agenda& abs_agenda,
2174 if (atmfields_checked != 1)
2175 throw runtime_error(
2176 "The atmospheric fields must be flagged to have " 2177 "passed a consistency check (atmfields_checked=1).");
2181 nlte_partial_source;
2205 os <<
"Variable doppler must either be empty, or match the dimension of " 2207 throw runtime_error(os.
str());
2213 out2 <<
" Creating propmat field with dimensions:\n" 2214 <<
" " << n_species <<
" gas species,\n" 2215 <<
" " << n_frequencies <<
" frequencies,\n" 2216 <<
" " << stokes_dim <<
" stokes dimension,\n" 2217 <<
" " << stokes_dim <<
" stokes dimension,\n" 2218 <<
" " << n_pressures <<
" pressures,\n" 2219 <<
" " << n_latitudes <<
" latitudes,\n" 2220 <<
" " << n_longitudes <<
" longitudes.\n";
2222 propmat_clearsky_field.
resize(n_species,
2230 out2 <<
" Creating source field with dimensions:\n" 2231 <<
" " << n_species <<
" gas species,\n" 2232 <<
" " << n_frequencies <<
" frequencies,\n" 2233 <<
" " << stokes_dim <<
" stokes dimension,\n" 2234 <<
" " << n_pressures <<
" pressures,\n" 2235 <<
" " << n_latitudes <<
" latitudes,\n" 2236 <<
" " << n_longitudes <<
" longitudes.\n";
2237 nlte_source_field.
resize(n_species,
2244 out2 <<
" Creating source field with dimensions:\n" 2245 <<
" " << 0 <<
" gas species,\n" 2246 <<
" " << 0 <<
" frequencies,\n" 2247 <<
" " << 0 <<
" stokes dimension,\n" 2248 <<
" " << 0 <<
" pressures,\n" 2249 <<
" " << 0 <<
" latitudes,\n" 2250 <<
" " << 0 <<
" longitudes.\n";
2251 nlte_source_field.
resize(0, 0, 0, 0, 0, 0);
2257 Agenda l_abs_agenda(abs_agenda);
2260 bool failed =
false;
2263 Vector this_f_grid = f_grid;
2267 #pragma omp parallel for if (!arts_omp_in_parallel() && \ 2268 n_pressures >= arts_omp_get_max_threads()) \ 2269 firstprivate(l_ws, l_abs_agenda, this_f_grid) private(abs, \ 2272 partial_nlte_source, \ 2273 nlte_partial_source, \ 2275 for (
Index ipr = 0; ipr < n_pressures; ++ipr)
2278 if (failed)
continue;
2283 Numeric a_pressure = p_grid[ipr];
2285 if (0 != doppler.
nelem()) {
2286 this_f_grid = f_grid;
2287 this_f_grid += doppler[ipr];
2292 os <<
" p_grid[" << ipr <<
"] = " << a_pressure <<
"\n";
2296 for (
Index ila = 0; ila < n_latitudes; ++ila)
2297 for (
Index ilo = 0; ilo < n_longitudes; ++ilo)
2299 Numeric a_temperature = t_field(ipr, ila, ilo);
2300 a_vmr_list = vmr_field(
Range(
joker), ipr, ila, ilo);
2302 a_nlte_list = nlte_field(ipr, ila, ilo);
2304 Vector this_rtp_mag(3, 0.);
2306 if (mag_u_field.
npages() != 0) {
2307 this_rtp_mag[0] = mag_u_field(ipr, ila, ilo);
2309 if (mag_v_field.
npages() != 0) {
2310 this_rtp_mag[1] = mag_v_field(ipr, ila, ilo);
2312 if (mag_w_field.
npages() != 0) {
2313 this_rtp_mag[2] = mag_w_field(ipr, ila, ilo);
2323 partial_nlte_source,
2324 nlte_partial_source,
2337 if (abs.
nelem() > 0) {
2338 if (stokes_dim != abs[0].StokesDimensions()) {
2340 os <<
"propmat_clearsky_fieldCalc was called with stokes_dim = " 2341 << stokes_dim <<
",\n" 2342 <<
"but the stokes_dim returned by the agenda is " 2343 << abs[0].StokesDimensions() <<
".";
2344 throw runtime_error(os.
str());
2350 if (n_species != abs.
nelem()) {
2352 os <<
"The number of gas species in vmr_field is " << n_species
2354 <<
"but the number of species returned by the agenda is " 2355 << abs.
nelem() <<
".";
2356 throw runtime_error(os.
str());
2361 if (abs.
nelem() > 0) {
2362 if (n_frequencies != abs[0].NumberOfFrequencies()) {
2364 os <<
"The number of frequencies desired is " << n_frequencies
2366 <<
"but the number of frequencies returned by the agenda is " 2367 << abs[0].NumberOfFrequencies() <<
".";
2368 throw runtime_error(os.
str());
2378 abs[
i].GetTensor3(propmat_clearsky_field(
2383 nlte_source_field(
i,
joker,
joker, ipr, ila, ilo) =
2388 }
catch (
const std::runtime_error& e) {
2389 #pragma omp critical(propmat_clearsky_fieldCalc_fail) 2391 fail_msg = e.what();
2397 if (failed)
throw runtime_error(fail_msg);
2406 f_grid = lookup_f_grid;
2415 p_grid = lookup_p_grid;
2444 const Index& abs_p_interp_order,
2445 const Index& abs_t_interp_order,
2446 const Index& abs_nls_interp_order,
2447 const bool ignore_errors,
2449 const Agenda& abs_xsec_agenda,
2453 const Vector& local_vmrs,
2470 abs_nls_interp_order,
2477 }
catch (
const std::runtime_error& x) {
2484 throw runtime_error(x.what());
2493 Vector abs_lbl(n_f, 0.0);
2494 Vector abs_rel_diff(n_f);
2508 Index propmat_clearsky_checked = 1,
2514 dpropmat_clearsky_dx,
2518 jacobian_quantities,
2521 propmat_clearsky_checked,
2529 dpropmat_clearsky_dx,
2534 jacobian_quantities,
2546 for (
auto&
pm : propmat_clearsky) abs_lbl +=
pm.Kjj();
2550 assert(abs_tab.
nelem() == n_f);
2551 assert(abs_lbl.
nelem() == n_f);
2552 assert(abs_rel_diff.
nelem() == n_f);
2555 abs_rel_diff[
i] = fabs((abs_tab[
i] - abs_lbl[
i]) / abs_lbl[i] * 100);
2559 Numeric max_abs_rel_diff =
max(abs_rel_diff);
2563 return max_abs_rel_diff;
2571 const Index& abs_lookup_is_adapted,
2572 const Index& abs_p_interp_order,
2573 const Index& abs_t_interp_order,
2574 const Index& abs_nls_interp_order,
2575 const Agenda& abs_xsec_agenda,
2583 if (1 != abs_lookup_is_adapted)
2584 throw runtime_error(
2585 "Gas absorption lookup table must be adapted,\n" 2586 "use method abs_lookupAdapt.");
2596 os <<
"This function currently works only with lookup tables\n" 2597 <<
"containing nonlinear species.";
2598 throw runtime_error(os.
str());
2604 Index h2o_index = -1;
2613 if (h2o_index == -1) {
2615 os <<
"With nonlinear species, at least one species must be a H2O species.";
2616 throw runtime_error(os.
str());
2623 for (
Index i = 0;
i < inbet_t_pert.nelem(); ++
i)
2631 #pragma omp parallel for if (!arts_omp_in_parallel()) 2632 for (
Index pi = 0; pi < n_p; ++pi)
2633 for (
Index ti = 0; ti < inbet_t_pert.nelem(); ++ti) {
2648 local_vmrs[h2o_index] *= al.
nls_pert[0];
2656 abs_nls_interp_order,
2670 #pragma omp critical(abs_lookupTestAccuracy_piti) 2672 if (max_abs_rel_diff > err_t) err_t = max_abs_rel_diff;
2680 for (
Index i = 0;
i < inbet_nls_pert.nelem(); ++
i)
2688 #pragma omp parallel for if (!arts_omp_in_parallel()) 2689 for (
Index pi = 0; pi < n_p; ++pi)
2690 for (
Index ni = 0; ni < inbet_nls_pert.nelem(); ++ni) {
2708 local_vmrs[h2o_index] *= inbet_nls_pert[ni];
2716 abs_nls_interp_order,
2728 #pragma omp critical(abs_lookupTestAccuracy_pini) 2730 if (max_abs_rel_diff > err_nls) err_nls = max_abs_rel_diff;
2741 Vector inbet_p_grid(n_p - 1);
2742 Vector inbet_t_ref(n_p - 1);
2743 Matrix inbet_vmrs_ref(n_species, n_p - 1);
2747 for (
Index j = 0; j < n_species; ++j)
2756 #pragma omp parallel for if (!arts_omp_in_parallel()) 2757 for (
Index pi = 0; pi < n_p - 1; ++pi) {
2761 Numeric local_p = inbet_p_grid[pi];
2777 local_vmrs[h2o_index] *= al.
nls_pert[0];
2784 abs_nls_interp_order,
2796 #pragma omp critical(abs_lookupTestAccuracy_pi) 2798 if (max_abs_rel_diff > err_p) err_p = max_abs_rel_diff;
2809 #pragma omp parallel for if (!arts_omp_in_parallel()) 2810 for (
Index pi = 0; pi < n_p - 1; ++pi)
2811 for (
Index ti = 0; ti < inbet_t_pert.nelem(); ++ti)
2812 for (
Index ni = 0; ni < inbet_nls_pert.nelem(); ++ni) {
2816 Numeric local_p = inbet_p_grid[pi];
2819 Numeric local_t = inbet_t_ref[pi] + inbet_t_pert[ti];
2825 local_vmrs[h2o_index] *= inbet_nls_pert[ni];
2833 abs_nls_interp_order,
2845 #pragma omp critical(abs_lookupTestAccuracy_pitini) 2847 if (max_abs_rel_diff > err_tot) {
2848 err_tot = max_abs_rel_diff;
2856 out2 <<
" Max. of absolute value of relative error in percent:\n" 2857 <<
" Note: Unless you have constant reference profiles, the\n" 2858 <<
" pressure interpolation error will have other errors mixed in.\n" 2859 <<
" Temperature interpolation: " << err_t <<
"%\n" 2860 <<
" H2O (NLS) interpolation: " << err_nls <<
"%\n" 2861 <<
" Pressure interpolation: " << err_p <<
"%\n" 2862 <<
" Total error: " << err_tot <<
"%\n";
2884 const Index& abs_lookup_is_adapted,
2885 const Index& abs_p_interp_order,
2886 const Index& abs_t_interp_order,
2887 const Index& abs_nls_interp_order,
2888 const Index& mc_seed,
2889 const Agenda& abs_xsec_agenda,
2898 if (1 != abs_lookup_is_adapted)
2899 throw runtime_error(
2900 "Gas absorption lookup table must be adapted,\n" 2901 "use method abs_lookupAdapt.");
2909 os <<
"This function currently works only with lookup tables\n" 2910 <<
"containing nonlinear species.";
2911 throw runtime_error(os.
str());
2917 Index h2o_index = -1;
2926 if (h2o_index == -1) {
2928 os <<
"With nonlinear species, at least one species must be a H2O species.";
2929 throw runtime_error(os.
str());
2935 const Index chunksize = 100;
2939 rng.
seed(mc_seed, verbosity);
2959 Vector rand_lp(chunksize);
2960 Vector rand_dT(chunksize);
2961 Vector rand_dh2o(chunksize);
2964 Vector max_abs_rel_diff(chunksize);
2967 bool keep_looping =
true;
2973 while (keep_looping) {
2976 for (
Index i = 0;
i < chunksize; ++
i) {
2979 rand_lp[
i] = rng.
draw() * (lp_max - lp_min) + lp_min;
2980 rand_dT[
i] = rng.
draw() * (dT_max - dT_min) + dT_min;
2981 rand_dh2o[
i] = rng.
draw() * (dh2o_max - dh2o_min) + dh2o_min;
2984 for (
Index i = 0;
i < chunksize; ++
i) {
2986 const Numeric this_lp = rand_lp[
i];
2997 pitw.
resize(abs_p_interp_order + 1);
3004 Vector these_vmrs(n_species);
3005 for (
Index j = 0; j < n_species; ++j) {
3010 const Numeric this_p = exp(this_lp);
3011 const Numeric this_t = this_t_ref + rand_dT[
i];
3012 these_vmrs[h2o_index] *= rand_dh2o[
i];
3023 abs_nls_interp_order,
3042 for (
Index i = 0;
i < chunksize; ++
i) {
3043 const Numeric x = max_abs_rel_diff[
i];
3060 for (
Index i = 0;
i < chunksize; ++
i) {
3061 const Numeric x = max_abs_rel_diff[
i];
3063 variance += (x -
mean) * (x - mean);
3067 variance = variance / (
Numeric)N;
3073 total_std =
sqrt(variance);
3075 const Numeric old_mean = total_mean;
3079 (total_mean * ((
Numeric)(N_chunk - 1)) + mean) / (
Numeric)N_chunk;
3083 total_std = total_std * total_std;
3085 total_std *= (
Numeric)(N_chunk - 1);
3087 total_std += variance;
3089 total_std /= (
Numeric)N_chunk;
3091 total_std =
sqrt(total_std);
3095 if (
abs(total_mean - old_mean) < total_mean / 100) keep_looping =
false;
3101 out3 <<
" Chunk " << N_chunk <<
": Mean estimate = " << total_mean
3102 <<
" Std estimate = " << total_std <<
"\n";
3106 out2 <<
" Mean relative error: " << total_mean <<
"%\n" 3107 <<
" Standard deviation: " << total_std <<
"%\n";
INDEX Index
The type to use for all integer numbers and indices.
void jacobianAddAbsSpecies(Workspace &, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &mode, const Index &for_species_tag, const Verbosity &verbosity)
WORKSPACE METHOD: jacobianAddAbsSpecies.
ArrayOfIndex equivalent_propmattype_indexes(const ArrayOfRetrievalQuantity &js)
Returns a list of positions for the derivatives in Propagation Matrix calculations.
void propmat_clearsky_fieldCalc(Workspace &ws, Tensor7 &propmat_clearsky_field, Tensor6 &nlte_source_field, const Index &atmfields_checked, const Vector &f_grid, const Index &stokes_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const EnergyLevelMap &nlte_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Agenda &abs_agenda, const Vector &doppler, const Vector &los, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearsky_fieldCalc.
void abs_lookupInit(GasAbsLookup &x, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupInit.
Index nelem() const
Number of elements.
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
QuantumIdentifier::QType Index LowerQuantumNumbers Species
Vector t_pert
The vector of temperature perturbations [K].
void choose_abs_nls(ArrayOfArrayOfSpeciesTag &abs_nls, const ArrayOfArrayOfSpeciesTag &abs_species, const Verbosity &verbosity)
Choose species for abs_nls.
Declarations having to do with the four output streams.
void parse_atmcompact_speciestype(String &species_type, const String &field_name, const String &delim)
void abs_speciesInit(ArrayOfArrayOfSpeciesTag &abs_species, const Verbosity &)
WORKSPACE METHOD: abs_speciesInit.
void abs_lookupTestAccuracy(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccuracy.
void abs_speciesSet(ArrayOfArrayOfSpeciesTag &abs_species, Index &abs_xsec_agenda_checked, Index &propmat_clearsky_agenda_checked, const ArrayOfString &names, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesSet.
void f_gridFromGasAbsLookup(Vector &f_grid, const GasAbsLookup &abs_lookup, const Verbosity &)
WORKSPACE METHOD: f_gridFromGasAbsLookup.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
const Tensor4 & Data() const noexcept
Energy level type.
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
void abs_lookupSetupBatch(Vector &abs_p, Vector &abs_t, Vector &abs_t_pert, Matrix &abs_vmrs, ArrayOfArrayOfSpeciesTag &abs_nls, Vector &abs_nls_pert, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfGriddedField4 &batch_fields, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Index &atmosphere_dim, const Numeric &p_step10, const Numeric &t_step, const Numeric &h2o_step, const Vector &extremes, const Index &robust, const Index &check_gridnames, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupSetupBatch.
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
Index npages() const
Returns the number of pages.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
void abs_speciesAdd(ArrayOfArrayOfSpeciesTag &abs_species, Index &propmat_clearsky_agenda_checked, Index &abs_xsec_agenda_checked, const ArrayOfString &names, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesAdd.
void VectorInsertGridPoints(Vector &og, const Vector &ingrid, const Vector &points, const Verbosity &verbosity)
WORKSPACE METHOD: VectorInsertGridPoints.
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
void Adapt(const ArrayOfArrayOfSpeciesTag ¤t_species, ConstVectorView current_f_grid, const Verbosity &verbosity)
Adapt lookup table to current calculation.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Index GetSpeciesIndex(const Index &isp) const
Vector log_p_grid
The natural log of the pressure grid.
Index nrows() const
Returns the number of rows.
void atmfields_checkedCalc(Index &atmfields_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &t_field, const Tensor4 &vmr_field, 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 SpeciesAuxData &partition_functions, const Index &abs_f_interp_order, const Index &negative_vmr_ok, const Index &bad_partition_functions_ok, const Verbosity &)
WORKSPACE METHOD: atmfields_checkedCalc.
Index nelem() const
Returns the number of elements.
bool is_unique(const ArrayOfIndex &x)
Checks if an ArrayOfIndex is unique, i.e., has no duplicate values.
void choose_abs_nls_pert(Vector &abs_nls_pert, ConstVectorView refprof, ConstVectorView minprof, ConstVectorView maxprof, const Numeric &step, const Index &p_interp_order, const Index &nls_interp_order, const Verbosity &verbosity)
Chose the H2O perturbations abs_nls_pert.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
Tensor4 xsec
Absorption cross sections.
Index ncols() const
Returns the number of columns.
The global header file for ARTS.
Matrix vmrs_ref
The reference VMR profiles.
Vector f_grid
The frequency grid [Hz].
void abs_lookupSetupWide(Vector &abs_p, Vector &abs_t, Vector &abs_t_pert, Matrix &abs_vmrs, ArrayOfArrayOfSpeciesTag &abs_nls, Vector &abs_nls_pert, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Numeric &p_min, const Numeric &p_max, const Numeric &p_step10, const Numeric &t_min, const Numeric &t_max, const Numeric &h2o_min, const Numeric &h2o_max, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupSetupWide.
_CS_string_type str() const
void propmat_clearskyAddFromLookup(ArrayOfPropagationMatrix &propmat_clearsky, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Index &abs_f_interp_order, const Vector &f_grid, const Numeric &a_pressure, const Numeric &a_temperature, const Vector &a_vmr_list, const ArrayOfRetrievalQuantity &jacobian_quantities, const Numeric &extpolfac, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddFromLookup.
Declarations for agendas.
void abs_lookupAdapt(GasAbsLookup &abs_lookup, Index &abs_lookup_is_adapted, const ArrayOfArrayOfSpeciesTag &abs_species, const Vector &f_grid, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupAdapt.
Numeric calc_lookup_error(Workspace &ws, const GasAbsLookup &al, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const bool ignore_errors, const Agenda &abs_xsec_agenda, const Numeric &local_p, const Numeric &local_t, const Vector &local_vmrs, const Verbosity &verbosity)
Compare lookup and LBL calculation.
void abs_lookupCalc(Workspace &ws, GasAbsLookup &abs_lookup, Index &abs_lookup_is_adapted, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfSpeciesTag &abs_nls, const Vector &f_grid, const Vector &abs_p, const Matrix &abs_vmrs, const Vector &abs_t, const Vector &abs_t_pert, const Vector &abs_nls_pert, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupCalc.
void p_gridFromGasAbsLookup(Vector &p_grid, const GasAbsLookup &abs_lookup, const Verbosity &)
WORKSPACE METHOD: p_gridFromGasAbsLookup.
void propmat_clearskyAddOnTheFly(Workspace &ws, ArrayOfPropagationMatrix &propmat_clearsky, ArrayOfStokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_dx_source, ArrayOfStokesVector &nlte_dsource_dx, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Numeric &rtp_pressure, const Numeric &rtp_temperature, const EnergyLevelMap &rtp_nlte, const Vector &rtp_vmr, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: propmat_clearskyAddOnTheFly.
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
An absorption lookup table.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
const Vector & GetFgrid() const
member functions of the Rng class and gsl_rng code
NUMERIC Numeric
The type to use for all floating point numbers.
Declarations for the gas absorption lookup table.
void AtmFieldsAndParticleBulkPropFieldFromCompact(Vector &p_grid, Vector &lat_grid, Vector &lon_grid, Tensor3 &t_field, Tensor3 &z_field, Tensor4 &vmr_field, Tensor4 &particle_bulkprop_field, ArrayOfString &particle_bulkprop_names, const ArrayOfArrayOfSpeciesTag &abs_species, const GriddedField4 &atm_fields_compact, const Index &atmosphere_dim, const String &delim, const Numeric &p_min, const Index &check_gridnames, const Verbosity &)
WORKSPACE METHOD: AtmFieldsAndParticleBulkPropFieldFromCompact.
Declarations required for the calculation of absorption coefficients.
void gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac)
The maximum difference from 1 that we allow for a sum check.
void choose_abs_t_pert(Vector &abs_t_pert, ConstVectorView abs_t, ConstVectorView tmin, ConstVectorView tmax, const Numeric &step, const Index &p_interp_order, const Index &t_interp_order, const Verbosity &verbosity)
Chose the temperature perturbations abs_t_pert.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
Numeric pow(const Rational base, Numeric exp)
Power of.
Index species_index_from_species_name(String name)
Return species index for given species name.
Vector t_ref
The reference temperature profile [K].
double draw()
Draws a double from the uniform distribution [0,1)
bool supports_lookup(const ArrayOfRetrievalQuantity &js)
Returns if the array supports lookup table derivatives.
Index npages() const
Returns the number of pages.
Vector p_grid
The pressure grid for the table [Pa].
Header file for interpolation_poly.cc.
void Extract(Matrix &sga, const Index &p_interp_order, const Index &t_interp_order, const Index &h2o_interp_order, const Index &f_interp_order, const Numeric &p, const Numeric &T, ConstVectorView abs_vmrs, ConstVectorView new_f_grid, const Numeric &extpolfac) const
Extract scalar gas absorption coefficients from the lookup table.
void resize(Index n)
Resize function.
bool empty() const
Check if variable is empty.
void find_nonlinear_continua(ArrayOfIndex &cont, const ArrayOfArrayOfSpeciesTag &abs_species, const Verbosity &verbosity)
Find continuum species in abs_species.
A constant view of a Vector.
void abs_xsec_agendaExecute(Workspace &ws, ArrayOfMatrix &abs_xsec_per_species, ArrayOfMatrix &src_xsec_per_species, ArrayOfArrayOfMatrix &dabs_xsec_per_species_dx, ArrayOfArrayOfMatrix &dsrc_xsec_per_species_dx, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfIndex &abs_species_active, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const EnergyLevelMap &abs_nlte, const Matrix &abs_vmrs, const Agenda &input_agenda)
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
Index nelem(const Lines &l)
Number of lines.
const Index GFIELD4_P_GRID
const Vector & GetPgrid() const
Index nbooks() const
Returns the number of books.
void resize(Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
ArrayOfGridPosPoly fgp_default
Frequency grid positions.
Structure to store a grid position for higher order interpolation.
void seed(unsigned long int n, const Verbosity &verbosity)
Seeds the Rng with the integer argument.
void propmat_clearsky_agendaExecute(Workspace &ws, ArrayOfPropagationMatrix &propmat_clearsky, ArrayOfStokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_dx_source, ArrayOfStokesVector &nlte_dsource_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Vector &rtp_mag, const Vector &rtp_los, const Numeric rtp_pressure, const Numeric rtp_temperature, const EnergyLevelMap &rtp_nlte, const Vector &rtp_vmr, const Agenda &input_agenda)
Header file for helper functions for OpenMP.
Auxiliary data for isotopologues.
Internal cloudbox functions.
void propmat_clearskyInit(ArrayOfPropagationMatrix &propmat_clearsky, ArrayOfStokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_dx_source, ArrayOfStokesVector &nlte_dsource_dx, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Index &stokes_dim, const Index &propmat_clearsky_agenda_checked, const Index &nlte_do, const Verbosity &)
WORKSPACE METHOD: propmat_clearskyInit.
Index ncols() const
Returns the number of columns.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
void parse_atmcompact_speciesname(String &species_name, const String &field_name, const String &delim)
void resize(Index l, Index v, Index s, Index b, Index p, Index r, Index c)
Resize function.
void abs_lookupTestAccMC(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Index &mc_seed, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccMC.
void abs_speciesAdd2(Workspace &ws, ArrayOfArrayOfSpeciesTag &abs_species, ArrayOfRetrievalQuantity &jq, Agenda &jacobian_agenda, Index &propmat_clearsky_agenda_checked, Index &abs_xsec_agenda_checked, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &rq_p_grid, const Vector &rq_lat_grid, const Vector &rq_lon_grid, const String &species, const String &mode, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesAdd2.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
This file contains declerations of functions of physical character.
Index nrows() const
Returns the number of rows.
void abs_lookupSetup(Vector &abs_p, Vector &abs_t, Vector &abs_t_pert, Matrix &abs_vmrs, ArrayOfArrayOfSpeciesTag &abs_nls, Vector &abs_nls_pert, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const Index &atmfields_checked, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Numeric &p_step10, const Numeric &t_step, const Numeric &h2o_step, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupSetup.
const Index GFIELD4_FIELD_NAMES
void resize(Index b, Index p, Index r, Index c)
Resize function.
Numeric sqrt(const Rational r)
Square root.
void resize(Index r, Index c)
Resize function.