62 const Index& stokes_dim,
64 const Index& atmosphere_dim,
76 const Index& cloudbox_on,
82 const Index& scat_data_checked,
84 const Index& jacobian_do,
87 const Agenda& propmat_clearsky_agenda,
88 const Agenda& water_p_eq_agenda,
89 const Agenda& iy_transmitter_agenda,
90 const Index& iy_agenda_call1,
93 const Index& trans_in_jacobian,
95 const Index& t_interp_order,
108 if (!iy_agenda_call1)
110 "Recursive usage not possible (iy_agenda_call1 must be 1)");
111 if (!iy_transmission.
empty())
112 throw runtime_error(
"*iy_transmission* must be empty");
113 if (rbi < 1 || rbi > 9)
115 "ppath.background is invalid. Check your " 116 "calculation of *ppath*?");
117 if (rbi == 3 || rbi == 4)
119 "The propagation path ends inside or at boundary of " 120 "the cloudbox.\nFor this method, *ppath* must be " 121 "calculated in this way:\n ppathCalc( cloudbox_on = 0 ).");
123 if (scat_data_checked != 1)
125 "The scattering data must be flagged to have\n" 126 "passed a consistency check (scat_data_checked=1).");
129 "*pnd_field* and *scat_data* inconsistent regarding total number of" 130 " scattering elements.");
133 if (dpnd_field_dx.
nelem() != jacobian_quantities.
nelem())
135 "*dpnd_field_dx* not properly initialized:\n" 136 "Number of elements in dpnd_field_dx must be equal number of jacobian" 137 " quantities.\n(Note: jacobians have to be defined BEFORE *pnd_field*" 138 " is calculated/set.");
150 ppath.
pos(np - 1,
Range(0, atmosphere_dim)),
152 iy_transmitter_agenda);
155 os <<
"The size of *iy* returned from *iy_transmitter_agenda* is\n" 157 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n" 158 <<
" size of iy = [" << iy0.
nrows() <<
"," << iy0.
ncols() <<
"]\n";
159 throw runtime_error(os.
str());
161 for (
Index iv = 0; iv < nf; iv++) {
164 "The *iy* returned from *iy_transmitter_agenda* " 165 "must have the value 1 in the first column.");
169 Index j_analytical_do = 0;
174 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
176 ArrayOfIndex jac_species_i(nq), jac_scat_i(nq), jac_is_t(nq), jac_wind_i(nq);
179 if (j_analytical_do) {
204 Index auxBackScat = -1;
205 Index auxOptDepth = -1;
206 Index auxPartAtte = -1;
209 iy_aux[
i].resize(nf * np, ns);
212 if (iy_aux_vars[
i] ==
"Radiative background") {
214 }
else if (iy_aux_vars[
i] ==
"Backscattering") {
217 }
else if (iy_aux_vars[
i] ==
"Optical depth") {
219 }
else if (iy_aux_vars[
i] ==
"Particle extinction") {
224 os <<
"The only allowed strings in *iy_aux_vars* are:\n" 225 <<
" \"Radiative background\"\n" 226 <<
" \"Backscattering\"\n" 227 <<
" \"Optical depth\"\n" 228 <<
" \"Particle extinction\"\n" 229 <<
"but you have selected: \"" << iy_aux_vars[
i] <<
"\"";
230 throw runtime_error(os.
str());
236 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
238 Tensor4 trans_partial(np, nf, ns, ns);
239 Tensor5 dtrans_partial_dx_above(0, 0, 0, 0, 0);
240 Tensor5 dtrans_partial_dx_below(0, 0, 0, 0, 0);
241 Tensor5 Pe(ne, np, nf, ns, ns, 0);
244 Matrix scalar_ext(np, nf, 0);
245 Index nf_ssd = scat_data[0][0].pha_mat_data.nlibraries();
246 Index duplicate_freqs = ((nf == nf_ssd) ? 0 : 1);
247 Tensor6 pha_mat_1se(nf_ssd, 1, 1, 1, ns, ns);
248 Vector t_ok(1), t_array(1);
249 Matrix pdir(1, 2), idir(1, 2);
253 if (np == 1 && rbi == 1)
284 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
297 clear2cloudy.resize(np);
298 for (
Index ip = 0; ip < np; ip++) {
299 clear2cloudy[ip] = -1;
313 if (trans_in_jacobian && j_analytical_do) {
314 dtrans_partial_dx_above.
resize(np, nq, nf, ns, ns);
315 dtrans_partial_dx_below.
resize(np, nq, nf, ns, ns);
316 dtrans_partial_dx_above = 0;
317 dtrans_partial_dx_below = 0;
319 dK_past_dx.resize(nq);
334 for (
Index ip = 0; ip < np; ip++) {
341 propmat_clearsky_agenda,
344 ppvar_mag(
joker, ip),
347 ppvar_vmr(
joker, ip),
351 trans_in_jacobian && j_analytical_do);
353 if (trans_in_jacobian && j_analytical_do) {
360 ppvar_vmr(
joker, ip),
367 trans_in_jacobian && j_analytical_do);
370 if (clear2cloudy[ip] + 1) {
381 ppvar_t[
Range(ip, 1)],
383 trans_in_jacobian && jacobian_do);
385 if (
abs(pext_scaling - 1) > 1e-6) {
387 if (trans_in_jacobian && j_analytical_do) {
394 if (auxPartAtte >= 0) {
398 if (trans_in_jacobian && j_analytical_do) {
407 pdir(0,
joker) = los_sca;
411 if (atmosphere_dim == 3) {
417 idir(0,
joker) = los_inc;
420 for (
Index i_ss = 0; i_ss < scat_data.
nelem(); i_ss++)
421 for (
Index i_se = 0; i_se < scat_data[i_ss].
nelem(); i_se++) {
425 if (ppvar_pnd(i_se_flat, ip) != 0)
427 else if (j_analytical_do)
428 for (
Index iq = 0; iq < nq && !val_pnd; iq++)
429 if (jac_scat_i[iq] >= 0)
430 if (ppvar_dpnd_dx[iq](i_se_flat, ip) != 0) {
438 scat_data[i_ss][i_se],
439 ppvar_t[
Range(ip, 1)],
446 for (
Index iv = 0; iv < nf; iv++)
454 os <<
"Interpolation error for (flat-array) scattering" 455 <<
" element #" << i_se_flat <<
"\n" 456 <<
"at location/temperature point #" << ip <<
"\n";
457 throw runtime_error(os.
str());
466 if (trans_in_jacobian && j_analytical_do) {
496 swap(K_past, K_this);
497 swap(dK_past_dx, dK_this_dx);
511 if (!cloudbox_on && !naux) {
516 for (
Index ip = 0; ip < np; ip++) {
518 if (clear2cloudy[ip] >= 0) {
519 for (
Index iv = 0; iv < nf; iv++) {
523 if (ppvar_pnd(
i, ip) != 0) {
524 for (
Index is1 = 0; is1 <
ns; is1++) {
525 for (
Index is2 = 0; is2 <
ns; is2++) {
526 P(is1, is2) += ppvar_pnd(
i, ip) * Pe(
i, ip, iv, is1, is2);
534 const Index iout = iv * np + ip;
539 if (auxBackScat >= 0) {
542 if (auxPartAtte >= 0 && ip > 0) {
543 iy_aux[auxPartAtte](iout, 0) =
544 iy_aux[auxPartAtte](iout - 1, 0) +
545 ppath.
lstep[ip - 1] *
546 (scalar_ext(ip - 1, iv) + scalar_ext(ip - 1, iv));
550 if (j_analytical_do) {
553 for (
Index iq = 0; iq < nq; iq++) {
554 if (jacobian_quantities[iq].Analytical()) {
555 if (jac_scat_i[iq] >= 0) {
559 if (ppvar_dpnd_dx[iq](
i, ip) != 0) {
560 for (
Index is1 = 0; is1 <
ns; is1++) {
561 for (
Index is2 = 0; is2 <
ns; is2++) {
563 ppvar_dpnd_dx[iq](
i, ip) * Pe(i, ip, iv, is1, is2);
571 mult(iy_tmp, P, iy1);
582 if (auxPartAtte >= 0 && ip > 0) {
583 for (
Index iv = 0; iv < nf; iv++) {
584 const Index iout = iv * np + ip;
585 iy_aux[auxPartAtte](iout, 0) = iy_aux[auxPartAtte](iout - nf, 0);
590 if (auxOptDepth >= 0) {
591 for (
Index iv = 0; iv < nf; iv++) {
592 const Index iout = iv * np + ip;
593 iy_aux[auxOptDepth](iout, 0) =
594 -2 * log(ppvar_trans_cumulat(ip, iv, 0, 0));
613 if (j_analytical_do) {
615 if (trans_in_jacobian) {
618 for (
Index ip = 0; ip < np; ip++)
620 for (
Index j = ip; j < np; j++)
627 const Index iout = iv * np + j;
631 dtrans_partial_dx_above(ip, iq, iv,
joker,
joker),
636 if (isnan(jnew[
i])) jnew[i] = 0.0;
639 diy_dpath[iq](ip, iout,
joker) += jnew;
642 if (j > ip && j < np - 1) {
644 dtrans_partial_dx_below(ip, iq, iv,
joker,
joker),
649 if (isnan(jnew[
i])) jnew[i] = 0.0;
652 diy_dpath[iq](ip, iout,
joker) += jnew;
693 const Index& stokes_dim,
695 const Index& atmosphere_dim,
707 const Index& cloudbox_on,
713 const Index& scat_data_checked,
715 const Index& jacobian_do,
718 const Agenda& propmat_clearsky_agenda,
719 const Agenda& water_p_eq_agenda,
720 const Agenda& iy_transmitter_agenda,
721 const Index& iy_agenda_call1,
722 const Tensor3& iy_transmission,
724 const Index& trans_in_jacobian,
726 const Index& t_interp_order,
739 if (!iy_agenda_call1)
741 "Recursive usage not possible (iy_agenda_call1 must be 1)");
742 if (!iy_transmission.
empty())
743 throw runtime_error(
"*iy_transmission* must be empty");
744 if (rbi < 1 || rbi > 9)
746 "ppath.background is invalid. Check your " 747 "calculation of *ppath*?");
748 if (rbi == 3 || rbi == 4)
750 "The propagation path ends inside or at boundary of " 751 "the cloudbox.\nFor this method, *ppath* must be " 752 "calculated in this way:\n ppathCalc( cloudbox_on = 0 ).");
754 if (scat_data_checked != 1)
756 "The scattering data must be flagged to have\n" 757 "passed a consistency check (scat_data_checked=1).");
760 "*pnd_field* and *scat_data* inconsistent regarding total number of" 761 " scattering elements.");
764 if (dpnd_field_dx.
nelem() != jacobian_quantities.
nelem())
766 "*dpnd_field_dx* not properly initialized:\n" 767 "Number of elements in dpnd_field_dx must be equal number of jacobian" 768 " quantities.\n(Note: jacobians have to be defined BEFORE *pnd_field*" 769 " is calculated/set.");
780 ppath.
pos(np - 1,
Range(0, atmosphere_dim)),
782 iy_transmitter_agenda);
786 os <<
"The size of *iy* returned from *iy_transmitter_agenda* is\n" 788 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n" 789 <<
" size of iy = [" << iy0.
nrows() <<
"," << iy0.
ncols() <<
"]\n";
790 throw runtime_error(os.
str());
792 for (
Index iv = 0; iv < nf; iv++)
795 "The *iy* returned from *iy_transmitter_agenda* " 796 "must have the value 1 in the first column.");
799 Index j_analytical_do = 0;
802 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
804 ArrayOfIndex jac_species_i(nq), jac_scat_i(nq), jac_is_t(nq), jac_wind_i(nq);
838 iy_aux[
i].resize(nf * np, ns);
841 if (iy_aux_vars[
i] ==
"Radiative background")
855 os <<
"The only allowed strings in *iy_aux_vars* are:\n" 856 <<
" \"Radiative background\"\n" 860 <<
"but you have selected: \"" << iy_aux_vars[
i] <<
"\"";
861 throw runtime_error(os.
str());
866 ppvar_trans_cumulat.
resize(np, nf, ns, ns);
881 Tensor5 Pe(ne, np, nf, ns, ns, 0);
886 Index nf_ssd = scat_data[0][0].pha_mat_data.nlibraries();
887 Index duplicate_freqs = ((nf == nf_ssd) ? 0 : 1);
888 Tensor6 pha_mat_1se(nf_ssd, 1, 1, 1, ns, ns);
889 Vector t_ok(1), t_array(1);
890 Matrix pdir(1, 2), idir(1, 2);
893 if (np == 1 && rbi == 1) {
923 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
936 clear2cloudy.resize(np);
937 for (
Index ip = 0; ip < np; ip++) clear2cloudy[ip] = -1;
951 Index temperature_derivative_position = -1;
954 if (trans_in_jacobian && j_analytical_do) {
955 dK_this_dx.resize(nq);
956 dK_past_dx.resize(nq);
968 temperature_derivative_position = iq;
969 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
974 for (
Index ip = 0; ip < np; ip++) {
981 propmat_clearsky_agenda,
984 ppvar_mag(
joker, ip),
987 ppvar_vmr(
joker, ip),
991 trans_in_jacobian && j_analytical_do);
993 if (trans_in_jacobian && j_analytical_do)
1000 ppvar_vmr(
joker, ip),
1007 trans_in_jacobian && j_analytical_do);
1009 if (clear2cloudy[ip] + 1) {
1014 jacobian_quantities,
1020 ppvar_t[
Range(ip, 1)],
1022 trans_in_jacobian && jacobian_do);
1024 if (
abs(pext_scaling - 1) > 1e-6) {
1026 if (trans_in_jacobian && j_analytical_do) {
1036 if (trans_in_jacobian && j_analytical_do)
1044 pdir(0,
joker) = los_sca;
1048 if (atmosphere_dim == 3) {
1054 idir(0,
joker) = los_inc;
1056 Index i_se_flat = 0;
1057 for (
Index i_ss = 0; i_ss < scat_data.
nelem(); i_ss++)
1058 for (
Index i_se = 0; i_se < scat_data[i_ss].
nelem(); i_se++) {
1062 if (ppvar_pnd(i_se_flat, ip) != 0)
1064 else if (j_analytical_do)
1065 for (
Index iq = 0; iq < nq && !val_pnd; iq++)
1066 if (jac_scat_i[iq] >= 0)
1067 if (ppvar_dpnd_dx[iq](i_se_flat, ip) != 0) {
1075 scat_data[i_ss][i_se],
1076 ppvar_t[
Range(ip, 1)],
1081 if (t_ok[0] not_eq 0)
1082 if (duplicate_freqs)
1083 for (
Index iv = 0; iv < nf; iv++)
1091 os <<
"Interpolation error for (flat-array) scattering" 1092 <<
" element #" << i_se_flat <<
"\n" 1093 <<
"at location/temperature point #" << ip <<
"\n";
1094 throw runtime_error(os.
str());
1105 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
1107 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
1115 ppath.
lstep[ip - 1],
1118 temperature_derivative_position);
1121 swap(K_past, K_this);
1122 swap(dK_past_dx, dK_this_dx);
1153 for (
Index ip = 0; ip < np; ip++) {
1154 for (
Index iv = 0; iv < nf; iv++) {
1155 for (
Index is = 0; is < stokes_dim; is++) {
1156 iy(iv * np + ip, is) = lvl_rad[ip](iv, is);
1157 if (j_analytical_do) {
1159 diy_dpath[iq](ip, iv * np + ip2, is) =
1160 dlvl_rad[ip][ip2][iq](iv, is););
1169 if (j_analytical_do)
1184 jacobian_quantities,
1199 const Index& atmgeom_checked,
1200 const Index& atmfields_checked,
1203 const Index& stokes_dim,
1205 const Index& atmosphere_dim,
1207 const Index& cloudbox_on,
1208 const Index& cloudbox_checked,
1209 const Matrix& sensor_pos,
1210 const Matrix& sensor_los,
1211 const Index& sensor_checked,
1212 const Index& jacobian_do,
1214 const Agenda& iy_main_agenda,
1215 const Agenda& geo_pos_agenda,
1217 const Vector& range_bins,
1236 if (f_grid.
empty()) {
1237 throw runtime_error(
"The frequency grid is empty.");
1240 if (f_grid[0] <= 0) {
1242 throw runtime_error(
"All frequencies in *f_grid* must be > 0.");
1246 if (atmfields_checked != 1)
1247 throw runtime_error(
1248 "The atmospheric fields must be flagged to have " 1249 "passed a consistency check (atmfields_checked=1).");
1250 if (atmgeom_checked != 1)
1251 throw runtime_error(
1252 "The atmospheric geometry must be flagged to have " 1253 "passed a consistency check (atmgeom_checked=1).");
1254 if (cloudbox_checked != 1)
1255 throw runtime_error(
1256 "The cloudbox must be flagged to have " 1257 "passed a consistency check (cloudbox_checked=1).");
1258 if (sensor_checked != 1)
1259 throw runtime_error(
1260 "The sensor variables must be flagged to have " 1261 "passed a consistency check (sensor_checked=1).");
1264 bool is_z =
max(range_bins) > 1;
1266 throw runtime_error(
1267 "The vector *range_bins* must contain strictly " 1268 "increasing values.");
1269 if (!is_z &&
min(range_bins) < 0)
1270 throw runtime_error(
1271 "The vector *range_bins* is not allowed to contain " 1273 if (instrument_pol_array.
nelem() != nf)
1274 throw runtime_error(
1275 "The main length of *instrument_pol_array* must match " 1276 "the number of frequencies.");
1281 const Numeric jfac = 10 * log10(exp(1.0));
1282 if (iy_unit ==
"1") {
1283 }
else if (iy_unit ==
"Ze") {
1284 ze_cfac(cfac, f_grid, ze_tref, k2);
1285 }
else if (iy_unit ==
"dBZe") {
1286 ze_cfac(cfac, f_grid, ze_tref, k2);
1287 ze_min =
pow(10.0, dbze_min / 10);
1289 throw runtime_error(
1290 "For this method, *iy_unit* must be set to \"1\", " 1291 "\"Ze\" or \"dBZe\".");
1304 npolcum[
i + 1] = npolcum[
i] + ni;
1306 for (
Index j = 0; j < ni; j++) {
1307 W[
i][j].resize(stokes_dim);
1308 stokes2pol(W[
i][j], stokes_dim, instrument_pol_array[
i][j], 0.5);
1314 const Index ntot = npos * npolcum[nf] * nbins;
1327 y_aux[
i].resize(ntot);
1333 Index j_analytical_do = 0;
1342 jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1);
1344 njq = jacobian_quantities.
nelem();
1356 for (
Index p = 0; p < npos; p++) {
1358 Tensor3 iy_transmission(0, 0, 0);
1380 sensor_pos(p,
joker),
1381 sensor_los(p,
joker),
1388 throw runtime_error(
1389 "A path consisting of a single point found. " 1390 "This is not allowed.");
1392 if (iy.
nrows() != nf * np)
1393 throw runtime_error(
1394 "The size of *iy* returned from *iy_main_agenda* " 1395 "is not correct (for this method).");
1404 range[
i] = range[
i - 1] + ppath.
lstep[
i - 1] *
1409 const Numeric range_end1 =
min(range[0], range[np - 1]);
1410 const Numeric range_end2 =
max(range[0], range[np - 1]);
1413 for (
Index b = 0; b < nbins; b++) {
1414 if (!(range_bins[b] >= range_end2 ||
1415 range_bins[b + 1] <= range_end1))
1418 Numeric blim1 =
max(range_bins[b], range_end1);
1419 Numeric blim2 =
min(range_bins[b + 1], range_end2);
1426 hbin /= (blim2 - blim1);
1428 for (
Index iv = 0; iv < nf; iv++) {
1432 if (j_analytical_do) {
1437 for (
Index a = 0; a < naux; a++) {
1444 if (j_analytical_do) {
1448 for (
Index a = 0; a < naux; a++) {
1449 auxvar[a].resize(np);
1452 for (
Index ip = 0; ip < instrument_pol_array[iv].
nelem(); ip++) {
1454 mult(refl, I, W[iv][ip]);
1455 if (j_analytical_do) {
1457 k < drefl[iq].nrows();
1462 for (
Index a = 0; a < naux; a++) {
1463 if (iy_aux_vars[a] ==
"Backscattering") {
1464 mult(auxvar[a], A[a], W[iv][ip]);
1466 for (
Index j = 0; j < np; j++) {
1467 auxvar[a][j] = A[a](j, 0);
1473 Index iout = nbins * (p * npolcum[nf] + npolcum[iv] + ip) + b;
1474 y[iout] = cfac[iv] * (hbin * refl);
1476 if (j_analytical_do) {
1478 for (
Index k = 0; k < drefl[iq].nrows(); k++) {
1479 jacobian(iout, jacobian_indices[iq][0] + k) =
1480 cfac[iv] * (hbin * drefl[iq](k,
joker));
1481 if (iy_unit ==
"dBZe") {
1482 jacobian(iout, jacobian_indices[iq][0] + k) *=
1483 jfac /
max(y[iout], ze_min);
1488 if (iy_unit ==
"dBZe") {
1489 y[iout] = y[iout] <= ze_min ? dbze_min : 10 * log10(y[iout]);
1493 for (
Index a = 0; a < naux; a++) {
1494 if (iy_aux_vars[a] ==
"Backscattering") {
1495 y_aux[a][iout] = cfac[iv] * (hbin * auxvar[a]);
1496 if (iy_unit ==
"dBZe") {
1497 y_aux[a][iout] = y_aux[a][iout] <= ze_min
1499 : 10 * log10(y_aux[a][iout]);
1502 y_aux[a][iout] = hbin * auxvar[a];
1514 if (geo_pos.
nelem() && geo_pos.
nelem() != atmosphere_dim) {
1515 throw runtime_error(
1516 "Wrong size of *geo_pos* obtained from " 1517 "*geo_pos_agenda*.\nThe length of *geo_pos* must " 1518 "be zero or equal to *atmosphere_dim*.");
1521 for (
Index b = 0; b < nbins; b++) {
1522 for (
Index iv = 0; iv < nf; iv++) {
1523 for (
Index ip = 0; ip < instrument_pol_array[iv].
nelem(); ip++) {
1524 const Index iout = nbins * (p * npolcum[nf] + npolcum[iv] + ip) + b;
1525 y_f[iout] = f_grid[iv];
1526 y_pol[iout] = instrument_pol_array[iv][ip];
1529 if (geo_pos.
nelem()) {
1530 y_geo(iout,
joker) = geo_pos;
INDEX Index
The type to use for all integer numbers and indices.
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.
Index nelem() const
Number of elements.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
Declarations having to do with the four output streams.
const Numeric SPEED_OF_LIGHT
Matrix los
Line-of-sight at each ppath point.
void get_stepwise_transmission_matrix(Tensor3View cumulative_transmission, Tensor3View T, Tensor4View dT_close_dx, Tensor4View dT_far_dx, ConstTensor3View cumulative_transmission_close, const PropagationMatrix &K_close, const PropagationMatrix &K_far, const ArrayOfPropagationMatrix &dK_close_dx, const ArrayOfPropagationMatrix &dK_far_dx, const Numeric &ppath_distance, const bool &first_level, const Numeric &dppath_distance_dT_HSE_close, const Numeric &dppath_distance_dT_HSE_far, const Index &temperature_derivative_position_if_hse_is_active)
Computes layer transmission matrix and cumulative transmission.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
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.
Vector lstep
The length between ppath points.
bool empty() const
Returns true if variable size is zero.
bool empty() const
Check if variable is empty.
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.
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.
Vector ngroup
The group index of refraction.
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...
Stokes vector is as Propagation matrix but only has 4 possible values.
void integration_bin_by_vecmult(VectorView h, ConstVectorView x_g_in, const Numeric &limit1, const Numeric &limit2)
integration_bin_by_vecmult
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Index nelem() const
Returns the number of elements.
Array< RadiationVector > ArrayOfRadiationVector
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 ze_cfac(Vector &fac, const Vector &f_grid, const Numeric &ze_tref, const Numeric &k2)
Calculates factor to convert back-scattering to Ze.
Sensor modelling functions.
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.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
The global header file for ARTS.
Array< ArrayOfRadiationVector > ArrayOfArrayOfRadiationVector
_CS_string_type str() const
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
Stuff related to the propagation matrix.
Array< TransmissionMatrix > ArrayOfTransmissionMatrix
ArrayOfArrayOfTransmissionMatrix cumulative_backscatter_derivative(ConstTensor5View t, const ArrayOfMatrix &aom)
Accumulated backscatter derivative (???)
void iyActiveSingleScat2(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, Tensor4 &ppvar_trans_cumulat, 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 Index &scat_data_checked, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &iy_transmitter_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Numeric &rte_alonglos_v, const Index &trans_in_jacobian, const Numeric &pext_scaling, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: iyActiveSingleScat2.
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 pha_mat_1ScatElem(Tensor6View pha_mat, Index &ptype, VectorView t_ok, const SingleScatteringData &ssd, const Vector &T_array, const Matrix &pdir_array, const Matrix &idir_array, const Index &f_start, const Index &t_interp_order)
Preparing phase matrix from one scattering element.
void get_stepwise_scattersky_propmat(StokesVector &ap, PropagationMatrix &Kp, ArrayOfStokesVector &dap_dx, ArrayOfPropagationMatrix &dKp_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, ConstMatrixView ppath_1p_pnd, const ArrayOfMatrix &ppath_dpnd_dx, const Index ppath_1p_id, const ArrayOfArrayOfSingleScatteringData &scat_data, ConstVectorView ppath_line_of_sight, ConstVectorView ppath_temperature, const Index &atmosphere_dim, const bool &jacobian_do)
Computes the contribution by scattering at propagation path point.
NUMERIC Numeric
The type to use for all floating point numbers.
void set_backscatter_radiation_vector(ArrayOfRadiationVector &I, ArrayOfArrayOfArrayOfRadiationVector &dI, const RadiationVector &I_incoming, const ArrayOfTransmissionMatrix &T, const ArrayOfTransmissionMatrix &PiTf, const ArrayOfTransmissionMatrix &PiTr, const ArrayOfTransmissionMatrix &Z, const ArrayOfArrayOfTransmissionMatrix &dT1, const ArrayOfArrayOfTransmissionMatrix &dT2, const ArrayOfArrayOfTransmissionMatrix &dZ, const BackscatterSolver solver)
Set the backscatter radiation vector.
void iyActiveSingleScat(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, Tensor4 &ppvar_trans_cumulat, 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 Index &scat_data_checked, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &iy_transmitter_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmission, const Numeric &rte_alonglos_v, const Index &trans_in_jacobian, const Numeric &pext_scaling, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: iyActiveSingleScat.
void error_if_limb_ppath(const Ppath &ppath)
Throws an error if ppath altitudes not are strictly increasing or decreasing.
Radiation Vector for Stokes dimension 1-4.
Numeric pow(const Rational base, Numeric exp)
Power of.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
Header file for logic.cc.
This can be used to make arrays out of anything.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
void geo_pos_agendaExecute(Workspace &ws, Vector &geo_pos, const Ppath &ppath, const Agenda &input_agenda)
void resize(Index n)
Resize function.
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 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.
const String SCATSPECIES_MAINTAG
Index nbooks() const
Returns the number of books.
void stokes2pol(VectorView w, const Index &stokes_dim, const Index &ipol_1based, const Numeric nv)
stokes2pol
void mirror_los(Vector &los_mirrored, ConstVectorView los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
void yActive(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 String &iy_unit, const ArrayOfString &iy_aux_vars, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &cloudbox_checked, const Matrix &sensor_pos, const Matrix &sensor_los, const Index &sensor_checked, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &iy_main_agenda, const Agenda &geo_pos_agenda, const ArrayOfArrayOfIndex &instrument_pol_array, const Vector &range_bins, const Numeric &ze_tref, const Numeric &k2, const Numeric &dbze_min, const Verbosity &)
WORKSPACE METHOD: yActive.
The structure to describe a propagation path and releated quantities.
void solve(VectorView w, const CovarianceMatrix &A, ConstVectorView v)
ArrayOfTransmissionMatrix cumulative_backscatter(ConstTensor5View t, ConstMatrixView m)
Accumulated backscatter (???)
void iy_transmitter_agendaExecute(Workspace &ws, Matrix &iy, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
Index nrows() const
Returns the number of rows.
void resize(Index b, Index p, Index r, Index c)
Resize function.
Declaration of functions in rte.cc.
void resize(Index r, Index c)
Resize function.