67 const Index& stokes_dim,
73 "No need to use this method with *iy_unit* = \"1\".");
76 "The spectrum matrix *iy* is required to have original radiance\n"
77 "unit, but this seems not to be the case. This as a value above\n"
78 "1e-3 is found in *iy*.")
82 for (
Index is = 0; is < stokes_dim; is++) {
88 for (
Index i = 0; i < iy_aux_vars.
nelem(); i++) {
89 if (iy_aux_vars[i] ==
"iy" || iy_aux_vars[i] ==
"Error" ||
90 iy_aux_vars[i] ==
"Error (uncorrelated)") {
102 const Index& atmfields_checked,
103 const Index& atmgeom_checked,
106 const Index& cloudbox_on,
107 const Index& cloudbox_checked,
108 const Index& scat_data_checked,
115 const Agenda& iy_main_agenda,
120 "The atmospheric fields must be flagged to have\n"
121 "passed a consistency check (atmfields_checked=1).");
123 "The atmospheric geometry must be flagged to have\n"
124 "passed a consistency check (atmgeom_checked=1).");
126 "The cloudbox must be flagged to have\n"
127 "passed a consistency check (cloudbox_checked=1).");
130 "The scattering data must be flagged to have\n"
131 "passed a consistency check (scat_data_checked=1).");
134 Tensor3 iy_transmittance(0, 0, 0);
160 "One or several NaNs found in *iy*.");
181 const Index& stokes_dim,
183 const Index& atmosphere_dim,
199 const Vector& refellipsoid,
201 const Numeric& ppath_lraytrace,
202 const Index& cloudbox_on,
203 const Index& gas_scattering_do,
204 const Index& suns_do,
207 const Index& jacobian_do,
212 const Agenda& propmat_clearsky_agenda,
213 const Agenda& water_p_eq_agenda,
214 const String& rt_integration_option,
215 const Agenda& iy_main_agenda,
216 const Agenda& iy_space_agenda,
217 const Agenda& iy_surface_agenda,
218 const Agenda& iy_cloudbox_agenda,
219 const Agenda& gas_scattering_agenda,
220 const Agenda& ppath_step_agenda,
221 const Index& iy_agenda_call1,
222 const Tensor3& iy_transmittance,
224 const Tensor3& surface_props_data,
227 const Index j_analytical_do = jacobian_do ? do_analytical_jacobian<2>(jacobian_quantities) : 0;
231 const Index ns = stokes_dim;
233 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
240 "ppath.background is invalid. Check your "
241 "calculation of *ppath*?");
243 "A secondary propagation path starting at the "
244 "surface and is going directly into the surface "
245 "is found. This is not allowed.");
247 "If suns are present only iy_unit=\"1\" can be used.");
250Jacobian calculation are not supported when gas scattering or suns are included.
251This feature will be added in a future version.
268 Index auxOptDepth = -1;
269 Index auxDirectRad = -1;
270 Index auxRadBackGrnd = -1;
273 iy_aux.resize(iy_aux_vars.
nelem());
277 for (
Index i = 0; i < naux; i++) {
280 if (iy_aux_vars[i] ==
"Radiative background"){
282 iy_aux[cnt].resize(nf, ns);
285 else if (iy_aux_vars[i] ==
"Optical depth"){
289 iy_aux[cnt].resize(nf, ns);
292 else if (iy_aux_vars[i] ==
"Direct radiation"){
295 iy_aux[cnt].resize(nf, ns);
298 else if (iy_aux_vars[i] ==
"Radiation Background"){
300 auxRadBackGrnd = cnt;
301 iy_aux[cnt].resize(nf, ns);
306 "The only allowed strings in *iy_aux_vars* are:\n"
307 " \"Radiative background\"\n"
308 " \"Optical depth\"\n"
309 " \"Direct radiation\"\n"
310 " \"Radiation Background\"\n"
311 "but you have selected: \"", iy_aux_vars[i],
"\"")
316 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
317 ppvar_trans_partial.
resize(np, nf, ns, ns);
318 ppvar_iy.
resize(nf, ns, np);
340 if (np == 1 && rbi == 1) {
347 ppvar_trans_cumulat = 1;
370 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
372 const bool temperature_jacobian =
380 Vector dB_dT(temperature_jacobian ? nf : 0);
384 Index temperature_derivative_position = -1;
387 if (j_analytical_do) {
388 for (
Index ip = 0; ip < np; ip++) {
389 dK_dx[ip].resize(nq);
394 if (jacobian_quantities[iq] == Jacobian::Atm::Temperature) {
395 temperature_derivative_position = iq;
396 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
405 const Vector in_los_dummy;
406 const Vector out_los_dummy;
415 bool do_abort =
false;
418#pragma omp parallel for if (!arts_omp_in_parallel()) \
419 firstprivate(wss, a, B, dB_dT, S, da_dx, dS_dx)
420 for (
Index ip = 0; ip < np; ip++) {
421 if (do_abort)
continue;
424 B, dB_dT, ppvar_f(
joker, ip), ppvar_t[ip], temperature_jacobian);
433 propmat_clearsky_agenda,
436 ppvar_mag(
joker, ip),
439 ppvar_vmr(
joker, ip),
457 if (gas_scattering_do) {
463 if (suns_do && ppvar_p[ip] > minP) {
496 transmitted_sunlight,
497 dtransmitted_sunlight_dummy,
515 cloudbox_limits_dummy,
528 propmat_clearsky_agenda,
530 gas_scattering_agenda,
537 for (
Index i_sun = 0; i_sun < suns.
nelem(); i_sun++) {
538 if (suns_visible[i_sun]) {
543 scattered_sunlight_isun,
547 ppvar_vmr(
joker, ip),
548 transmitted_sunlight[i_sun],
551 gas_scattering_agenda);
553 scattered_sunlight += scattered_sunlight_isun;
570 ppvar_vmr(
joker, ip),
574 gas_scattering_agenda);
604 }
catch (
const std::runtime_error& e) {
606 os <<
"Runtime-error in source calculation at index " << ip
609#pragma omp critical(iyEmissionStandard_source)
612 fail_msg.push_back(os.str());
617#pragma omp parallel for if (!arts_omp_in_parallel())
618 for (
Index ip = 1; ip < np; ip++) {
619 if (do_abort)
continue;
622 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
624 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
635 temperature_derivative_position);
637 r[ip - 1] = ppath.
lstep[ip - 1];
638 if (temperature_derivative_position >= 0){
639 dr_below[ip][temperature_derivative_position] = dr_dT_past;
640 dr_above[ip][temperature_derivative_position] = dr_dT_this;
642 }
catch (
const std::runtime_error& e) {
644 os <<
"Runtime-error in transmission calculation at index " << ip
647#pragma omp critical(iyEmissionStandard_transmission)
650 fail_msg.push_back(os.str());
656 "Error messages from failed cases:\n", fail_msg)
665 iy_trans_new = tot_tra[np - 1];
670 if (auxOptDepth >= 0)
671 for (
Index iv = 0; iv < nf; iv++)
672 iy_aux[auxOptDepth](iv, 0) = -std::log(tot_tra[np - 1](iv, 0, 0));
699 Matrix iy_direct(nf, ns, 0.);
704 total_transmission = tot_tra[np - 1];
719 for (
Index iv = 0; iv < nf; iv++) {
722 iy_direct_toa(iv,
joker));
731 if (auxDirectRad >= 0)
732 iy_aux[auxDirectRad] = iy_direct;
735 if (auxRadBackGrnd >= 0)
736 iy_aux[auxRadBackGrnd] = iy;
739 lvl_rad[np - 1] = iy;
742 if (rt_integration_option ==
"first order" || rt_integration_option ==
"default") {
743 for (
Index ip = np - 2; ip >= 0; ip--) {
744 lvl_rad[ip] = lvl_rad[ip + 1];
754 dlyr_tra_above[ip + 1],
755 dlyr_tra_below[ip + 1],
768 }
else if (rt_integration_option ==
"second order") {
769 for (
Index ip = np - 2; ip >= 0; ip--) {
770 lvl_rad[ip] = lvl_rad[ip + 1];
780 dlyr_tra_above[ip + 1],
781 dlyr_tra_below[ip + 1],
800 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
810 if (j_analytical_do) {
830 if (iy_agenda_call1) {
861 const Index& stokes_dim,
863 const Index& atmosphere_dim,
875 const Index& cloudbox_on,
883 const Index& jacobian_do,
885 const Agenda& propmat_clearsky_agenda,
886 const Agenda& water_p_eq_agenda,
887 const String& rt_integration_option,
888 const Agenda& iy_main_agenda,
889 const Agenda& iy_space_agenda,
890 const Agenda& iy_surface_agenda,
891 const Agenda& iy_cloudbox_agenda,
892 const Index& iy_agenda_call1,
893 const Tensor3& iy_transmittance,
897 const Tensor3& surface_props_data,
901 const Index& t_interp_order,
942 propmat_clearsky_agenda,
944 rt_integration_option,
957 const Index j_analytical_do = jacobian_do ? do_analytical_jacobian<1>(jacobian_quantities) : 0;
961 const Index ns = stokes_dim;
963 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
969 if (atmosphere_dim != 1)
971 "With cloudbox on, this method handles only 1D calculations.");
972 if (Naa < 3)
throw runtime_error(
"Naa must be > 2.");
974 if (dpnd_field_dx.
nelem() != jacobian_quantities.
nelem())
976 "*dpnd_field_dx* not properly initialized:\n"
977 "Number of elements in dpnd_field_dx must be equal number of jacobian"
978 " quantities.\n(Note: jacobians have to be defined BEFORE *pnd_field*"
979 " is calculated/set.");
980 if (rbi < 1 || rbi > 9)
982 "ppath.background is invalid. Check your "
983 "calculation of *ppath*?");
984 if (rbi == 3 || rbi == 4)
986 "The propagation path ends inside or at boundary of "
987 "the cloudbox.\nFor this method, *ppath* must be "
988 "calculated in this way:\n ppathCalc( cloudbox_on = 0 ).");
991 if (cloudbox_field.
ncols() != stokes_dim)
993 "Obtained *cloudbox_field* number of Stokes elements inconsistent with "
995 if (cloudbox_field.
nrows() != 1)
997 "Obtained *cloudbox_field* has wrong number of azimuth angles.");
1000 "Obtained *cloudbox_field* number of zenith angles inconsistent with "
1002 if (cloudbox_field.
nbooks() != 1)
1003 throw runtime_error(
1004 "Obtained *cloudbox_field* has wrong number of longitude points.");
1005 if (cloudbox_field.
nshelves() != 1)
1006 throw runtime_error(
1007 "Obtained *cloudbox_field* has wrong number of latitude points.");
1008 if (cloudbox_field.
nvitrines() != cloudbox_limits[1] - cloudbox_limits[0] + 1)
1009 throw runtime_error(
1010 "Obtained *cloudbox_field* number of pressure points inconsistent with "
1011 "*cloudbox_limits*.");
1013 throw runtime_error(
1014 "Obtained *cloudbox_field* number of frequency points inconsistent with "
1031 iy_aux.resize(naux);
1033 for (
Index i = 0; i < naux; i++) {
1034 iy_aux[i].resize(nf, ns);
1036 if (iy_aux_vars[i] ==
"Optical depth") {
1038 else if (iy_aux_vars[i] ==
"Radiative background")
1042 os <<
"The only allowed strings in *iy_aux_vars* are:\n"
1043 <<
" \"Radiative background\"\n"
1044 <<
" \"Optical depth\"\n"
1045 <<
"but you have selected: \"" << iy_aux_vars[i] <<
"\"";
1046 throw runtime_error(os.str());
1051 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
1052 ppvar_trans_partial.
resize(np, nf, ns, ns);
1053 ppvar_iy.
resize(nf, ns, np);
1070 if (np == 1 && rbi == 1) {
1077 ppvar_trans_cumulat = 0;
1078 ppvar_trans_partial = 0;
1079 for (
Index iv = 0; iv < nf; iv++) {
1080 for (
Index is = 0; is < ns; is++) {
1081 ppvar_trans_cumulat(0,iv,is,is) = 1;
1082 ppvar_trans_partial(0,iv,is,is) = 1;
1107 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
1136 Index temperature_derivative_position = -1;
1137 bool do_hse =
false;
1139 if (j_analytical_do) {
1148 if (jacobian_quantities[iq] == Jacobian::Atm::Temperature) {
1149 temperature_derivative_position = iq;
1150 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
1153 const bool temperature_jacobian =
1157 for (
Index ip = 0; ip < np; ip++) {
1159 B, dB_dT, ppvar_f(
joker, ip), ppvar_t[ip], temperature_jacobian);
1167 propmat_clearsky_agenda,
1168 jacobian_quantities,
1170 ppvar_mag(
joker, ip),
1173 ppvar_vmr(
joker, ip),
1178 if (j_analytical_do)
1181 jacobian_quantities,
1188 if (clear2cloudy[ip] + 1) {
1193 jacobian_quantities,
1199 ppvar_t[
Range(ip, 1)],
1205 if (j_analytical_do)
1207 dK_this_dx[iq] += dKp_dx[iq];)
1214 jacobian_quantities,
1215 ppvar_pnd(
joker, ip),
1224 ppvar_t[
Range(ip, 1)],
1230 if (j_analytical_do)
1234 if (j_analytical_do)
1240 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
1242 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
1250 ppath.
lstep[ip - 1],
1253 temperature_derivative_position);
1267 jacobian_quantities,
1270 swap(K_past, K_this);
1271 swap(dK_past_dx, dK_this_dx);
1280 if (iy_agenda_call1)
1281 iy_trans_new = tot_tra[np - 1];
1286 for (
Index i = 0; i < naux; i++)
1287 if (iy_aux_vars[i] ==
"Optical depth")
1288 for (
Index iv = 0; iv < nf; iv++)
1289 iy_aux[i](iv,
joker) = -log(ppvar_trans_cumulat(np - 1, iv, 0, 0));
1298 jacobian_quantities,
1315 lvl_rad[np - 1] = iy;
1318 for (
Index ip = np - 2; ip >= 0; ip--) {
1319 lvl_rad[ip] = lvl_rad[ip + 1];
1329 dlyr_tra_above[ip + 1],
1330 dlyr_tra_below[ip + 1],
1345 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
1349 if (j_analytical_do)
1355 if (j_analytical_do)
1370 jacobian_quantities,
1374 if (iy_agenda_call1)
1382 jacobian_quantities,
1404 const Index& stokes_dim,
1406 const Index& atmosphere_dim,
1418 const Index& cloudbox_on,
1421 const Index& jacobian_do,
1425 const Agenda& propmat_clearsky_agenda,
1426 const Agenda& water_p_eq_agenda,
1427 const String& rt_integration_option,
1428 const Agenda& iy_main_agenda,
1429 const Agenda& iy_space_agenda,
1430 const Agenda& iy_surface_agenda,
1431 const Agenda& iy_cloudbox_agenda,
1432 const Index& iy_agenda_call1,
1433 const Tensor3& iy_transmittance,
1434 const Numeric& rte_alonglos_v,
1435 const Tensor3& surface_props_data,
1438 const Index j_analytical_do = jacobian_do ? do_analytical_jacobian<2>(jacobian_quantities) : 0;
1442 const Index ns = stokes_dim;
1444 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
1451 "ppath.background is invalid. Check your "
1452 "calculation of *ppath*?");
1454 "A secondary propagation path starting at the "
1455 "surface and is going directly into the surface "
1456 "is found. This is not allowed.");
1469 iy_aux.resize(naux);
1471 Index auxOptDepth = -1;
1473 for (
Index i = 0; i < naux; i++) {
1474 iy_aux[i].resize(nf, ns);
1477 if (iy_aux_vars[i] ==
"Radiative background")
1479 else if (iy_aux_vars[i] ==
"Optical depth")
1483 "The only allowed strings in *iy_aux_vars* are:\n"
1484 " \"Radiative background\"\n"
1485 " \"Optical depth\"\n"
1486 "but you have selected: \"", iy_aux_vars[i],
"\"")
1491 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
1492 ppvar_trans_partial.
resize(np, nf, ns, ns);
1493 ppvar_iy.
resize(nf, ns, np);
1515 if (np == 1 && rbi == 1) {
1522 ppvar_trans_cumulat = 0;
1523 ppvar_trans_partial = 0;
1524 for (
Index iv = 0; iv < nf; iv++) {
1525 for (
Index is = 0; is < ns; is++) {
1526 ppvar_trans_cumulat(0,iv,is,is) = 1;
1527 ppvar_trans_partial(0,iv,is,is) = 1;
1553 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
1555 const bool temperature_jacobian =
1565 Vector dB_dT(temperature_jacobian ? nf : 0);
1569 Index temperature_derivative_position = -1;
1570 bool do_hse =
false;
1572 if (j_analytical_do) {
1573 for (
Index ip = 0; ip < np; ip++) {
1574 dK_dx[ip].resize(nq);
1579 if (jacobian_quantities[iq] == Jacobian::Atm::Temperature) {
1580 temperature_derivative_position = iq;
1581 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
1586 bool do_abort =
false;
1591#pragma omp parallel for if (!arts_omp_in_parallel()) \
1592 firstprivate(wss, a, B, dB_dT, S, da_dx, dS_dx)
1593 for (
Index ip = 0; ip < np; ip++) {
1594 if (do_abort)
continue;
1597 B, dB_dT, ppvar_f(
joker, ip), ppvar_t[ip], temperature_jacobian);
1606 propmat_clearsky_agenda,
1607 jacobian_quantities,
1609 ppvar_mag(
joker, ip),
1612 ppvar_vmr(
joker, ip),
1617 if (j_analytical_do)
1620 jacobian_quantities,
1629 if (j_analytical_do)
1643 jacobian_quantities,
1645 }
catch (
const std::runtime_error& e) {
1647 os <<
"Runtime-error in source calculation at index " << ip
1650#pragma omp critical(iyEmissionStandard_source)
1653 fail_msg.push_back(os.str());
1658#pragma omp parallel for if (!arts_omp_in_parallel())
1659 for (
Index ip = 1; ip < np; ip++) {
1660 if (do_abort)
continue;
1663 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
1665 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
1673 ppath.
lstep[ip - 1],
1676 temperature_derivative_position);
1678 r[ip - 1] = ppath.
lstep[ip - 1];
1679 if (temperature_derivative_position >= 0){
1680 dr_below[ip][temperature_derivative_position] = dr_dT_past;
1681 dr_above[ip][temperature_derivative_position] = dr_dT_this;
1683 }
catch (
const std::runtime_error& e) {
1685 os <<
"Runtime-error in transmission calculation at index " << ip
1688#pragma omp critical(iyEmissionStandard_transmission)
1691 fail_msg.push_back(os.str());
1697 "Error messages from failed cases:\n", fail_msg)
1705 if (iy_agenda_call1)
1706 iy_trans_new = tot_tra[np - 1];
1711 if (auxOptDepth >= 0)
1712 for (
Index iv = 0; iv < nf; iv++)
1713 iy_aux[auxOptDepth](iv, 0) = -std::log(tot_tra[np - 1](iv, 0, 0));
1722 jacobian_quantities,
1739 lvl_rad[np - 1] = iy;
1742 if (rt_integration_option ==
"first order" || rt_integration_option ==
"default") {
1743 for (
Index ip = np - 2; ip >= 0; ip--) {
1744 lvl_rad[ip] = lvl_rad[ip + 1];
1754 dlyr_tra_above[ip + 1],
1755 dlyr_tra_below[ip + 1],
1767 }
else if (rt_integration_option ==
"second order") {
1768 for (
Index ip = np - 2; ip >= 0; ip--) {
1769 lvl_rad[ip] = lvl_rad[ip + 1];
1779 dlyr_tra_above[ip + 1],
1780 dlyr_tra_below[ip + 1],
1799 for (
Index ip = 0; ip < lvl_rad.
nelem(); ip++) {
1803 if (j_analytical_do)
1809 if (j_analytical_do) {
1824 jacobian_quantities,
1829 if (iy_agenda_call1) {
1837 jacobian_quantities,
1852 const Index& atmosphere_dim,
1868 const Index& cloudbox_on,
1871 const Matrix& particle_masses,
1872 const Agenda& ppath_agenda,
1874 const Numeric& ppath_lraytrace,
1875 const Index& iy_agenda_call1,
1877 const Tensor3& iy_transmittance,
1881 const Index& jacobian_do,
1883 const Agenda& iy_independent_beam_approx_agenda,
1884 const Index& return_atm1d,
1885 const Index& skip_vmr,
1886 const Index& skip_pnd,
1887 const Index& return_masses,
1891 "Jacobians not provided by the method, *jacobian_do* "
1894 "This method does not yet support non-empty *nlte_field*.");
1896 "This method does not yet support non-empty *wind_u_field*.");
1898 "This method does not yet support non-empty *wind_v_field*.");
1900 "This method does not yet support non-empty *wind_w_field*.");
1902 "This method does not yet support non-empty *mag_u_field*.");
1904 "This method does not yet support non-empty *mag_v_field*.");
1906 "This method does not yet support non-empty *mag_w_field*.");
1908 if (return_masses) {
1910 "Sizes of *pnd_field* and *particle_masses* "
1911 "are inconsistent.");
1944 if (cloudbox_on && ppath.
end_lstep == 0) {
1945 Vector los_tmp = rte_los;
1946 if (
abs(rte_los[0]) < 90) {
1968 const Index np = ppath.
np + ppath2.
np - 1;
1974 for (
Index i = 0; i < ppath.
np; i++) {
1975 const Index ip = ppath.
np - i - 1;
1976 gp_p[i] = ppath.
gp_p[ip];
1977 if (atmosphere_dim > 1) {
1978 gp_lat[i] = ppath.
gp_lat[ip];
1979 if (atmosphere_dim == 3) {
1980 gp_lon[i] = ppath.
gp_lon[ip];
1985 for (
Index i = ppath.
np; i < np; i++) {
1986 const Index ip = i - ppath.
np + 1;
1987 gp_p[i] = ppath2.
gp_p[ip];
1988 if (atmosphere_dim > 1) {
1989 gp_lat[i] = ppath2.
gp_lat[ip];
1990 if (atmosphere_dim == 3) {
1991 gp_lon[i] = ppath2.
gp_lon[ip];
1997 for (
Index i = 0; i < ppath2.
np - 1; i++) {
1998 const Index ip = ppath2.
np - i - 1;
1999 gp_p[i] = ppath2.
gp_p[ip];
2000 if (atmosphere_dim > 1) {
2001 gp_lat[i] = ppath2.
gp_lat[ip];
2002 if (atmosphere_dim == 3) {
2003 gp_lon[i] = ppath2.
gp_lon[ip];
2008 for (
Index i = ppath2.
np - 1; i < np; i++) {
2009 const Index ip = i - ppath2.
np + 1;
2010 gp_p[i] = ppath.
gp_p[ip];
2011 if (atmosphere_dim > 1) {
2012 gp_lat[i] = ppath.
gp_lat[ip];
2013 if (atmosphere_dim == 3) {
2014 gp_lon[i] = ppath.
gp_lon[ip];
2025 itw2p(p1, p_grid, gp_p, itw);
2029 Vector lat_true1(1), lon_true1(1);
2030 if (atmosphere_dim == 3) {
2033 interp(lat_true1, itw, lat_grid, gp1);
2036 interp(lon_true1, itw, lon_grid, gp1);
2037 }
else if (atmosphere_dim == 2) {
2040 interp(lat_true1, itw, lat_true, gp1);
2041 interp(lon_true1, itw, lon_true, gp1);
2043 lat_true1[0] = lat_true[0];
2044 lon_true1[0] = lon_true[0];
2053 t1(
joker, 0, 0), atmosphere_dim, t_field, gp_p, gp_lat, gp_lon, itw);
2058 z1(
joker, 0, 0), atmosphere_dim, z_field, gp_p, gp_lat, gp_lon, itw);
2062 for (
Index is = 0; is < vmr_field.
nbooks(); is++) {
2074 zsurf1(0, 0) = z1(0, 0, 0);
2078 pos1[0] = rte_pos[0];
2080 los1[0] =
abs(rte_los[0]);
2082 if (rte_pos2.
nelem()) {
2088 Index cbox_on1 = cloudbox_on;
2096 for (
Index i = 0; i < np; i++) {
2120 const Index extra_bot = ifirst == 0 ? 0 : 1;
2121 const Index extra_top = ilast == np - 1 ? 0 : 1;
2123 cbox_lims1.resize(2);
2124 cbox_lims1[0] = ifirst - extra_bot;
2125 cbox_lims1[1] = ilast + extra_top;
2129 pnd1.
resize(pnd_field.
nbooks(), cbox_lims1[1] - cbox_lims1[0] + 1, 1, 1);
2134 for (
Index i = extra_bot; i < pnd1.
npages() - extra_top; i++) {
2135 const Index i0 = cbox_lims1[0] + i;
2162 const Index adim1 = 1;
2196 iy_independent_beam_approx_agenda);
2204 const Index nmass = return_masses ? particle_masses.
ncols() : 0;
2205 const Index ntot = 2 + nvmr + npnd + nmass;
2207 atm_fields_compact.
resize(ntot, np, 1, 1);
2210 field_names[0] =
"Geometric altitudes";
2214 field_names[1] =
"Temperature";
2219 for (
Index i = 0; i < nvmr; i++) {
2220 const Index iout = 2 + i;
2222 sstr <<
"VMR species " << i;
2223 field_names[iout] = sstr.str();
2224 atm_fields_compact.
data(iout,
joker, 0, 0) = vmr1(i,
joker, 0, 0);
2230 for (
Index i = 0; i < npnd; i++) {
2231 const Index iout = 2 + nvmr + i;
2233 sstr <<
"Scattering element " << i;
2234 field_names[iout] = sstr.str();
2235 atm_fields_compact.
data(iout,
joker, 0, 0) = 0;
2236 atm_fields_compact.
data(
2237 iout,
Range(cbox_lims1[0], pnd1.
npages()), 0, 0) =
2238 pnd1(i,
joker, 0, 0);
2244 for (
Index i = 0; i < nmass; i++) {
2245 const Index iout = 2 + nvmr + npnd + i;
2247 sstr <<
"Mass category " << i;
2248 field_names[iout] = sstr.str();
2249 atm_fields_compact.
data(iout,
joker, 0, 0) = 0;
2250 for (
Index ip = cbox_lims1[0]; ip < pnd1.
npages(); ip++) {
2252 atm_fields_compact.
data(iout, ip, 0, 0) +=
2253 particle_masses(is, i) * pnd1(is, ip, 0, 0);
2262 "Data created by *iyIndependentBeamApproximation*");
2265 "Atmospheric quantity");
2266 atm_fields_compact.
set_grid(GFIELD4_FIELD_NAMES, field_names);
2267 atm_fields_compact.
set_grid_name(GFIELD4_P_GRID,
"Pressure");
2268 atm_fields_compact.
set_grid(GFIELD4_P_GRID, p1);
2269 atm_fields_compact.
set_grid_name(GFIELD4_LAT_GRID,
"Latitude");
2270 atm_fields_compact.
set_grid(GFIELD4_LAT_GRID, lat_true1);
2271 atm_fields_compact.
set_grid_name(GFIELD4_LON_GRID,
"Longitude");
2272 atm_fields_compact.
set_grid(GFIELD4_LON_GRID, lon_true1);
2283 const Index& iy_agenda_call1,
2284 const Tensor3& iy_transmittance,
2288 const Index& stokes_dim,
2290 const Agenda& iy_loop_freqs_agenda,
2294 "Recursive usage not possible (iy_agenda_call1 must be 1).");
2296 "*iy_transmittance* must be empty.");
2300 for (
Index i = 0; i < nf; i++) {
2319 iy_loop_freqs_agenda);
2323 iy.
resize(nf, stokes_dim);
2325 iy_aux.resize(iy_aux1.
nelem());
2326 for (
Index q = 0; q < iy_aux1.
nelem(); q++) {
2327 iy_aux[q].resize(nf, stokes_dim);
2330 diy_dx.resize(diy_dx1.
nelem());
2331 for (
Index q = 0; q < diy_dx1.
nelem(); q++) {
2332 diy_dx[q].resize(diy_dx1[q].npages(), nf, stokes_dim);
2338 for (
Index q = 0; q < iy_aux1.
nelem(); q++) {
2341 for (
Index q = 0; q < diy_dx1.
nelem(); q++) {
2352 const Index& iy_agenda_call1,
2353 const Tensor3& iy_transmittance,
2357 const Index& jacobian_do,
2358 const Index& atmosphere_dim,
2365 const Vector& refellipsoid,
2367 const Index& cloudbox_on,
2369 const Index& stokes_dim,
2372 const Agenda& iy_space_agenda,
2373 const Agenda& surface_rtprop_agenda,
2374 const Agenda& propmat_clearsky_agenda,
2375 const Agenda& ppath_step_agenda,
2377 const Numeric& ppath_lraytrace,
2381 const Index& mc_max_time,
2382 const Index& mc_max_iter,
2383 const Index& mc_min_iter,
2384 const Numeric& mc_taustep_limit,
2385 const Index& t_interp_order,
2389 "Only 3D atmospheres are allowed (atmosphere_dim must be 3)");
2391 "The cloudbox must be activated (cloudbox_on must be 1)");
2393 "This method does not provide any jacobians (jacobian_do must be 0)");
2395 "Recursive usage not possible (iy_agenda_call1 must be 1)");
2397 "*iy_transmittance* must be empty");
2403 iy.
resize(nf, stokes_dim);
2407 Index auxError = -1;
2410 iy_aux.resize(naux);
2412 for (
Index i = 0; i < naux; i++) {
2413 if (iy_aux_vars[i] ==
"Error (uncorrelated)") {
2415 iy_aux[i].resize(nf, stokes_dim);
2418 "In *iy_aux_vars* you have included: \"", iy_aux_vars[i],
2419 "\"\nThis choice is not recognised.")
2431 Matrix pos(1, 3), los(1, 2);
2433 pos(0,
joker) = rte_pos;
2434 los(0,
joker) = rte_los;
2437 bool failed =
false;
2442#pragma omp parallel for if (!arts_omp_in_parallel() && nf > 1) firstprivate(wss)
2443 for (
Index f_index = 0; f_index < nf; f_index++) {
2444 if (failed)
continue;
2453 Index mc_iteration_count;
2475 surface_rtprop_agenda,
2476 propmat_clearsky_agenda,
2506 iy(f_index,
joker) = y;
2508 if (auxError >= 0) {
2509 iy_aux[auxError](f_index,
joker) = mc_error;
2511 }
catch (
const std::exception& e) {
2513 os <<
"Error for f_index = " << f_index <<
" (" << f_grid[f_index]
2516#pragma omp critical(iyMC_fail)
2519 fail_msg = os.str();
2533 const Index& jacobian_do,
2537 "*iy_aux* and *iy_aux_vars* must have the same "
2538 "number of elements.");
2541 "This method can not provide any jacobians and "
2542 "*jacobian_do* must be 0.");
2546 for (
Index i = 0; i < iy_aux.
nelem() && !ready; i++) {
2547 if (iy_aux_vars[i] == aux_var) {
2554 "The selected auxiliary variable to insert in *iy* "
2555 "is either not defined at all or is not set.");
2560 Matrix& ppvar_optical_depth,
2561 const Tensor4& ppvar_trans_cumulat,
2563 ppvar_optical_depth = ppvar_trans_cumulat(
joker,
joker, 0, 0);
2564 transform(ppvar_optical_depth, log, ppvar_optical_depth);
2565 ppvar_optical_depth *= -1;
2578 const Index& atmgeom_checked,
2579 const Index& atmfields_checked,
2580 const Index& atmosphere_dim,
2582 const Index& cloudbox_on,
2583 const Index& cloudbox_checked,
2584 const Index& scat_data_checked,
2585 const Index& sensor_checked,
2586 const Index& stokes_dim,
2588 const Matrix& sensor_pos,
2589 const Matrix& sensor_los,
2590 const Matrix& transmitter_pos,
2591 const Matrix& mblock_dlos,
2592 const Sparse& sensor_response,
2593 const Vector& sensor_response_f,
2595 const Matrix& sensor_response_dlos,
2597 const Agenda& iy_main_agenda,
2598 const Agenda& jacobian_agenda,
2599 const Index& jacobian_do,
2610 "The frequency grid is empty.");
2613 "All frequencies in *f_grid* must be > 0.");
2616 "The atmospheric fields must be flagged to have\n"
2617 "passed a consistency check (atmfields_checked=1).");
2619 "The atmospheric geometry must be flagged to have\n"
2620 "passed a consistency check (atmgeom_checked=1).");
2622 "The cloudbox must be flagged to have\n"
2623 "passed a consistency check (cloudbox_checked=1).");
2626 "The scattering data must be flagged to have\n"
2627 "passed a consistency check (scat_data_checked=1).");
2629 "The sensor variables must be flagged to have\n"
2630 "passed a consistency check (sensor_checked=1).");
2637 const Index niyb = nf * nlos * stokes_dim;
2646 y_f.
resize(nmblock * n1y);
2647 y_pol.resize(nmblock * n1y);
2650 y_geo.
resize(nmblock * n1y, 5);
2659 Index j_analytical_do = 0;
2665 jacobian.
resize(nmblock * n1y,
2666 jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1);
2679 bool failed =
false;
2682 (nf <= nmblock && nmblock >= nlos)) {
2683 out3 <<
" Parallelizing mblock loop (" << nmblock <<
" iterations)\n";
2687#pragma omp parallel for firstprivate(wss)
2688 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
2690 if (failed)
continue;
2714 sensor_response_pol,
2715 sensor_response_dlos,
2720 jacobian_quantities,
2729 out3 <<
" Not parallelizing mblock loop (" << nmblock <<
" iterations)\n";
2731 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
2733 if (failed)
continue;
2757 sensor_response_pol,
2758 sensor_response_dlos,
2763 jacobian_quantities,
2781 for (
Index q = 0; q < nq; q++) {
2782 y_aux[q].resize(nmblock * n1y);
2784 for (
Index mblock_index = 0; mblock_index < nmblock; mblock_index++) {
2785 const Range rowind =
2791 if (iy_aux_vars[q] ==
"Error (uncorrelated)") {
2792 for (
Index i = 0; i < n1y; i++) {
2793 const Index row = row0 + i;
2795 for (
Index j = 0; j < niyb; j++) {
2797 pow(sensor_response(i, j) * iyb_aux_array[mblock_index][q][j],
2800 y_aux[q][row] =
sqrt(y_aux[q][row]);
2803 mult(y_aux[q][rowind], sensor_response, iyb_aux_array[mblock_index][q]);
2820 const Index& atmfields_checked,
2821 const Index& atmgeom_checked,
2822 const Index& atmosphere_dim,
2824 const Index& cloudbox_on,
2825 const Index& cloudbox_checked,
2826 const Index& scat_data_checked,
2827 const Index& sensor_checked,
2828 const Index& stokes_dim,
2830 const Matrix& sensor_pos,
2831 const Matrix& sensor_los,
2832 const Matrix& transmitter_pos,
2833 const Matrix& mblock_dlos,
2834 const Sparse& sensor_response,
2835 const Vector& sensor_response_f,
2837 const Matrix& sensor_response_dlos,
2839 const Agenda& iy_main_agenda,
2840 const Agenda& jacobian_agenda,
2841 const Index& jacobian_do,
2844 const Index& append_instrument_wfs,
2851 jacobian_indices_copy, any_affine, jacobian_quantities_copy,
true);
2859 "Input *y* is empty. Use *yCalc*");
2861 "Lengths of input *y* and *y_f* are inconsistent.");
2863 "Lengths of input *y* and *y_pol* are inconsistent.");
2865 "Sizes of input *y* and *y_pos* are inconsistent.");
2867 "Sizes of input *y* and *y_los* are inconsistent.");
2869 "Sizes of input *y* and *y_geo* are inconsistent.");
2871 nrq1 = jacobian_quantities_copy.
nelem();
2873 "Sizes of *y* and *jacobian* are inconsistent.");
2875 "Size of input *jacobian* and size implied "
2876 "*jacobian_quantities_copy* are inconsistent.");
2882 Matrix y_pos2, y_los2, y_geo2, jacobian2;
2911 sensor_response_pol,
2912 sensor_response_dlos,
2917 jacobian_quantities,
2923 "Different number of columns in *y_pos* between the measurements.");
2925 "Different number of columns in *y_los* between the measurements.");
2933 const Vector y1 = y, y_f1 = y_f;
2934 const Matrix y_pos1 = y_pos, y_los1 = y_los, y_geo1 = y_geo;
2939 y[
Range(0, n1)] = y1;
2940 y[
Range(n1, n2)] = y2;
2943 y_f[
Range(0, n1)] = y_f1;
2944 y_f[
Range(n1, n2)] = y_f2;
2950 y_los.
resize(n1 + n2, y_los1.ncols());
2954 y_geo.
resize(n1 + n2, y_geo1.ncols());
2958 y_pol.resize(n1 + n2);
2959 for (
Index i = 0; i < n1; i++) {
2960 y_pol[i] = y_pol1[i];
2962 for (
Index i = 0; i < n2; i++) {
2963 y_pol[n1 + i] = y_pol2[i];
2974 y_aux[
a].resize(n1 + n2);
2976 y_aux[
a][
Range(0, n1)] = y_aux1[
a];
2978 y_aux[
a][
Range(0, n1)] = 0;
2981 y_aux[
a][
Range(n1, n2)] = y_aux2[
a];
2983 y_aux[
a][
Range(n1, n2)] = 0;
2995 jacobian_quantities = jacobian_quantities_copy;
2996 jacobian_indices = jacobian_indices_copy;
3001 const Index nrq2 = jacobian_quantities2.
nelem();
3004 for (
Index q2 = 0; q2 < nrq2; q2++) {
3009 if (jacobian_quantities2[q2].Target().isSpeciesVMR() ||
3010 jacobian_quantities2[q2] == Jacobian::Atm::Temperature ||
3011 jacobian_quantities2[q2] == Jacobian::Special::ScatteringString ||
3012 jacobian_quantities2[q2].Target().isWind() ||
3013 jacobian_quantities2[q2] == Jacobian::Special::SurfaceString ||
3014 append_instrument_wfs) {
3015 for (
Index q1 = 0; q1 < nrq1; q1++ && pos < 0) {
3016 if (jacobian_quantities2[q2].Target().sameTargetType(jacobian_quantities_copy[q1].Target())) {
3017 if (jacobian_quantities2[q2].Target().isSpeciesVMR()) {
3018 if (jacobian_quantities2[q2].Subtag() ==
3019 jacobian_quantities_copy[q1].Subtag()) {
3020 if (jacobian_quantities2[q2].Mode() ==
3021 jacobian_quantities_copy[q1].Mode()) {
3025 "Jacobians for ", jacobian_quantities2[q2],
3026 " shall be appended.\nThis requires "
3027 "that the same retrieval unit is used "
3028 "but it seems that this requirement is "
3032 }
else if (jacobian_quantities2[q2] == Jacobian::Atm::Temperature) {
3033 if (jacobian_quantities2[q2].Subtag() ==
3034 jacobian_quantities_copy[q1].Subtag()) {
3038 "Jacobians for ", jacobian_quantities2[q2],
3039 " shall be appended.\nThis requires "
3040 "that HSE is either ON or OFF for both "
3041 "parts but it seems that this requirement "
3044 }
else if (jacobian_quantities[q2] == Jacobian::Special::ScatteringString) {
3045 if ((jacobian_quantities2[q2].Subtag() ==
3046 jacobian_quantities_copy[q1].Subtag()) &&
3047 (jacobian_quantities2[q2].SubSubtag() ==
3048 jacobian_quantities_copy[q1].SubSubtag())) {
3051 }
else if (jacobian_quantities2[q2].Subtag() == jacobian_quantities_copy[q1].Subtag()) {
3060 map_table[q2] = jacobian_quantities.
nelem();
3061 jacobian_quantities.push_back(jacobian_quantities2[q2]);
3063 indices[0] = jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1;
3065 indices[0] + jacobian_indices2[q2][1] - jacobian_indices2[q2][0];
3066 jacobian_indices.push_back(indices);
3070 map_table[q2] = pos;
3072 ArrayOfVector grids1 = jacobian_quantities_copy[pos].Grids();
3074 bool any_wrong =
false;
3079 if (grids1[g].nelem() != grids2[g].nelem()) {
3082 for (
Index e = 0; e < grids1[g].
nelem(); e++) {
3083 const Numeric v1 = grids1[g][e];
3084 const Numeric v2 = grids2[g][e];
3085 if ((v1 == 0 &&
abs(v2) > 1e-9) ||
abs(v1 - v2) / v1 > 1e-6) {
3094 "Jacobians for ", jacobian_quantities2[q2],
3095 " shall be appended.\nThis requires that the "
3096 "same grids are used for both measurements,\nbut "
3097 "it seems that this requirement is not met.")
3104 const Index nrq = jacobian_quantities.
nelem();
3105 const Matrix jacobian1 = jacobian;
3107 jacobian.
resize(n1 + n2, jacobian_indices[nrq - 1][1] + 1);
3111 jacobian(
Range(0, n1),
Range(0, jacobian_indices_copy[nrq1 - 1][1] + 1)) =
3114 for (
Index q2 = 0; q2 < nrq2; q2++) {
3115 jacobian(
Range(n1, n2),
3116 Range(jacobian_indices[map_table[q2]][0],
3117 jacobian_indices[map_table[q2]][1] -
3118 jacobian_indices[map_table[q2]][0] + 1)) =
3121 Range(jacobian_indices2[q2][0],
3122 jacobian_indices2[q2][1] - jacobian_indices2[q2][0] + 1));
3135 "No need to use this method with *iy_unit* = \"1\".");
3138 "The spectrum vector *y* is required to have original radiance\n"
3139 "unit, but this seems not to be the case. This as a value above\n"
3140 "1e-3 is found in *y*.")
3146 const bool do_j = jacobian.
nrows() == ny;
3150 "The method can not be used with jacobian quantities that are not\n"
3151 "obtained through radiative transfer calculations. One example on\n"
3152 "quantity that can not be handled is *jacobianAddPolyfit*.\n"
3153 "The maximum value of *jacobian* indicates that one or several\n"
3154 "such jacobian quantities are included.")
3158 if (iy_unit ==
"PlanckBT") {
3171 while (i0 + n < ny && y_f[i0] == y_f[i0 + n]) {
3177 bool any_quv =
false;
3179 for (
Index i = 0; i < n; i++) {
3180 const Index ix = i0 + i;
3182 i_pol[i] = y_pol[ix];
3183 if (i_pol[i] > 1 && i_pol[i] < 5) {
3193 "The conversion to PlanckBT, of the Jacobian and "
3194 "errors for Q, U and V, requires that I (first Stokes "
3195 "element) is at hand and that the data are sorted in "
3196 "such way that I comes first for each frequency.")
3207 y[ii] = yv(0,
joker);
3221 for (
Index i = 0; i < ny; i++) {
3223 i_pol[0] = y_pol[i];
3241 const Vector& sensor_response_f_grid,
3246 const Index nchannel = sensor_response_f_grid.
nelem();
3247 const Index lseries = ly / nchannel;
3250 "Row size of *y_geo* not an even multiple of length of *sensor_response_f_grid*.")
3255 for (
Index s=0; s<lseries; ++s) {
3264 const Vector& sensor_response_f_grid,
3265 const Index& npixel,
3270 const Index nchannel = sensor_response_f_grid.
nelem();
3271 const Index nswath = ly / (nchannel * npixel);
3274 "Row size of *y_geo* does not match given *npixel* and *sensor_response_f_grid*.")
3276 y_geo_swath.
resize(nswath, npixel, y_geo.
ncols());
3279 for (
Index s=0; s<nswath; ++s) {
3280 for (
Index p=0; p<npixel; ++p) {
3291 const Vector& sensor_response_f_grid,
3297 const Index nchannel = sensor_response_f_grid.
nelem();
3298 const Index lseries = ly / nchannel;
3301 "Length of *y* not an even multiple of length of *sensor_response_f_grid*.")
3303 y_series.
resize(lseries, nchannel);
3306 for (
Index s=0; s<lseries; ++s) {
3308 if (safe && s > 0) {
3310 "At least one channel varies in frequency.")
3312 y_series(s,
c) = y[i++];
3321 const Vector& sensor_response_f_grid,
3322 const Index& npixel,
3328 const Index nchannel = sensor_response_f_grid.
nelem();
3329 const Index nswath = ly / (nchannel * npixel);
3332 "Length of *y* does not match given *npixel* and *sensor_response_f_grid*.")
3334 y_swath.
resize(nswath, npixel, nchannel);
3337 for (
Index s=0; s<nswath; ++s) {
3338 for (
Index p=0; p<npixel; ++p) {
3340 if (safe && (p > 0 || s > 0)) {
3342 "At least one channel varies in frequency.")
3344 y_swath(s, p,
c) = y[i++];
Array< Index > ArrayOfIndex
An array of Index.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
The global header file for ARTS.
Constants of physical expressions as constexpr.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
Header file for helper functions for OpenMP.
void gas_scattering_agendaExecute(Workspace &ws, PropagationMatrix &gas_scattering_coef, TransmissionMatrix &gas_scattering_mat, Vector &gas_scattering_fct_legendre, const Vector &f_grid, const Numeric rtp_pressure, const Numeric rtp_temperature, const Vector &rtp_vmr, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Index gas_scattering_output_type, const Agenda &input_agenda)
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, Vector &geo_pos, const Index iy_agenda_call1, const Tensor3 &iy_transmittance, 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 iy_loop_freqs_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const Tensor3 &iy_transmittance, 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)
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 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_transmittance, 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)
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Index nrows() const noexcept
Index ncols() const noexcept
bool empty() const noexcept
Index ncols() const
Returns the number of columns.
bool empty() const noexcept
Index nbooks() const noexcept
Index npages() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nrows() const noexcept
Index nlibraries() const noexcept
Index nvitrines() const noexcept
Index nshelves() const noexcept
Index nbooks() const noexcept
Index nelem() const noexcept
Returns the number of elements.
bool empty() const noexcept
Returns true if variable size is zero.
void resize(const GriddedField4 &gf)
Make this GriddedField4 the same size as the given one.
void set_name(const String &s)
Set name of this gridded field.
void set_grid_name(Index i, const String &s)
Set grid name.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
void resize(Index r, Index c)
Resize function.
constexpr Index get_start() const noexcept
Returns the start index of the range.
Stokes vector is as Propagation matrix but only has 4 possible values.
void resize(Index p, Index r, Index c)
Resize function.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
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)
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
Implementation of gridded fields.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
ArrayOfIndex get_pointers_for_analytical_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
ArrayOfTensor3 get_standard_starting_diy_dx(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
ArrayOfTensor3 get_standard_diy_dpath(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
ArrayOfIndex get_pointers_for_scat_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &scat_species, const bool cloudbox_on)
Help function for analytical jacobian calculations.
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.
Routines for setting up the jacobian.
#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do)
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Header file for logic.cc.
void MCSetSeedFromTime(Index &mc_seed, const Verbosity &)
WORKSPACE METHOD: MCSetSeedFromTime.
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.
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, 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 &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.
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_transmittance, 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.
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.
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 String &rt_integration_option, 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_transmittance, const Numeric &rte_alonglos_v, const Tensor3 &surface_props_data, const Verbosity &verbosity)
WORKSPACE METHOD: iyEmissionStandard.
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_transmittance, 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.
void iyMC(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, 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.
constexpr Numeric SPEED_OF_LIGHT
void iyClearsky(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 Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, 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 Matrix &z_surface, const Vector &refellipsoid, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &cloudbox_on, const Index &gas_scattering_do, const Index &suns_do, 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 ArrayOfSun &suns, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const String &rt_integration_option, const Agenda &iy_main_agenda, const Agenda &iy_space_agenda, const Agenda &iy_surface_agenda, const Agenda &iy_cloudbox_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, const Numeric &rte_alonglos_v, const Tensor3 &surface_props_data, const Verbosity &verbosity)
WORKSPACE METHOD: iyClearsky.
void iyCalc(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, Vector &geo_pos, 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 y_geo_swathFromY_geo(Tensor3 &y_geo_swath, const Matrix &y_geo, const Vector &sensor_response_f_grid, const Index &npixel, const Verbosity &)
WORKSPACE METHOD: y_geo_swathFromY_geo.
void y_geo_seriesFromY_geo(Matrix &y_geo_series, const Matrix &y_geo, const Vector &sensor_response_f_grid, const Verbosity &)
WORKSPACE METHOD: y_geo_seriesFromY_geo.
void yApplyUnit(Vector &y, Matrix &jacobian, const Vector &y_f, const ArrayOfIndex &y_pol, const String &iy_unit, const Verbosity &)
WORKSPACE METHOD: yApplyUnit.
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 y_seriesFromY(Matrix &y_series, const Vector &y, const Vector &y_f, const Vector &sensor_response_f_grid, const Index &safe, const Verbosity &)
WORKSPACE METHOD: y_seriesFromY.
void ppvar_optical_depthFromPpvar_trans_cumulat(Matrix &ppvar_optical_depth, const Tensor4 &ppvar_trans_cumulat, const Verbosity &)
WORKSPACE METHOD: ppvar_optical_depthFromPpvar_trans_cumulat.
void y_swathFromY(Tensor3 &y_swath, const Vector &y, const Vector &y_f, const Vector &sensor_response_f_grid, const Index &npixel, const Index &safe, const Verbosity &)
WORKSPACE METHOD: y_swathFromY.
void iyEmissionHybrid(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_pnd, 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 ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const String &iy_unit, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const String &rt_integration_option, 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_transmittance, const Ppath &ppath, const Vector &rte_pos2, const Numeric &rte_alonglos_v, const Tensor3 &surface_props_data, const Tensor7 &cloudbox_field, const Vector &za_grid, const Index &Naa, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: iyEmissionHybrid.
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, 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 &jacobian_agenda, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &iy_aux_vars, const Verbosity &verbosity)
WORKSPACE METHOD: yCalc.
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
void abs(Sparse &A, const Sparse &B)
Absolute value of sparse matrix elements.
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...
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
ConstComplexMatrixView transpose(ConstComplexMatrixView m)
Const version of transpose.
void swap(ComplexVector &v1, ComplexVector &v2) noexcept
Swaps two objects.
Declarations having to do with the four output streams.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric speed_of_light
Speed of light [m/s] From: https://en.wikipedia.org/wiki/2019_redefinition_of_SI_base_units Date: 201...
constexpr Index GFIELD4_LAT_GRID
Global constant, Index of the latitude grid in GriddedField4.
constexpr Index GFIELD4_P_GRID
Global constant, Index of the pressure grid in GriddedField4.
constexpr Index GFIELD4_FIELD_NAMES
Global constant, Index of the field names in GriddedField4.
constexpr Index GFIELD4_LON_GRID
Global constant, Index of the longitude grid in GriddedField4.
This file contains declerations of functions of physical character.
void error_if_limb_ppath(const Ppath &ppath)
Throws an error if ppath altitudes not are strictly increasing or decreasing.
Index ppath_what_background(const Ppath &ppath)
Returns the case number for the radiative background.
Propagation path structure and functions.
Array< PropagationMatrix > ArrayOfPropagationMatrix
Numeric pow(const Rational base, Numeric exp)
Power of.
Numeric sqrt(const Rational r)
Square root.
void get_stepwise_scattersky_propmat(StokesVector &ap, PropagationMatrix &Kp, ArrayOfStokesVector &dap_dx, ArrayOfPropagationMatrix &dKp_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstMatrixView &ppath_1p_pnd, const ArrayOfMatrix &ppath_dpnd_dx, const Index ppath_1p_id, const ArrayOfArrayOfSingleScatteringData &scat_data, const ConstVectorView &ppath_line_of_sight, const ConstVectorView &ppath_temperature, const Index &atmosphere_dim, const bool &jacobian_do)
Computes the contribution by scattering at propagation path point.
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, const ConstVectorView &ppath_f_grid, const ConstVectorView &ppath_magnetic_field, const ConstVectorView &ppath_line_of_sight, const EnergyLevelMap &ppath_nlte, const ConstVectorView &ppath_vmrs, const Numeric &ppath_temperature, const Numeric &ppath_pressure, const bool &jacobian_do)
Gets the clearsky propgation matrix and NLTE contributions.
void get_iy_of_background(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const ConstTensor3View &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const ConstVectorView &rte_pos2, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const ConstVectorView &f_grid, const String &iy_unit, const 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.
void get_stepwise_scattersky_source(StokesVector &Sp, ArrayOfStokesVector &dSp_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstVectorView &ppath_1p_pnd, const ArrayOfMatrix &ppath_dpnd_dx, const Index ppath_1p_id, const ArrayOfArrayOfSingleScatteringData &scat_data, const ConstTensor7View &cloudbox_field, const ConstVectorView &za_grid, const ConstVectorView &aa_grid, const ConstMatrixView &ppath_line_of_sight, const GridPos &ppath_pressure, const Vector &temperature, const Index &atmosphere_dim, const bool &jacobian_do, const Index &t_interp_order)
Calculates the stepwise scattering source terms.
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, const ConstVectorView &p_grid, const ConstTensor3View &t_field, const EnergyLevelMap &nlte_field, const ConstTensor4View &vmr_field, const ConstTensor3View &wind_u_field, const ConstTensor3View &wind_v_field, const ConstTensor3View &wind_w_field, const ConstTensor3View &mag_u_field, const ConstTensor3View &mag_v_field, const ConstTensor3View &mag_w_field)
Determines pressure, temperature, VMR, winds and magnetic field for each propgataion path point.
void apply_iy_unit2(Tensor3View J, const ConstMatrixView &iy, const String &iy_unit, const ConstVectorView &f_grid, const Numeric &n, const ArrayOfIndex &i_pol)
Largely as apply_iy_unit but operates on jacobian data.
void iy_transmittance_mult(Tensor3 &iy_trans_total, const ConstTensor3View &iy_trans_old, const ConstTensor3View &iy_trans_new)
Multiplicates iy_transmittance with transmissions.
void apply_iy_unit(MatrixView iy, const String &iy_unit, const 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 ...
void get_ppath_f(Matrix &ppath_f, const Ppath &ppath, const ConstVectorView &f_grid, const Index &atmosphere_dim, const Numeric &rte_alonglos_v, const ConstMatrixView &ppath_wind)
Determines the Doppler shifted frequencies along the propagation path.
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.
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_transmittance, const Agenda &water_p_eq_agenda, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfIndex &jac_species_i)
This function fixes the last steps to made on the Jacobian in some radiative transfer WSMs.
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, 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 &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.
Range get_rowindex_for_mblock(const Sparse &sensor_response, const Index &mblock_index)
Returns the "range" of y corresponding to a measurement block.
void adapt_stepwise_partial_derivatives(ArrayOfPropagationMatrix &dK_dx, ArrayOfStokesVector &dS_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const ConstVectorView &ppath_f_grid, const ConstVectorView &ppath_line_of_sight, const Index <e, const Index &atmosphere_dim, const bool &jacobian_do)
Adapts clearsky partial derivatives.
void get_stepwise_blackbody_radiation(VectorView B, VectorView dB_dT, const ConstVectorView &ppath_f_grid, const Numeric &ppath_temperature, const bool &do_temperature_derivative)
Get the blackbody radiation at propagation path point.
void get_ppath_cloudvars(ArrayOfIndex &clear2cloudy, Matrix &ppath_pnd, ArrayOfMatrix &ppath_dpnd_dx, const Ppath &ppath, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx)
Determines the particle fields along a propagation path.
Declaration of functions in rte.cc.
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.
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
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 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.
Header file for special_interp.cc.
An Antenna object used by MCGeneral.
void set_pencil_beam()
set_pencil_beam
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
Numeric end_lstep
The distance between end pos and the first position in pos.
Vector lstep
The length between ppath points.
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.
Radiation Vector for Stokes dimension 1-4.
Index nrows() const
Returns the number of rows.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
void get_direct_radiation(Workspace &ws, ArrayOfMatrix &direct_radiation, ArrayOfArrayOfTensor3 &ddirect_radiation_dx, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_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 ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Index &irradiance_flag, const ArrayOfPpath &sun_ppaths, const ArrayOfSun &suns, const ArrayOfIndex &suns_visible, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Numeric &rte_alonglos_v, const Verbosity &verbosity)
Calculates the transmitted sun radiation at the end position of the ppath.
void get_sun_ppaths(Workspace &ws, ArrayOfPpath &sun_ppaths, ArrayOfIndex &suns_visible, ArrayOfVector &sun_rte_los, const Vector &rte_pos, const ArrayOfSun &suns, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &z_surface, const Vector &refellipsoid, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
Calculates the ppath towards the suns from a given position and indicates if sun is visible or not.
void get_scattered_sunsource(Workspace &ws, RadiationVector &scattered_sunlight, const Vector &f_grid, const Numeric &p, const Numeric &T, const Vector &vmr, const Matrix &transmitted_sunlight, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Agenda &gas_scattering_agenda)
Calculates the radiance spectrum of sun which is scattered by the atmospheric gases.
void get_sun_background(Matrix &iy, Index &suns_visible, const ArrayOfSun &suns, const Ppath &ppath, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &refellipsoid)
Gets the sun background for a given ppath.
Declaration of functions in star.cc.
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
void stepwise_source(RadiationVector &J, ArrayOfRadiationVector &dJ, RadiationVector &J_add, 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.
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 PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric r, const Vector &dr1, const Vector &dr2, const Index ia, const Index iz, const RadiativeTransferSolver solver)
Update the Radiation Vector.
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.
Stuff related to the transmission matrix.
Array< RadiationVector > ArrayOfRadiationVector
Array< TransmissionMatrix > ArrayOfTransmissionMatrix