69 const Index& stokes_dim,
75 throw runtime_error(
"No need to use this method with *iy_unit* = \"1\".");
79 os <<
"The spectrum matrix *iy* is required to have original radiance\n" 80 <<
"unit, but this seems not to be the case. This as a value above\n" 81 <<
"1e-3 is found in *iy*.";
82 throw runtime_error(os.
str());
87 for (
Index is = 0; is < stokes_dim; is++) {
94 if (iy_aux_vars[
i] ==
"iy" || iy_aux_vars[
i] ==
"Error" ||
95 iy_aux_vars[
i] ==
"Error (uncorrelated)") {
106 const Index& atmfields_checked,
107 const Index& atmgeom_checked,
110 const Index& cloudbox_on,
111 const Index& cloudbox_checked,
112 const Index& scat_data_checked,
119 const Agenda& iy_main_agenda,
123 if (atmfields_checked != 1)
125 "The atmospheric fields must be flagged to have\n" 126 "passed a consistency check (atmfields_checked=1).");
127 if (atmgeom_checked != 1)
129 "The atmospheric geometry must be flagged to have\n" 130 "passed a consistency check (atmgeom_checked=1).");
131 if (cloudbox_checked != 1)
133 "The cloudbox must be flagged to have\n" 134 "passed a consistency check (cloudbox_checked=1).");
136 if (scat_data_checked != 1)
138 "The scattering data must be flagged to have\n" 139 "passed a consistency check (scat_data_checked=1).");
142 Tensor3 iy_transmission(0, 0, 0);
166 if (std::isnan(iy(
i, 0)))
167 throw runtime_error(
"One or several NaNs found in *iy*.");
187 const Index& stokes_dim,
189 const Index& atmosphere_dim,
201 const Index& cloudbox_on,
204 const Index& jacobian_do,
208 const Agenda& propmat_clearsky_agenda,
209 const Agenda& water_p_eq_agenda,
210 const Agenda& iy_main_agenda,
211 const Agenda& iy_space_agenda,
212 const Agenda& iy_surface_agenda,
213 const Agenda& iy_cloudbox_agenda,
214 const Index& iy_agenda_call1,
215 const Tensor3& iy_transmission,
217 const Tensor3& surface_props_data,
228 if (rbi < 1 || rbi > 9)
230 "ppath.background is invalid. Check your " 231 "calculation of *ppath*?");
232 if (!iy_agenda_call1 && np == 1 && rbi == 2)
234 "A secondary propagation path starting at the " 235 "surface and is going directly into the surface " 236 "is found. This is not allowed.");
240 Index j_analytical_do = 0;
243 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
245 ArrayOfIndex jac_species_i(nq), jac_scat_i(nq), jac_is_t(nq), jac_wind_i(nq);
248 if (j_analytical_do) {
276 Index auxOptDepth = -1;
279 iy_aux[
i].resize(nf, ns);
282 if (iy_aux_vars[
i] ==
"Radiative background")
284 else if (iy_aux_vars[
i] ==
"Optical depth")
288 os <<
"The only allowed strings in *iy_aux_vars* are:\n" 289 <<
" \"Radiative background\"\n" 290 <<
" \"Optical depth\"\n" 291 <<
"but you have selected: \"" << iy_aux_vars[
i] <<
"\"";
292 throw runtime_error(os.
str());
297 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
298 ppvar_trans_partial.
resize(np, nf, ns, ns);
299 ppvar_iy.
resize(nf, ns, np);
315 if (np == 1 && rbi == 1) {
322 ppvar_trans_cumulat = 1;
345 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
359 Index temperature_derivative_position = -1;
362 if (j_analytical_do) {
370 temperature_derivative_position = iq;
371 do_hse = jacobian_quantities[iq].Subtag() ==
375 const bool temperature_jacobian =
379 for (
Index ip = 0; ip < np; ip++) {
381 B, dB_dT, ppvar_f(
joker, ip), ppvar_t[ip], temperature_jacobian);
389 propmat_clearsky_agenda,
392 ppvar_mag(
joker, ip),
395 ppvar_vmr(
joker, ip),
407 ppvar_vmr(
joker, ip),
423 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
425 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
436 temperature_derivative_position);
452 swap(K_past, K_this);
453 swap(dK_past_dx, dK_this_dx);
463 iy_trans_new = tot_tra[np - 1];
468 if (auxOptDepth >= 0)
469 for (
Index iv = 0; iv < nf; iv++)
470 iy_aux[auxOptDepth](iv, 0) = -std::log(tot_tra[np - 1](iv, 0, 0));
496 lvl_rad[np - 1] = iy;
499 for (
Index ip = np - 2; ip >= 0; ip--) {
500 lvl_rad[ip] = lvl_rad[ip + 1];
510 dlyr_tra_above[ip + 1],
511 dlyr_tra_below[ip + 1],
517 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
527 if (j_analytical_do) {
548 if (iy_agenda_call1) {
579 const Index& stokes_dim,
581 const Index& atmosphere_dim,
593 const Index& cloudbox_on,
596 const Index& jacobian_do,
600 const Agenda& propmat_clearsky_agenda,
601 const Agenda& water_p_eq_agenda,
602 const Agenda& iy_main_agenda,
603 const Agenda& iy_space_agenda,
604 const Agenda& iy_surface_agenda,
605 const Agenda& iy_cloudbox_agenda,
606 const Index& iy_agenda_call1,
607 const Tensor3& iy_transmission,
609 const Tensor3& surface_props_data,
620 if (rbi < 1 || rbi > 9)
622 "ppath.background is invalid. Check your " 623 "calculation of *ppath*?");
624 if (!iy_agenda_call1 && np == 1 && rbi == 2)
626 "A secondary propagation path starting at the " 627 "surface and is going directly into the surface " 628 "is found. This is not allowed.");
632 Index j_analytical_do = 0;
635 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
637 ArrayOfIndex jac_species_i(nq), jac_scat_i(nq), jac_is_t(nq), jac_wind_i(nq);
640 if (j_analytical_do) {
668 Index auxOptDepth = -1;
671 iy_aux[
i].resize(nf, ns);
674 if (iy_aux_vars[
i] ==
"Radiative background")
676 else if (iy_aux_vars[
i] ==
"Optical depth")
680 os <<
"The only allowed strings in *iy_aux_vars* are:\n" 681 <<
" \"Radiative background\"\n" 682 <<
" \"Optical depth\"\n" 683 <<
"but you have selected: \"" << iy_aux_vars[
i] <<
"\"";
684 throw runtime_error(os.
str());
689 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
690 ppvar_trans_partial.
resize(np, nf, ns, ns);
691 ppvar_iy.
resize(nf, ns, np);
707 if (np == 1 && rbi == 1) {
714 ppvar_trans_cumulat = 1;
737 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
745 for (
Index ip = 0; ip < np; ip++) {
755 Index temperature_derivative_position = -1;
758 if (j_analytical_do) {
760 for (
Index ip = 0; ip < np; ip++) {
761 dK_dx[ip].resize(nq);
767 temperature_derivative_position = iq;
768 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
771 const bool temperature_jacobian =
774 Agenda l_propmat_clearsky_agenda(propmat_clearsky_agenda);
777 bool do_abort =
false;
780 #pragma omp parallel for if (!arts_omp_in_parallel()) \ 781 firstprivate(l_ws, l_propmat_clearsky_agenda, a, B, dB_dT, S, da_dx, dS_dx) 782 for (
Index ip = 0; ip < np; ip++) {
783 if (do_abort)
continue;
786 B, dB_dT, ppvar_f(
joker, ip), ppvar_t[ip], temperature_jacobian);
794 l_propmat_clearsky_agenda,
797 ppvar_mag(
joker, ip),
800 ppvar_vmr(
joker, ip),
812 ppvar_vmr(
joker, ip),
838 }
catch (
const std::runtime_error& e) {
840 os <<
"Runtime-error in source calculation at index " << ip
843 #pragma omp critical(iyEmissionStandard_source) 846 fail_msg.push_back(os.
str());
851 #pragma omp parallel for if (!arts_omp_in_parallel()) 852 for (
Index ip = 1; ip < np; ip++) {
853 if (do_abort)
continue;
856 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
858 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
869 temperature_derivative_position);
870 }
catch (
const std::runtime_error& e) {
872 os <<
"Runtime-error in transmission calculation at index " << ip
875 #pragma omp critical(iyEmissionStandard_transmission) 878 fail_msg.push_back(os.
str());
885 os <<
"Error messages from failed cases:\n";
886 for (
const auto& msg : fail_msg) {
889 throw std::runtime_error(os.str());
899 iy_trans_new = tot_tra[np - 1];
904 if (auxOptDepth >= 0)
905 for (
Index iv = 0; iv < nf; iv++)
906 iy_aux[auxOptDepth](iv, 0) = -std::log(tot_tra[np - 1](iv, 0, 0));
932 lvl_rad[np - 1] = iy;
935 for (
Index ip = np - 2; ip >= 0; ip--) {
936 lvl_rad[ip] = lvl_rad[ip + 1];
946 dlyr_tra_above[ip + 1],
947 dlyr_tra_below[ip + 1],
953 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
963 if (j_analytical_do) {
984 if (iy_agenda_call1) {
1007 const Index& atmosphere_dim,
1023 const Index& cloudbox_on,
1026 const Matrix& particle_masses,
1027 const Agenda& ppath_agenda,
1029 const Numeric& ppath_lraytrace,
1030 const Index& iy_agenda_call1,
1032 const Tensor3& iy_transmission,
1036 const Index& jacobian_do,
1038 const Agenda& iy_independent_beam_approx_agenda,
1039 const Index& return_atm1d,
1040 const Index& skip_vmr,
1041 const Index& skip_pnd,
1042 const Index& return_masses,
1046 throw runtime_error(
1047 "Jacobians not provided by the method, *jacobian_do* " 1050 throw runtime_error(
1051 "This method does not yet support non-empty *nlte_field*.");
1052 if (!wind_u_field.
empty())
1053 throw runtime_error(
1054 "This method does not yet support non-empty *wind_u_field*.");
1055 if (!wind_v_field.
empty())
1056 throw runtime_error(
1057 "This method does not yet support non-empty *wind_v_field*.");
1058 if (!wind_w_field.
empty())
1059 throw runtime_error(
1060 "This method does not yet support non-empty *wind_w_field*.");
1061 if (!mag_u_field.
empty())
1062 throw runtime_error(
1063 "This method does not yet support non-empty *mag_u_field*.");
1064 if (!mag_v_field.
empty())
1065 throw runtime_error(
1066 "This method does not yet support non-empty *mag_v_field*.");
1067 if (!mag_w_field.
empty())
1068 throw runtime_error(
1069 "This method does not yet support non-empty *mag_w_field*.");
1071 if (return_masses) {
1072 if (pnd_field.
nbooks() != particle_masses.
nrows())
1073 throw runtime_error(
1074 "Sizes of *pnd_field* and *particle_masses* " 1075 "are inconsistent.");
1108 if (cloudbox_on && ppath.
end_lstep == 0) {
1109 Vector los_tmp = rte_los;
1110 if (
abs(rte_los[0]) < 90) {
1132 const Index np = ppath.
np + ppath2.
np - 1;
1140 gp_p[
i] = ppath.
gp_p[ip];
1141 if (atmosphere_dim > 1) {
1143 if (atmosphere_dim == 3) {
1151 gp_p[
i] = ppath2.
gp_p[ip];
1152 if (atmosphere_dim > 1) {
1153 gp_lat[
i] = ppath2.
gp_lat[ip];
1154 if (atmosphere_dim == 3) {
1155 gp_lon[
i] = ppath2.
gp_lon[ip];
1162 const Index ip = ppath2.
np -
i - 1;
1163 gp_p[
i] = ppath2.
gp_p[ip];
1164 if (atmosphere_dim > 1) {
1165 gp_lat[
i] = ppath2.
gp_lat[ip];
1166 if (atmosphere_dim == 3) {
1167 gp_lon[
i] = ppath2.
gp_lon[ip];
1173 const Index ip =
i - ppath2.
np + 1;
1174 gp_p[
i] = ppath.
gp_p[ip];
1175 if (atmosphere_dim > 1) {
1177 if (atmosphere_dim == 3) {
1189 itw2p(p1, p_grid, gp_p, itw);
1193 Vector lat_true1(1), lon_true1(1);
1194 if (atmosphere_dim == 3) {
1197 interp(lat_true1, itw, lat_grid, gp1);
1200 interp(lon_true1, itw, lon_grid, gp1);
1201 }
else if (atmosphere_dim == 2) {
1204 interp(lat_true1, itw, lat_true, gp1);
1205 interp(lon_true1, itw, lon_true, gp1);
1207 lat_true1[0] = lat_true[0];
1208 lon_true1[0] = lon_true[0];
1217 t1(
joker, 0, 0), atmosphere_dim, t_field, gp_p, gp_lat, gp_lon, itw);
1222 z1(
joker, 0, 0), atmosphere_dim, z_field, gp_p, gp_lat, gp_lon, itw);
1226 for (
Index is = 0; is < vmr_field.
nbooks(); is++) {
1238 zsurf1(0, 0) = z1(0, 0, 0);
1242 pos1[0] = rte_pos[0];
1244 los1[0] =
abs(rte_los[0]);
1246 if (rte_pos2.
nelem()) {
1252 Index cbox_on1 = cloudbox_on;
1284 const Index extra_bot = ifirst == 0 ? 0 : 1;
1285 const Index extra_top = ilast == np - 1 ? 0 : 1;
1287 cbox_lims1.resize(2);
1288 cbox_lims1[0] = ifirst - extra_bot;
1289 cbox_lims1[1] = ilast + extra_top;
1293 pnd1.
resize(pnd_field.
nbooks(), cbox_lims1[1] - cbox_lims1[0] + 1, 1, 1);
1298 const Index i0 = cbox_lims1[0] +
i;
1325 const Index adim1 = 1;
1359 iy_independent_beam_approx_agenda);
1365 const Index nvmr = skip_vmr ? 0 : vmr1.nbooks();
1367 const Index nmass = return_masses ? particle_masses.
ncols() : 0;
1368 const Index ntot = 2 + nvmr + npnd + nmass;
1370 atm_fields_compact.
resize(ntot, np, 1, 1);
1373 field_names[0] =
"Geometric altitudes";
1377 field_names[1] =
"Temperature";
1383 const Index iout = 2 +
i;
1385 sstr <<
"VMR species " <<
i;
1386 field_names[iout] = sstr.
str();
1387 atm_fields_compact.
data(iout,
joker, 0, 0) = vmr1(i,
joker, 0, 0);
1394 const Index iout = 2 + nvmr +
i;
1396 sstr <<
"Scattering element " <<
i;
1397 field_names[iout] = sstr.
str();
1398 atm_fields_compact.
data(iout,
joker, 0, 0) = 0;
1399 atm_fields_compact.
data(
1400 iout,
Range(cbox_lims1[0], pnd1.
npages()), 0, 0) =
1401 pnd1(i,
joker, 0, 0);
1407 for (
Index i = 0;
i < nmass;
i++) {
1408 const Index iout = 2 + nvmr + npnd +
i;
1410 sstr <<
"Mass category " <<
i;
1411 field_names[iout] = sstr.
str();
1412 atm_fields_compact.
data(iout,
joker, 0, 0) = 0;
1413 for (
Index ip = cbox_lims1[0]; ip < pnd1.
npages(); ip++) {
1415 atm_fields_compact.
data(iout, ip, 0, 0) +=
1416 particle_masses(is, i) * pnd1(is, ip, 0, 0);
1425 "Data created by *iyIndependentBeamApproximation*");
1428 "Atmospheric quantity");
1446 const Index& iy_agenda_call1,
1447 const Tensor3& iy_transmission,
1451 const Index& stokes_dim,
1453 const Agenda& iy_loop_freqs_agenda,
1456 if (!iy_agenda_call1)
1457 throw runtime_error(
1458 "Recursive usage not possible (iy_agenda_call1 must be 1).");
1459 if (iy_transmission.
ncols())
1460 throw runtime_error(
"*iy_transmission* must be empty.");
1483 iy_loop_freqs_agenda);
1487 iy.
resize(nf, stokes_dim);
1489 iy_aux.resize(iy_aux1.
nelem());
1491 iy_aux[
q].resize(nf, stokes_dim);
1494 diy_dx.resize(diy_dx1.
nelem());
1496 diy_dx[
q].resize(diy_dx1[
q].npages(), nf, stokes_dim);
1516 const Index& iy_agenda_call1,
1517 const Tensor3& iy_transmission,
1521 const Index& jacobian_do,
1522 const Index& atmosphere_dim,
1529 const Vector& refellipsoid,
1531 const Index& cloudbox_on,
1533 const Index& stokes_dim,
1536 const Agenda& iy_space_agenda,
1537 const Agenda& surface_rtprop_agenda,
1538 const Agenda& propmat_clearsky_agenda,
1539 const Agenda& ppath_step_agenda,
1541 const Numeric& ppath_lraytrace,
1545 const Index& mc_max_time,
1546 const Index& mc_max_iter,
1547 const Index& mc_min_iter,
1548 const Numeric& mc_taustep_limit,
1549 const Index& t_interp_order,
1552 if (atmosphere_dim != 3)
1553 throw runtime_error(
1554 "Only 3D atmospheres are allowed (atmosphere_dim must be 3)");
1556 throw runtime_error(
1557 "The cloudbox must be activated (cloudbox_on must be 1)");
1559 throw runtime_error(
1560 "This method does not provide any jacobians (jacobian_do must be 0)");
1561 if (!iy_agenda_call1)
1562 throw runtime_error(
1563 "Recursive usage not possible (iy_agenda_call1 must be 1)");
1564 if (iy_transmission.
ncols())
1565 throw runtime_error(
"*iy_transmission* must be empty");
1571 iy.
resize(nf, stokes_dim);
1575 Index auxError = -1;
1578 iy_aux.resize(naux);
1581 if (iy_aux_vars[
i] ==
"Error (uncorrelated)") {
1583 iy_aux[
i].resize(nf, stokes_dim);
1586 os <<
"In *iy_aux_vars* you have included: \"" << iy_aux_vars[
i]
1587 <<
"\"\nThis choice is not recognised.";
1588 throw runtime_error(os.
str());
1600 Matrix pos(1, 3), los(1, 2);
1602 pos(0,
joker) = rte_pos;
1603 los(0,
joker) = rte_los;
1606 Agenda l_ppath_step_agenda(ppath_step_agenda);
1607 Agenda l_iy_space_agenda(iy_space_agenda);
1608 Agenda l_propmat_clearsky_agenda(propmat_clearsky_agenda);
1609 Agenda l_surface_rtprop_agenda(surface_rtprop_agenda);
1612 bool failed =
false;
1615 #pragma omp parallel for if (!arts_omp_in_parallel() && nf > 1) \ 1616 firstprivate(l_ws, \ 1617 l_ppath_step_agenda, \ 1618 l_iy_space_agenda, \ 1619 l_propmat_clearsky_agenda, \ 1620 l_surface_rtprop_agenda) 1621 for (
Index f_index = 0; f_index < nf; f_index++) {
1622 if (failed)
continue;
1631 Index mc_iteration_count;
1649 l_ppath_step_agenda,
1653 l_surface_rtprop_agenda,
1654 l_propmat_clearsky_agenda,
1682 assert(y.
nelem() == stokes_dim);
1684 iy(f_index,
joker) = y;
1686 if (auxError >= 0) {
1687 iy_aux[auxError](f_index,
joker) = mc_error;
1689 }
catch (
const std::exception& e) {
1691 os <<
"Error for f_index = " << f_index <<
" (" << f_grid[f_index]
1694 #pragma omp critical(iyMC_fail) 1697 fail_msg = os.
str();
1703 if (failed)
throw runtime_error(fail_msg);
1710 const Index& jacobian_do,
1714 throw runtime_error(
1715 "*iy_aux* and *iy_aux_vars* must have the same " 1716 "number of elements.");
1719 throw runtime_error(
1720 "This method can not provide any jacobians and " 1721 "*jacobian_do* must be 0.");
1726 if (iy_aux_vars[
i] == aux_var) {
1733 throw runtime_error(
1734 "The selected auxiliary variable to insert in *iy* " 1735 "is either not defined at all or is not set.");
1740 Matrix& ppvar_optical_depth,
1741 const Tensor4& ppvar_trans_cumulat,
1743 ppvar_optical_depth = ppvar_trans_cumulat(
joker,
joker, 0, 0);
1744 transform(ppvar_optical_depth, log, ppvar_optical_depth);
1745 ppvar_optical_depth *= -1;
1758 const Index& atmgeom_checked,
1759 const Index& atmfields_checked,
1760 const Index& atmosphere_dim,
1762 const Index& cloudbox_on,
1763 const Index& cloudbox_checked,
1764 const Index& scat_data_checked,
1765 const Index& sensor_checked,
1766 const Index& stokes_dim,
1768 const Matrix& sensor_pos,
1769 const Matrix& sensor_los,
1770 const Matrix& transmitter_pos,
1771 const Matrix& mblock_dlos_grid,
1772 const Sparse& sensor_response,
1773 const Vector& sensor_response_f,
1775 const Matrix& sensor_response_dlos,
1777 const Agenda& iy_main_agenda,
1778 const Agenda& geo_pos_agenda,
1779 const Agenda& jacobian_agenda,
1780 const Index& jacobian_do,
1790 if (f_grid.
empty()) {
1791 throw runtime_error(
"The frequency grid is empty.");
1794 if (f_grid[0] <= 0) {
1795 throw runtime_error(
"All frequencies in *f_grid* must be > 0.");
1798 if (atmfields_checked != 1)
1799 throw runtime_error(
1800 "The atmospheric fields must be flagged to have\n" 1801 "passed a consistency check (atmfields_checked=1).");
1802 if (atmgeom_checked != 1)
1803 throw runtime_error(
1804 "The atmospheric geometry must be flagged to have\n" 1805 "passed a consistency check (atmgeom_checked=1).");
1806 if (cloudbox_checked != 1)
1807 throw runtime_error(
1808 "The cloudbox must be flagged to have\n" 1809 "passed a consistency check (cloudbox_checked=1).");
1811 if (scat_data_checked != 1)
1812 throw runtime_error(
1813 "The scattering data must be flagged to have\n" 1814 "passed a consistency check (scat_data_checked=1).");
1815 if (sensor_checked != 1)
1816 throw runtime_error(
1817 "The sensor variables must be flagged to have\n" 1818 "passed a consistency check (sensor_checked=1).");
1825 const Index niyb = nf * nlos * stokes_dim;
1834 y_f.
resize(nmblock * n1y);
1835 y_pol.resize(nmblock * n1y);
1838 y_geo.
resize(nmblock * n1y, 5);
1847 Index j_analytical_do = 0;
1853 jacobian.
resize(nmblock * n1y,
1854 jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1);
1867 bool failed =
false;
1870 (nf <= nmblock && nmblock >= nlos)) {
1871 out3 <<
" Parallelizing mblock loop (" << nmblock <<
" iterations)\n";
1876 Agenda l_jacobian_agenda(jacobian_agenda);
1877 Agenda l_iy_main_agenda(iy_main_agenda);
1878 Agenda l_geo_pos_agenda(geo_pos_agenda);
1880 #pragma omp parallel for firstprivate( \ 1881 l_ws, l_jacobian_agenda, l_iy_main_agenda, l_geo_pos_agenda) 1882 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
1884 if (failed)
continue;
1908 sensor_response_pol,
1909 sensor_response_dlos,
1915 jacobian_quantities,
1924 out3 <<
" Not parallelizing mblock loop (" << nmblock <<
" iterations)\n";
1926 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
1928 if (failed)
continue;
1952 sensor_response_pol,
1953 sensor_response_dlos,
1959 jacobian_quantities,
1970 if (failed)
throw runtime_error(fail_msg);
1978 y_aux[
q].resize(nmblock * n1y);
1980 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
1981 const Range rowind =
1987 if (iy_aux_vars[
q] ==
"Error (uncorrelated)") {
1989 const Index row = row0 +
i;
1991 for (
Index j = 0; j < niyb; j++) {
1993 pow(sensor_response(i, j) * iyb_aux_array[mblock_index][
q][j],
1996 y_aux[
q][row] =
sqrt(y_aux[
q][row]);
1999 mult(y_aux[
q][rowind], sensor_response, iyb_aux_array[mblock_index][
q]);
2016 const Index& atmfields_checked,
2017 const Index& atmgeom_checked,
2018 const Index& atmosphere_dim,
2020 const Index& cloudbox_on,
2021 const Index& cloudbox_checked,
2022 const Index& scat_data_checked,
2023 const Index& sensor_checked,
2024 const Index& stokes_dim,
2026 const Matrix& sensor_pos,
2027 const Matrix& sensor_los,
2028 const Matrix& transmitter_pos,
2029 const Matrix& mblock_dlos_grid,
2030 const Sparse& sensor_response,
2031 const Vector& sensor_response_f,
2033 const Matrix& sensor_response_dlos,
2035 const Agenda& iy_main_agenda,
2036 const Agenda& geo_pos_agenda,
2037 const Agenda& jacobian_agenda,
2038 const Index& jacobian_do,
2041 const Index& append_instrument_wfs,
2048 jacobian_indices_copy, any_affine, jacobian_quantities_copy,
true);
2055 if (y.
empty())
throw runtime_error(
"Input *y* is empty. Use *yCalc*");
2056 if (y_f.
nelem() != n1)
2057 throw runtime_error(
"Lengths of input *y* and *y_f* are inconsistent.");
2058 if (y_pol.
nelem() != n1)
2059 throw runtime_error(
"Lengths of input *y* and *y_pol* are inconsistent.");
2060 if (y_pos.
nrows() != n1)
2061 throw runtime_error(
"Sizes of input *y* and *y_pos* are inconsistent.");
2062 if (y_los.
nrows() != n1)
2063 throw runtime_error(
"Sizes of input *y* and *y_los* are inconsistent.");
2064 if (y_geo.
nrows() != n1)
2065 throw runtime_error(
"Sizes of input *y* and *y_geo* are inconsistent.");
2067 nrq1 = jacobian_quantities_copy.
nelem();
2068 if (jacobian.
nrows() != n1)
2069 throw runtime_error(
"Sizes of *y* and *jacobian* are inconsistent.");
2070 if (jacobian.
ncols() != jacobian_indices_copy[nrq1 - 1][1] + 1)
2071 throw runtime_error(
2072 "Size of input *jacobian* and size implied " 2073 "*jacobian_quantities_copy* are inconsistent.");
2079 Matrix y_pos2, y_los2, y_geo2, jacobian2;
2108 sensor_response_pol,
2109 sensor_response_dlos,
2115 jacobian_quantities,
2121 throw runtime_error(
2122 "Different number of columns in *y_pos* between the measurements.");
2124 throw runtime_error(
2125 "Different number of columns in *y_los* between the measurements.");
2133 const Vector y1 = y, y_f1 = y_f;
2134 const Matrix y_pos1 = y_pos, y_los1 = y_los, y_geo1 = y_geo;
2139 y[
Range(0, n1)] = y1;
2140 y[
Range(n1, n2)] = y2;
2143 y_f[
Range(0, n1)] = y_f1;
2144 y_f[
Range(n1, n2)] = y_f2;
2150 y_los.
resize(n1 + n2, y_los1.ncols());
2154 y_geo.
resize(n1 + n2, y_geo1.ncols());
2158 y_pol.resize(n1 + n2);
2160 y_pol[
i] = y_pol1[
i];
2163 y_pol[n1 +
i] = y_pol2[
i];
2173 for (
Index a = 0; a < na; a++) {
2174 y_aux[a].resize(n1 + n2);
2176 y_aux[a][
Range(0, n1)] = y_aux1[a];
2178 y_aux[a][
Range(0, n1)] = 0;
2181 y_aux[a][
Range(n1, n2)] = y_aux2[a];
2183 y_aux[a][
Range(n1, n2)] = 0;
2195 jacobian_quantities = jacobian_quantities_copy;
2196 jacobian_indices = jacobian_indices_copy;
2201 const Index nrq2 = jacobian_quantities2.
nelem();
2204 for (
Index q2 = 0; q2 < nrq2; q2++) {
2209 if (jacobian_quantities2[q2].MainTag() == ABSSPECIES_MAINTAG ||
2210 jacobian_quantities2[q2].MainTag() == TEMPERATURE_MAINTAG ||
2211 jacobian_quantities2[q2].MainTag() == SCATSPECIES_MAINTAG ||
2212 jacobian_quantities2[q2].MainTag() == WIND_MAINTAG ||
2213 jacobian_quantities2[q2].MainTag() == SURFACE_MAINTAG ||
2214 append_instrument_wfs) {
2216 if (jacobian_quantities2[q2].MainTag() ==
2217 jacobian_quantities_copy[
q1].MainTag()) {
2219 if (jacobian_quantities2[q2].MainTag() == ABSSPECIES_MAINTAG) {
2220 if (jacobian_quantities2[q2].Subtag() ==
2221 jacobian_quantities_copy[
q1].Subtag()) {
2222 if (jacobian_quantities2[q2].Mode() ==
2223 jacobian_quantities_copy[
q1].Mode()) {
2227 os <<
"Jacobians for " << jacobian_quantities2[q2].MainTag()
2228 <<
"/" << jacobian_quantities2[q2].Subtag()
2229 <<
" shall be appended.\nThis requires " 2230 <<
"that the same retrieval unit is used " 2231 <<
"but it seems that this requirement is " 2233 throw runtime_error(os.
str());
2238 else if (jacobian_quantities2[q2].MainTag() ==
2240 if (jacobian_quantities2[q2].Subtag() ==
2241 jacobian_quantities_copy[
q1].Subtag()) {
2245 os <<
"Jacobians for " << jacobian_quantities2[q2].MainTag()
2246 <<
"/" << jacobian_quantities2[q2].Subtag()
2247 <<
" shall be appended.\nThis requires " 2248 <<
"that HSE is either ON or OFF for both " 2249 <<
"parts but it seems that this requirement " 2251 throw runtime_error(os.
str());
2253 }
else if (jacobian_quantities[q2].MainTag() ==
2255 if ((jacobian_quantities2[q2].MainTag() ==
2256 jacobian_quantities_copy[
q1].MainTag()) &&
2257 (jacobian_quantities2[q2].Subtag() ==
2258 jacobian_quantities_copy[
q1].Subtag()) &&
2259 (jacobian_quantities2[q2].SubSubtag() ==
2260 jacobian_quantities_copy[
q1].SubSubtag())) {
2265 else if (jacobian_quantities2[q2].Subtag() ==
2266 jacobian_quantities_copy[
q1].Subtag()) {
2275 map_table[q2] = jacobian_quantities.
nelem();
2276 jacobian_quantities.push_back(jacobian_quantities2[q2]);
2278 indices[0] = jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1;
2280 indices[0] + jacobian_indices2[q2][1] - jacobian_indices2[q2][0];
2281 jacobian_indices.push_back(indices);
2285 map_table[q2] = pos;
2287 ArrayOfVector grids1 = jacobian_quantities_copy[pos].Grids();
2289 bool any_wrong =
false;
2294 if (grids1[g].
nelem() != grids2[g].
nelem()) {
2297 for (
Index e = 0; e < grids1[g].
nelem(); e++) {
2300 if ((v1 == 0 &&
abs(v2) > 1e-9) ||
abs(v1 - v2) / v1 > 1e-6) {
2309 os <<
"Jacobians for " << jacobian_quantities2[q2].MainTag() <<
"/" 2310 << jacobian_quantities2[q2].Subtag()
2311 <<
" shall be appended.\nThis requires that the " 2312 <<
"same grids are used for both measurements,\nbut " 2313 <<
"it seems that this requirement is not met.";
2314 throw runtime_error(os.
str());
2321 const Index nrq = jacobian_quantities.
nelem();
2322 const Matrix jacobian1 = jacobian;
2324 jacobian.
resize(n1 + n2, jacobian_indices[nrq - 1][1] + 1);
2328 jacobian(
Range(0, n1),
Range(0, jacobian_indices_copy[nrq1 - 1][1] + 1)) =
2331 for (
Index q2 = 0; q2 < nrq2; q2++) {
2332 jacobian(
Range(n1, n2),
2333 Range(jacobian_indices[map_table[q2]][0],
2334 jacobian_indices[map_table[q2]][1] -
2335 jacobian_indices[map_table[q2]][0] + 1)) =
2338 Range(jacobian_indices2[q2][0],
2339 jacobian_indices2[q2][1] - jacobian_indices2[q2][0] + 1));
2351 if (iy_unit ==
"1") {
2352 throw runtime_error(
"No need to use this method with *iy_unit* = \"1\".");
2355 if (
max(y) > 1e-3) {
2357 os <<
"The spectrum vector *y* is required to have original radiance\n" 2358 <<
"unit, but this seems not to be the case. This as a value above\n" 2359 <<
"1e-3 is found in *y*.";
2360 throw runtime_error(os.
str());
2367 const bool do_j = jacobian.
nrows() == ny;
2370 if (do_j &&
max(jacobian) > 1e-3) {
2372 os <<
"The method can not be used with jacobian quantities that are not\n" 2373 <<
"obtained through radiative transfer calculations. One example on\n" 2374 <<
"quantity that can not be handled is *jacobianAddPolyfit*.\n" 2375 <<
"The maximum value of *jacobian* indicates that one or several\n" 2376 <<
"such jacobian quantities are included.";
2377 throw runtime_error(os.
str());
2382 if (iy_unit ==
"PlanckBT") {
2395 while (i0 + n < ny && y_f[i0] == y_f[i0 + n]) {
2401 bool any_quv =
false;
2406 i_pol[
i] = y_pol[ix];
2407 if (i_pol[i] > 1 && i_pol[i] < 5) {
2416 if (any_quv && i_pol[0] != 1) {
2418 os <<
"The conversion to PlanckBT, of the Jacobian and " 2419 <<
"errors for Q, U and V, requires that I (first Stokes " 2420 <<
"element) is at hand and that the data are sorted in " 2421 <<
"such way that I comes first for each frequency.";
2422 throw runtime_error(os.
str());
2434 y[ii] = yv(0,
joker);
2450 i_pol[0] = y_pol[
i];
INDEX Index
The type to use for all integer numbers and indices.
void get_iy_of_background(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, ConstTensor3View iy_transmission, const Index &iy_id, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, ConstVectorView rte_pos2, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, ConstVectorView f_grid, const String &iy_unit, ConstTensor3View surface_props_data, const Agenda &iy_main_agenda, const Agenda &iy_space_agenda, const Agenda &iy_surface_agenda, const Agenda &iy_cloudbox_agenda, const Index &iy_agenda_call1, const Verbosity &verbosity)
Determines iy of the "background" of a propgation path.
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
void get_ppath_f(Matrix &ppath_f, const Ppath &ppath, ConstVectorView f_grid, const Index &atmosphere_dim, const Numeric &rte_alonglos_v, ConstMatrixView ppath_wind)
Determines the Doppler shifted frequencies along the propagation path.
void get_stepwise_clearsky_propmat(Workspace &ws, PropagationMatrix &K, StokesVector &S, Index <e, ArrayOfPropagationMatrix &dK_dx, ArrayOfStokesVector &dS_dx, const Agenda &propmat_clearsky_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, ConstVectorView ppath_f_grid, ConstVectorView ppath_magnetic_field, ConstVectorView ppath_line_of_sight, const EnergyLevelMap &ppath_nlte, ConstVectorView ppath_vmrs, const Numeric &ppath_temperature, const Numeric &ppath_pressure, const ArrayOfIndex &jacobian_species, const bool &jacobian_do)
Gets the clearsky propgation matrix and NLTE contributions.
void iy_transmission_mult(Tensor3 &iy_trans_total, ConstTensor3View iy_trans_old, ConstTensor3View iy_trans_new)
Multiplicates iy_transmission with transmissions.
Index nelem() const
Number of elements.
Declarations having to do with the four output streams.
void yCalc(Workspace &ws, Vector &y, Vector &y_f, ArrayOfIndex &y_pol, Matrix &y_pos, Matrix &y_los, ArrayOfVector &y_aux, Matrix &y_geo, Matrix &jacobian, const Index &atmgeom_checked, const Index &atmfields_checked, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &scat_data_checked, const Index &sensor_checked, const Index &stokes_dim, const Vector &f_grid, const Matrix &sensor_pos, const Matrix &sensor_los, const Matrix &transmitter_pos, const Matrix &mblock_dlos_grid, const Sparse &sensor_response, const Vector &sensor_response_f, const ArrayOfIndex &sensor_response_pol, const Matrix &sensor_response_dlos, const String &iy_unit, const Agenda &iy_main_agenda, const Agenda &geo_pos_agenda, const Agenda &jacobian_agenda, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &iy_aux_vars, const Verbosity &verbosity)
WORKSPACE METHOD: yCalc.
Matrix los
Line-of-sight at each ppath point.
Routines for setting up the jacobian.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
const Tensor4 & Data() const noexcept
Energy level type.
void stepwise_transmission(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dtemp1, const Numeric &dr_dtemp2, const Index temp_deriv_pos)
Set the stepwise transmission matrix.
void yCalc_mblock_loop_body(bool &failed, String &fail_msg, ArrayOfArrayOfVector &iyb_aux_array, Workspace &ws, Vector &y, Vector &y_f, ArrayOfIndex &y_pol, Matrix &y_pos, Matrix &y_los, Matrix &y_geo, Matrix &jacobian, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Matrix &sensor_pos, const Matrix &sensor_los, const Matrix &transmitter_pos, const Matrix &mblock_dlos_grid, const Sparse &sensor_response, const Vector &sensor_response_f, const ArrayOfIndex &sensor_response_pol, const Matrix &sensor_response_dlos, const String &iy_unit, const Agenda &iy_main_agenda, const Agenda &geo_pos_agenda, const Agenda &jacobian_agenda, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfIndex &jacobian_indices, const ArrayOfString &iy_aux_vars, const Verbosity &verbosity, const Index &mblock_index, const Index &n1y, const Index &j_analytical_do)
Performs calculations for one measurement block, on y-level.
const String SCATSPECIES_MAINTAG
Vector lstep
The length between ppath points.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
Index npages() const
Returns the number of pages.
bool empty() const
Returns true if variable size is zero.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
bool empty() const
Check if variable is empty.
const String WIND_MAINTAG
void rtmethods_jacobian_init(ArrayOfIndex &jac_species_i, ArrayOfIndex &jac_scat_i, ArrayOfIndex &jac_is_t, ArrayOfIndex &jac_wind_i, ArrayOfIndex &jac_mag_i, ArrayOfIndex &jac_other, ArrayOfTensor3 &diy_dx, ArrayOfTensor3 &diy_dpath, const Index &ns, const Index &nf, const Index &np, const Index &nq, const ArrayOfArrayOfSpeciesTag &abs_species, const Index &cloudbox_on, const ArrayOfString &scat_species, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &iy_agenda_call1, const bool is_active)
This function fixes the initial steps around Jacobian calculations, to be done inside radiative trans...
Matrix pos
The distance between start pos and the last position in pos.
void get_ppath_atmvars(Vector &ppath_p, Vector &ppath_t, EnergyLevelMap &ppath_nlte, Matrix &ppath_vmr, Matrix &ppath_wind, Matrix &ppath_mag, const Ppath &ppath, const Index &atmosphere_dim, ConstVectorView p_grid, ConstTensor3View t_field, const EnergyLevelMap &nlte_field, ConstTensor4View vmr_field, ConstTensor3View wind_u_field, ConstTensor3View wind_v_field, ConstTensor3View wind_w_field, ConstTensor3View mag_u_field, ConstTensor3View mag_v_field, ConstTensor3View mag_w_field)
Determines pressure, temperature, VMR, winds and magnetic field for each propgataion path point...
void iyCalc(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, const Index &atmfields_checked, const Index &atmgeom_checked, const ArrayOfString &iy_aux_vars, const Index &iy_id, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &scat_data_checked, const Vector &f_grid, const EnergyLevelMap &nlte_field, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const String &iy_unit, const Agenda &iy_main_agenda, const Verbosity &)
WORKSPACE METHOD: iyCalc.
void iyApplyUnit(Matrix &iy, ArrayOfMatrix &iy_aux, const Index &stokes_dim, const Vector &f_grid, const ArrayOfString &iy_aux_vars, const String &iy_unit, const Verbosity &)
WORKSPACE METHOD: iyApplyUnit.
Stokes vector is as Propagation matrix but only has 4 possible values.
void resize(const GriddedField4 &gf)
Make this GriddedField4 the same size as the given one.
constexpr Index get_start() const
Returns the start index of the range.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
const String TEMPERATURE_MAINTAG
Index nelem() const
Returns the number of elements.
Array< RadiationVector > ArrayOfRadiationVector
void MCGeneral(Workspace &ws, Vector &y, Index &mc_iteration_count, Vector &mc_error, Tensor3 &mc_points, ArrayOfIndex &mc_source_domain, ArrayOfIndex &mc_scat_order, const MCAntenna &mc_antenna, const Vector &f_grid, const Index &f_index, const Matrix &sensor_pos, const Matrix &sensor_los, const Index &stokes_dim, const Index &atmosphere_dim, const Agenda &ppath_step_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Agenda &iy_space_agenda, const Agenda &surface_rtprop_agenda, const Agenda &propmat_clearsky_agenda, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Tensor3 &t_field, const Tensor4 &vmr_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &scat_data_checked, const Index &cloudbox_checked, const String &iy_unit, const Index &mc_seed, const Numeric &std_err, const Index &max_time, const Index &max_iter, const Index &min_iter, const Numeric &taustep_limit, const Index &l_mc_scat_order, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: MCGeneral.
Index ppath_what_background(const Ppath &ppath)
Returns the case number for the radiative background.
Numeric end_lstep
The distance between end pos and the first position in pos.
void iyReplaceFromAux(Matrix &iy, const ArrayOfMatrix &iy_aux, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const String &aux_var, const Verbosity &)
WORKSPACE METHOD: iyReplaceFromAux.
void ppvar_optical_depthFromPpvar_trans_cumulat(Matrix &ppvar_optical_depth, const Tensor4 &ppvar_trans_cumulat, const Verbosity &)
WORKSPACE METHOD: ppvar_optical_depthFromPpvar_trans_cumulat.
const Index GFIELD4_LON_GRID
void iyEmissionStandardSequential(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, Vector &ppvar_p, Vector &ppvar_t, EnergyLevelMap &ppvar_nlte, Matrix &ppvar_vmr, Matrix &ppvar_wind, Matrix &ppvar_mag, Matrix &ppvar_f, Tensor3 &ppvar_iy, Tensor4 &ppvar_trans_cumulat, Tensor4 &ppvar_trans_partial, const Index &iy_id, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, 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 Index &cloudbox_on, const String &iy_unit, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Vector &rte_pos2, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &iy_main_agenda, const Agenda &iy_space_agenda, const Agenda &iy_surface_agenda, const Agenda &iy_cloudbox_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Numeric &rte_alonglos_v, const Tensor3 &surface_props_data, const Verbosity &verbosity)
WORKSPACE METHOD: iyEmissionStandardSequential.
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. ...
Index ncols() const
Returns the number of columns.
void ppath_agendaExecute(Workspace &ws, Ppath &ppath, const Numeric ppath_lmax, const Numeric ppath_lraytrace, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Index cloudbox_on, const Index ppath_inside_cloudbox_do, const Vector &f_grid, const Agenda &input_agenda)
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
The global header file for ARTS.
void iyIndependentBeamApproximation(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, GriddedField4 &atm_fields_compact, const Index &iy_id, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &lat_true, const Vector &lon_true, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const EnergyLevelMap &nlte_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 Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const Matrix &particle_masses, const Agenda &ppath_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &iy_agenda_call1, const String &iy_unit, const Tensor3 &iy_transmission, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Index &jacobian_do, const ArrayOfString &iy_aux_vars, const Agenda &iy_independent_beam_approx_agenda, const Index &return_atm1d, const Index &skip_vmr, const Index &skip_pnd, const Index &return_masses, const Verbosity &)
WORKSPACE METHOD: iyIndependentBeamApproximation.
_CS_string_type str() const
void apply_iy_unit2(Tensor3View J, ConstMatrixView iy, const String &iy_unit, ConstVectorView f_grid, const Numeric &n, const ArrayOfIndex &i_pol)
Largely as apply_iy_unit but operates on jacobian data.
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
Array< TransmissionMatrix > ArrayOfTransmissionMatrix
Index ncols() const
Returns the number of columns.
void stepwise_source(RadiationVector &J, ArrayOfRadiationVector &dJ, const PropagationMatrix &K, const StokesVector &a, const StokesVector &S, const ArrayOfPropagationMatrix &dK, const ArrayOfStokesVector &da, const ArrayOfStokesVector &dS, const ConstVectorView B, const ConstVectorView dB_dT, const ArrayOfRetrievalQuantity &jacobian_quantities, const bool &jacobian_do)
Set the stepwise source.
Stuff related to the transmission matrix.
#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do)
void set_grid(Index i, const Vector &g)
Set a numeric grid.
void interp_cloudfield_gp2itw(VectorView itw, GridPos &gp_p_out, GridPos &gp_lat_out, GridPos &gp_lon_out, const GridPos &gp_p_in, const GridPos &gp_lat_in, const GridPos &gp_lon_in, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
Converts atmospheric a grid position to weights for interpolation of a field defined ONLY inside the ...
void rtmethods_unit_conversion(Matrix &iy, ArrayOfTensor3 &diy_dx, Tensor3 &ppvar_iy, const Index &ns, const Index &np, const Vector &f_grid, const Ppath &ppath, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &j_analytical_do, const String &iy_unit)
This function handles the unit conversion to be done at the end of some radiative transfer WSMs...
Index nrows() const
Returns the number of rows.
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const Tensor3 &iy_transmission, const ArrayOfString &iy_aux_vars, const Index iy_id, const String &iy_unit, const Index cloudbox_on, const Index jacobian_do, const Vector &f_grid, const EnergyLevelMap &nlte_field, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Agenda &input_agenda)
void iyEmissionStandard(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, Vector &ppvar_p, Vector &ppvar_t, EnergyLevelMap &ppvar_nlte, Matrix &ppvar_vmr, Matrix &ppvar_wind, Matrix &ppvar_mag, Matrix &ppvar_f, Tensor3 &ppvar_iy, Tensor4 &ppvar_trans_cumulat, Tensor4 &ppvar_trans_partial, const Index &iy_id, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, 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 Index &cloudbox_on, const String &iy_unit, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Vector &rte_pos2, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &iy_main_agenda, const Agenda &iy_space_agenda, const Agenda &iy_surface_agenda, const Agenda &iy_cloudbox_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Numeric &rte_alonglos_v, const Tensor3 &surface_props_data, const Verbosity &verbosity)
WORKSPACE METHOD: iyEmissionStandard.
NUMERIC Numeric
The type to use for all floating point numbers.
void set_pencil_beam()
set_pencil_beam
void apply_iy_unit(MatrixView iy, const String &iy_unit, ConstVectorView f_grid, const Numeric &n, const ArrayOfIndex &i_pol)
Performs conversion from radiance to other units, as well as applies refractive index to fulfill the ...
const Index GFIELD4_LAT_GRID
An Antenna object used by MCGeneral.
void error_if_limb_ppath(const Ppath &ppath)
Throws an error if ppath altitudes not are strictly increasing or decreasing.
void interp_atmfield_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of an atmospheric field...
const Numeric SPEED_OF_LIGHT
Radiation Vector for Stokes dimension 1-4.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
void iyMC(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Vector &rte_pos, const Vector &rte_los, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &stokes_dim, const Vector &f_grid, const ArrayOfArrayOfSingleScatteringData &scat_data, const Agenda &iy_space_agenda, const Agenda &surface_rtprop_agenda, const Agenda &propmat_clearsky_agenda, const Agenda &ppath_step_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Tensor4 &pnd_field, const String &iy_unit, const Numeric &mc_std_err, const Index &mc_max_time, const Index &mc_max_iter, const Index &mc_min_iter, const Numeric &mc_taustep_limit, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: iyMC.
Header file for special_interp.cc.
Propagation path structure and functions.
void iyLoopFrequencies(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const ArrayOfString &iy_aux_vars, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Index &stokes_dim, const Vector &f_grid, const Agenda &iy_loop_freqs_agenda, const Verbosity &)
WORKSPACE METHOD: iyLoopFrequencies.
Numeric pow(const Rational base, Numeric exp)
Power of.
void resize(Index p, Index r, Index c)
Resize function.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
Header file for logic.cc.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
This can be used to make arrays out of anything.
const Index GFIELD4_P_GRID
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
void MCSetSeedFromTime(Index &mc_seed, const Verbosity &)
WORKSPACE METHOD: MCSetSeedFromTime.
void yApplyUnit(Vector &y, Matrix &jacobian, const Vector &y_f, const ArrayOfIndex &y_pol, const String &iy_unit, const Verbosity &)
WORKSPACE METHOD: yApplyUnit.
void iy_independent_beam_approx_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const String &iy_unit, const Tensor3 &iy_transmission, const ArrayOfString &iy_aux_vars, const Index iy_id, const Index atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &lat_true, const Vector &lon_true, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Matrix &z_surface, const Numeric ppath_lmax, const Numeric ppath_lraytrace, const Index cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const Index jacobian_do, const Vector &f_grid, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Agenda &input_agenda)
void update_radiation_vector(RadiationVector &I, ArrayOfRadiationVector &dI1, ArrayOfRadiationVector &dI2, const RadiationVector &J1, const RadiationVector &J2, const ArrayOfRadiationVector &dJ1, const ArrayOfRadiationVector &dJ2, const TransmissionMatrix &T, const TransmissionMatrix &PiT, const ArrayOfTransmissionMatrix &dT1, const ArrayOfTransmissionMatrix &dT2, const RadiativeTransferSolver solver)
Update the Radiation Vector.
void resize(Index n)
Resize function.
bool empty() const
Check if variable is empty.
void rtmethods_jacobian_finalisation(Workspace &ws, ArrayOfTensor3 &diy_dx, ArrayOfTensor3 &diy_dpath, const Index &ns, const Index &nf, const Index &np, const Index &atmosphere_dim, const Ppath &ppath, const Vector &ppvar_p, const Vector &ppvar_t, const Matrix &ppvar_vmr, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Agenda &water_p_eq_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfIndex jac_species_i, const ArrayOfIndex jac_is_t)
This function fixes the last steps to made on the Jacobian in some radiative transfer WSMs...
void get_stepwise_blackbody_radiation(VectorView B, VectorView dB_dT, ConstVectorView ppath_f_grid, const Numeric &ppath_temperature, const bool &do_temperature_derivative)
Get the blackbody radiation at propagation path point.
void adapt_stepwise_partial_derivatives(ArrayOfPropagationMatrix &dK_dx, ArrayOfStokesVector &dS_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, ConstVectorView ppath_f_grid, ConstVectorView ppath_line_of_sight, ConstVectorView ppath_vmrs, const Numeric &ppath_temperature, const Numeric &ppath_pressure, const ArrayOfIndex &jacobian_species, const ArrayOfIndex &jacobian_wind, const Index <e, const Index &atmosphere_dim, const bool &jacobian_do)
Adapts clearsky partial derivatives.
Index np
Number of points describing the ppath.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
void set_name(const String &s)
Set name of this gridded field.
Range get_rowindex_for_mblock(const Sparse &sensor_response, const Index &mblock_index)
Returns the "range" of y corresponding to a measurement block.
Index nelem(const Lines &l)
Number of lines.
void iy_loop_freqs_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const Tensor3 &iy_transmission, const ArrayOfString &iy_aux_vars, const Index iy_id, const Vector &f_grid, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Agenda &input_agenda)
const Index GFIELD4_FIELD_NAMES
Index nbooks() const
Returns the number of books.
void set_grid_name(Index i, const String &s)
Set grid name.
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...
void yCalcAppend(Workspace &ws, Vector &y, Vector &y_f, ArrayOfIndex &y_pol, Matrix &y_pos, Matrix &y_los, ArrayOfVector &y_aux, Matrix &y_geo, Matrix &jacobian, ArrayOfRetrievalQuantity &jacobian_quantities, const Index &atmfields_checked, const Index &atmgeom_checked, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &scat_data_checked, const Index &sensor_checked, const Index &stokes_dim, const Vector &f_grid, const Matrix &sensor_pos, const Matrix &sensor_los, const Matrix &transmitter_pos, const Matrix &mblock_dlos_grid, const Sparse &sensor_response, const Vector &sensor_response_f, const ArrayOfIndex &sensor_response_pol, const Matrix &sensor_response_dlos, const String &iy_unit, const Agenda &iy_main_agenda, const Agenda &geo_pos_agenda, const Agenda &jacobian_agenda, const Index &jacobian_do, const ArrayOfString &iy_aux_vars, const ArrayOfRetrievalQuantity &jacobian_quantities_copy, const Index &append_instrument_wfs, const Verbosity &verbosity)
WORKSPACE METHOD: yCalcAppend.
The structure to describe a propagation path and releated quantities.
const String SURFACE_MAINTAG
Header file for helper functions for OpenMP.
bool is_gp_inside_cloudbox(const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, const bool &include_boundaries, const Index &atmosphere_dim)
This file contains declerations of functions of physical character.
Index nrows() const
Returns the number of rows.
const String ABSSPECIES_MAINTAG
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.
void interp_atmfield_by_itw(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
Declaration of functions in rte.cc.
Numeric sqrt(const Rational r)
Square root.
void resize(Index r, Index c)
Resize function.