66 const Index& stokes_dim,
68 const Index& atmosphere_dim,
80 const Index& cloudbox_on,
86 const Index& scat_data_checked,
88 const Index& jacobian_do,
91 const Agenda& propmat_clearsky_agenda,
92 const Agenda& water_p_eq_agenda,
93 const Agenda& iy_transmitter_agenda,
95 const Index& trans_in_jacobian,
97 const Index& t_interp_order,
98 const Verbosity& verbosity [[maybe_unused]]) {
100 const Index j_analytical_do = jacobian_do ?
101 do_analytical_jacobian<1>(jacobian_quantities) : 0;
108 const Index nq = j_analytical_do ? jacobian_quantities.
nelem() : 0;
117 "ppath.background is invalid. Check your "
118 "calculation of *ppath*?");
120 "The propagation path ends inside or at boundary of "
121 "the cloudbox.\nFor this method, *ppath* must be "
122 "calculated in this way:\n ppathCalc( cloudbox_on = 0 ).");
125 "The scattering data must be flagged to have\n"
126 "passed a consistency check (scat_data_checked=1).");
128 "*pnd_field* and *scat_data* inconsistent regarding total number of"
129 " scattering elements.");
134 "revision before safe to use.");
137 "*dpnd_field_dx* not properly initialized:\n"
138 "Number of elements in dpnd_field_dx must be equal number of jacobian"
139 " quantities.\n(Note: jacobians have to be defined BEFORE *pnd_field*"
140 " is calculated/set.");
152 ppath.
pos(np - 1,
Range(0, atmosphere_dim)),
154 iy_transmitter_agenda);
157 "The size of *iy* returned from *iy_transmitter_agenda* is\n"
159 " expected size = [", nf,
",", stokes_dim,
"]\n"
160 " size of iy = [", iy0.
nrows(),
",", iy0.
ncols(),
"]\n")
161 for (
Index iv = 0; iv < nf; iv++)
163 "The *iy* returned from *iy_transmitter_agenda* "
164 "must have the value 1 in the first column.");
178 diy_dx = j_analytical_do ?
191 Index auxBackScat = -1;
192 Index auxAbSpAtte = -1;
193 Index auxPartAtte = -1;
195 for (
Index i = 0; i < naux; i++) {
196 iy_aux[i].resize(nf * np,
ns);
198 if (iy_aux_vars[i] ==
"Radiative background") {
201 }
else if( iy_aux_vars[i] ==
"Backscattering" ) {
204 }
else if( iy_aux_vars[i] ==
"Abs species extinction" ) {
207 }
else if( iy_aux_vars[i] ==
"Particle extinction" ) {
212 "The only allowed strings in *iy_aux_vars* are:\n"
213 " \"Radiative background\"\n"
214 " \"Backscattering\"\n"
217 "but you have selected: \"", iy_aux_vars[i],
"\"")
241 const Index nf_ssd = scat_data[0][0].pha_mat_data.nlibraries();
242 const Index duplicate_freqs = ((nf == nf_ssd) ? 0 : 1);
244 Vector t_ok(1), t_array(1);
245 Matrix mlos_sca(1, 2), mlos_inc(1, 2);
249 if (np == 1 && rbi == 1) {
279 ppvar_f, ppath, f_grid, atmosphere_dim, rte_alonglos_v, ppvar_wind);
292 clear2cloudy.resize(np);
293 for (
Index ip = 0; ip < np; ip++)
294 clear2cloudy[ip] = -1;
308 Index temperature_derivative_position = -1;
311 if (trans_in_jacobian && j_analytical_do) {
312 dK_this_dx.resize(nq);
313 dK_past_dx.resize(nq);
325 temperature_derivative_position = iq;
326 do_hse = jacobian_quantities[iq].Subtag() ==
"HSE on";
331 for (
Index ip = 0; ip < np; ip++) {
338 propmat_clearsky_agenda,
341 ppvar_mag(
joker, ip),
344 ppvar_vmr(
joker, ip),
347 trans_in_jacobian && j_analytical_do);
349 if (trans_in_jacobian && j_analytical_do)
358 trans_in_jacobian && j_analytical_do);
360 if (clear2cloudy[ip] + 1) {
371 ppvar_t[
Range(ip, 1)],
373 trans_in_jacobian && jacobian_do);
375 if (
abs(pext_scaling - 1) > 1e-6) {
377 if (trans_in_jacobian && j_analytical_do) {
383 if (auxAbSpAtte >= 0) {
384 for (
Index iv = 0; iv < nf; iv++) {
385 iy_aux[auxAbSpAtte](iv*np+ip,
joker) = K_this.Kjj()[iv];
388 if (auxPartAtte >= 0) {
389 for (
Index iv = 0; iv < nf; iv++) {
390 iy_aux[auxPartAtte](iv*np+ip,
joker) = Kp.
Kjj()[iv];
396 if (trans_in_jacobian && j_analytical_do)
404 mlos_sca(0,
joker) = los_sca;
408 if (atmosphere_dim == 3) {
413 mlos_inc(0,
joker) = los_inc;
416 for (
Index i_ss = 0; i_ss < scat_data.
nelem(); i_ss++)
417 for (
Index i_se = 0; i_se < scat_data[i_ss].
nelem(); i_se++) {
421 if (ppvar_pnd(i_se_flat, ip) != 0)
423 else if (j_analytical_do)
424 for (
Index iq = 0; iq < nq && !val_pnd; iq++)
425 if (jac_scat_i[iq] >= 0)
426 if (ppvar_dpnd_dx[iq](i_se_flat, ip) != 0) {
434 scat_data[i_ss][i_se],
435 ppvar_t[
Range(ip, 1)],
440 if (t_ok[0] not_eq 0)
442 for (
Index iv = 0; iv < nf; iv++)
450 "Interpolation error for (flat-array) scattering"
451 " element #", i_se_flat,
"\n"
452 "at location/temperature point #", ip,
"\n")
463 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip - 1]) : 0;
465 do_hse ? ppath.
lstep[ip - 1] / (2.0 * ppvar_t[ip]) : 0;
476 temperature_derivative_position);
479 swap(K_past, K_this);
480 swap(dK_past_dx, dK_this_dx);
513 for (
Index ip = 0; ip < np; ip++) {
514 for (
Index iv = 0; iv < nf; iv++) {
515 for (
Index is = 0; is < stokes_dim; is++) {
516 iy(iv*np+ip, is) = lvl_rad[ip](iv, is);
517 if (j_analytical_do) {
519 diy_dpath[iq](ip, iv*np+ip2, is) =
520 dlvl_rad[ip][ip2][iq](iv, is););
527 if (j_analytical_do) {
528 const Index iy_agenda_call1 = 1;
529 const Tensor3 iy_transmittance(0, 0, 0);
550 if (auxBackScat >= 0) {
551 for (
Index ip = 0; ip < np; ip++) {
552 for (
Index iv = 0; iv < nf; iv++) {
554 MapToEigen(stokesvec).noalias() = reflect_matrix[ip].Mat(iv) * rad_inc.
Vec(iv);
572 const Index& atmgeom_checked,
573 const Index& atmfields_checked,
574 const String& iy_unit_radar,
576 const Index& stokes_dim,
578 const Index& atmosphere_dim,
579 const Index& cloudbox_on,
580 const Index& cloudbox_checked,
583 const Index& sensor_checked,
584 const Index& jacobian_do,
586 const Agenda& iy_radar_agenda,
587 const Agenda& geo_pos_agenda,
614 "The atmospheric fields must be flagged to have "
615 "passed a consistency check (atmfields_checked=1).");
617 "The atmospheric geometry must be flagged to have "
618 "passed a consistency check (atmgeom_checked=1).");
620 "The cloudbox must be flagged to have "
621 "passed a consistency check (cloudbox_checked=1).");
623 "The sensor variables must be flagged to have "
624 "passed a consistency check (sensor_checked=1).");
627 bool is_z =
max(range_bins) > 1;
629 "The vector *range_bins* must contain strictly "
630 "increasing values.");
632 "The vector *range_bins* is not allowed to contain "
635 "The main length of *instrument_pol_array* must match "
636 "the number of frequencies.");
641 const Numeric jfac = 10 * log10(exp(1.0));
642 if (iy_unit_radar ==
"1") {
643 }
else if (iy_unit_radar ==
"Ze") {
644 ze_cfac(cfac, f_grid, ze_tref, k2);
645 }
else if (iy_unit_radar ==
"dBZe") {
646 ze_cfac(cfac, f_grid, ze_tref, k2);
647 ze_min =
pow(10.0, dbze_min / 10);
650 "For this method, *iy_unit_radar* must be set to \"1\", "
651 "\"Ze\" or \"dBZe\".");
662 for (
Index i = 0; i < nf; i++) {
663 const Index ni = instrument_pol_array[i].
nelem();
664 npolcum[i + 1] = npolcum[i] + ni;
666 for (
Index j = 0; j < ni; j++) {
667 W[i][j].resize(stokes_dim);
668 stokes2pol(W[i][j], stokes_dim, instrument_pol_array[i][j], 0.5);
674 const Index ntot = npos * npolcum[nf] * nbins;
686 for (
Index i = 0; i < naux; i++) {
687 y_aux[i].resize(ntot);
693 Index j_analytical_do = 0;
702 jacobian_indices[jacobian_indices.
nelem() - 1][1] + 1);
704 njq = jacobian_quantities.
nelem();
716 for (
Index p = 0; p < npos; p++) {
733 sensor_pos(p,
joker),
734 sensor_los(p,
joker),
740 "A path consisting of a single point found. "
741 "This is not allowed.");
744 "The size of *iy* returned from *iy_radar_agenda* "
745 "is not correct (for this method).");
753 for (
Index i = 1; i < np; i++) {
754 range[i] = range[i - 1] + ppath.
lstep[i - 1] *
759 const Numeric range_end1 =
min(range[0], range[np - 1]);
760 const Numeric range_end2 =
max(range[0], range[np - 1]);
764 if (!(range_bins[
b] >= range_end2 ||
765 range_bins[
b + 1] <= range_end1))
769 Numeric blim2 =
min(range_bins[
b + 1], range_end2);
776 hbin /= (blim2 - blim1);
778 for (
Index iv = 0; iv < nf; iv++) {
782 if (j_analytical_do) {
794 if (j_analytical_do) {
799 auxvar[
a].resize(np);
802 for (
Index ip = 0; ip < instrument_pol_array[iv].
nelem(); ip++) {
804 mult(refl, I, W[iv][ip]);
805 if (j_analytical_do) {
807 k < drefl[iq].nrows();
813 if (iy_aux_vars[
a] ==
"Backscattering") {
814 mult(auxvar[
a], A[
a], W[iv][ip]);
816 for (
Index j = 0; j < np; j++) {
817 auxvar[
a][j] = A[
a](j, 0);
823 Index iout = nbins * (p * npolcum[nf] + npolcum[iv] + ip) +
b;
824 y[iout] = cfac[iv] * (hbin * refl);
826 if (j_analytical_do) {
828 for (
Index k = 0; k < drefl[iq].nrows(); k++) {
829 jacobian(iout, jacobian_indices[iq][0] + k) =
830 cfac[iv] * (hbin * drefl[iq](k,
joker));
831 if (iy_unit_radar ==
"dBZe") {
832 jacobian(iout, jacobian_indices[iq][0] + k) *=
833 jfac /
max(y[iout], ze_min);
838 if (iy_unit_radar ==
"dBZe") {
839 y[iout] = y[iout] <= ze_min ? dbze_min : 10 * log10(y[iout]);
844 if (iy_aux_vars[
a] ==
"Backscattering") {
845 y_aux[
a][iout] = cfac[iv] * (hbin * auxvar[
a]);
846 if (iy_unit_radar ==
"dBZe") {
847 y_aux[
a][iout] = y_aux[
a][iout] <= ze_min
849 : 10 * log10(y_aux[
a][iout]);
852 y_aux[
a][iout] = hbin * auxvar[
a];
865 "Wrong size of *geo_pos* obtained from "
866 "*geo_pos_agenda*.\nThe length of *geo_pos* must "
867 "be zero or equal to *atmosphere_dim*.");
870 for (
Index iv = 0; iv < nf; iv++) {
871 for (
Index ip = 0; ip < instrument_pol_array[iv].
nelem(); ip++) {
872 const Index iout = nbins * (p * npolcum[nf] + npolcum[iv] + ip) +
b;
873 y_f[iout] = f_grid[iv];
874 y_pol[iout] = instrument_pol_array[iv][ip];
877 if (geo_pos.
nelem()) {
878 y_geo(iout,
joker) = geo_pos;
891 Tensor4& particle_bulkprop_field,
893 const Index& atmosphere_dim,
901 const Index& atmfields_checked,
902 const Index& atmgeom_checked,
904 const Agenda& propmat_clearsky_agenda,
911 const Index& fill_clutter,
915 const Index& do_atten_abs,
916 const Index& do_atten_hyd,
917 const Numeric& atten_hyd_scaling,
927 "The atmospheric fields must be flagged to have\n"
928 "passed a consistency check (atmfields_checked=1).");
930 "The atmospheric geometry must be flagged to have\n"
931 "passed a consistency check (atmgeom_checked=1).");
935 "*dbze_noise* not covered by invtable[0]." );
937 "*dbze_noise* not covered by invtable[1]." );
938 chk_atm_field(
"GIN reflectivities", dBZe, atmosphere_dim, p_grid,
947 if (h_clutter.
nrows() > 1 || h_clutter.
ncols() > 1) {
948 chk_atm_surface(
"GIN h_clutter", h_clutter, atmosphere_dim, lat_grid, lon_grid);
949 hclutterm = h_clutter;
951 hclutterm.
resize(nlat, nlon);
952 hclutterm = h_clutter(0,0);
956 particle_bulkprop_field.
resize(2, np, nlat, nlon);
957 particle_bulkprop_field = 0;
958 particle_bulkprop_names = scat_species;
963 const Numeric extrap_fac = 100;
966 Agenda l_propmat_clearsky_agenda(propmat_clearsky_agenda);
970#pragma omp parallel for if (!arts_omp_in_parallel() && nlat + nlon > 2) \
971 firstprivate(l_ws, l_propmat_clearsky_agenda) collapse(2)
972 for (
Index ilat = 0; ilat < nlat; ilat++) {
973 for (
Index ilon = 0; ilon < nlon; ilon++) {
974 if (fail_msg.
nelem() != 0)
continue;
977 if (
max(dBZe(
joker, ilat, ilon)) > dbze_noise) {
980 Numeric k_part_above = 0, k_abs_above = 0;
984 for (
Index ip = np - 1; ip >= 0; ip--) {
986 if (z_field(ip, ilat, ilon) >= z_surface(ilat, ilon) +
987 hclutterm(ilat, ilon)) {
990 dBZe(ip, ilat, ilon) + dbze_corr_abs + dbze_corr_hyd;
993 const Numeric t = t_field(ip, ilat, ilon);
996 Index phase = -1, it = -1;
997 if (dbze > dbze_noise) {
999 phase = t >= t_phase ? 0 : 1;
1007 else if (t >= invtable[phase].get_numeric_grid(
1014 it = gp.
fd[0] < 0.5 ? gp.
idx : gp.
idx + 1;
1021 if (dBZe(ip, ilat, ilon) > dbze_noise && do_atten_hyd &&
1022 dbze_corr_hyd < atten_hyd_max) {
1026 "Max 20 dB extrapolation allowed. Found a value\n"
1027 "exceeding this limit.");
1036 interp(itw, invtable[phase].data(1,
joker, it), gp);
1039 0.5 * hfac * (k_part_above + k_this) *
1040 (z_field(ip + 1, ilat, ilon) - z_field(ip, ilat, ilon));
1045 dbze_corr_hyd =
min(dbze_corr_hyd, atten_hyd_max);
1047 k_part_above = k_this;
1072 t_field(ip, ilat, ilon),
1073 rtp_nlte_local_dummy,
1074 vmr_field(
joker, ip, ilat, ilon),
1075 l_propmat_clearsky_agenda);
1076 k_this = propmat.
Kjj()[0];
1079 0.5 * hfac * (k_abs_above + k_this) *
1080 (z_field(ip + 1, ilat, ilon) - z_field(ip, ilat, ilon));
1084 k_abs_above = k_this;
1089 if (dBZe(ip, ilat, ilon) > dbze_noise) {
1091 dbze = dBZe(ip, ilat, ilon) + dbze_corr_abs + dbze_corr_hyd;
1096 "Max 20 dB extrapolation allowed. Found a value\n"
1097 "exceeding this limit.");
1107 (
interp(itw, invtable[phase].data(0,
joker, it), gp)));
1111 else if (wc > wc_clip)
1113 particle_bulkprop_field(phase, ip, ilat, ilon) = wc;
1119 particle_bulkprop_field(0, ip, ilat, ilon) =
1120 particle_bulkprop_field(0, ip + 1, ilat, ilon);
1121 particle_bulkprop_field(1, ip, ilat, ilon) =
1122 particle_bulkprop_field(1, ip + 1, ilat, ilon);
1128 }
catch (
const std::exception& e) {
1130 os <<
"Run-time error at ilat: " << ilat <<
" ilon: " << ilon <<
":\n"
1132#pragma omp critical(particle_bulkpropRadarOnionPeeling_latlon)
1133 fail_msg.push_back(os.str());
1138 if (fail_msg.
nelem()) {
1140 for (
const auto& msg : fail_msg) os << msg <<
'\n';
1155 const Index& i_species,
1168 const Index iss = i_species;
1172 "First element in T_grid of scattering species is "
1173 "below 220 K.\nThat seems to be too low for liquid.\n"
1174 "Please note that the onion peeling function expects "
1175 "rain\nas the first scattering element.");
1177 "This method requires that *f_grid* has length 1.");
1179 "*i_species* must either be 0 or 1.");
1181 "*scat_data* must contain data for exactly two "
1182 "scattering species.");
1184 "*scat_data* and *scat_species* are inconsistent in size.");
1186 "*scat_data* and *scat_meta* are inconsistent in size.");
1188 "*scat_data* and *scat_meta* have inconsistent sizes.");
1190 "*scat_data* should just contain one frequency.");
1192 "The PSD applied must be of 1-moment type.");
1195 if (invtable.empty())
1197 invtable[iss].set_name(
"Radar inversion table created by *RadarOnionPeelingTableCalc*");
1198 invtable[iss].resize(2, ndb, nt);
1199 invtable[iss].data = 0;
1200 invtable[iss].set_grid_name(0,
"Radiative properties");
1201 invtable[iss].set_grid(0, {
"Log of water content",
"Extinction"});
1202 invtable[iss].set_grid_name(1,
"Radar reflectivity");
1203 invtable[iss].set_grid(1, dbze_grid);
1204 invtable[iss].set_grid_name(2,
"Temperature");
1205 invtable[iss].set_grid(2, t_grid);
1213 for (
Index i=0; i<nse; i++) {
1215 "So far only TRO is handled by this method.");
1216 const Index ib = scat_data[iss][i].za_grid.
nelem() - 1;
1218 "All za_grid in scat_data must end with 180.\n"
1219 "This is not the case for scat_data[", iss,
"][",
1221 gridpos(gp, scat_data[iss][i].T_grid, t_grid, 1);
1223 interp(e(
joker,i), itw, scat_data[iss][i].ext_mat_data(0,
joker,0,0,0), gp);
1224 interp(
b(
joker,i), itw, scat_data[iss][i].pha_mat_data(0,
joker,ib,0,0,0,0), gp);
1237 const Vector& pnd_agenda_input_t = t_grid;
1238 Matrix pnd_agenda_input(nt, 1);
1242 ze_cfac(cfac, f_grid, ze_tref, k2);
1246 pnd_agenda_input = wc_grid[
w];
1255 pnd_agenda_array_input_names[iss],
1260 for (
Index t=0; t<nt; t++) {
1261 for (
Index i=0; i<nse; i++) {
1263 "A negative back-scattering found for scat_species ", iss,
1264 ",\ntemperature ", t_grid[t],
"K and element ", i)
1266 "A negative extinction found for scat_species ", iss,
1267 ",\ntemperature ", t_grid[t],
"K and element ", i)
1269 "A negative PSD value found for scat_species ", iss,
1270 ",\ntemperature ", t_grid[t],
"K and ", wc_grid[
w],
1272 D(0,
w,t) += pnd_data(t,i) *
b(t,i);
1273 D(1,
w,t) += pnd_data(t,i) * e(t,i);
1276 D(0,
w,t) = 10 * log10(cfac[0] * D(0,
w,t));
1286 for (
Index t=0; t<nt; t++) {
1289 cout << wc_grid[
w] <<
" " << D(0,
w,t) << endl;
1292 "A case found of non-increasing dBZe.\n"
1293 "Found for scat_species ", iss,
" and ", t_grid[t],
"K.")
1295 if (D(0,0,t) > dbze_grid[0]) {
1297 cout << wc_grid[
w] <<
" " << D(0,
w,t) << endl;
1300 "A case found where start of dbze_grid not covered.\n"
1301 "Found for scat_species ", iss,
" and ", t_grid[t],
"K.")
1303 if (D(0,nwc-1,t) < dbze_grid[ndb-1]) {
1305 cout << wc_grid[
w] <<
" " << D(0,
w,t) << endl;
1308 "A case found where end of dbze_grid not covered.\n"
1309 "Found for scat_species ", iss,
" and ", t_grid[t],
"K.")
1314 interp(invtable[iss].data(0,
joker,t), itw, wc_log, gp);
Array< Index > ArrayOfIndex
An array of Index.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
Array< Tensor3 > ArrayOfTensor3
An array of Tensor3.
The global header file for ARTS.
Header file for helper functions for OpenMP.
void iy_transmitter_agendaExecute(Workspace &ws, Matrix &iy, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
void geo_pos_agendaExecute(Workspace &ws, Vector &geo_pos, const Ppath &ppath, const Agenda &input_agenda)
void propmat_clearsky_agendaExecute(Workspace &ws, PropagationMatrix &propmat_clearsky, StokesVector &nlte_source, ArrayOfPropagationMatrix &dpropmat_clearsky_dx, ArrayOfStokesVector &dnlte_source_dx, const ArrayOfRetrievalQuantity &jacobian_quantities, const Vector &f_grid, const Vector &rtp_mag, const Vector &rtp_los, const Numeric rtp_pressure, const Numeric rtp_temperature, const EnergyLevelMap &rtp_nlte, const Vector &rtp_vmr, const Agenda &input_agenda)
void pnd_agenda_arrayExecute(Workspace &ws, Matrix &pnd_data, Tensor3 &dpnd_data_dx, const Index agenda_array_index, const Vector &pnd_agenda_input_t, const Matrix &pnd_agenda_input, const ArrayOfString &pnd_agenda_input_names, const ArrayOfString &dpnd_data_dx_names, const ArrayOfAgenda &input_agenda_array)
void iy_radar_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const ArrayOfString &iy_aux_vars, const Index iy_id, const Index cloudbox_on, const Index jacobian_do, const Vector &rte_pos, const Vector &rte_los, const Agenda &input_agenda)
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const
Returns the number of pages.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
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(Index r, Index c)
Resize function.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
Stokes vector is as Propagation matrix but only has 4 possible values.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
const Numeric DEG2RAD
Global constant, conversion from degrees to radians.
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
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.
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.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
MatrixViewMap MapToEigen(Tensor3View &A, const Index &i)
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Header file for logic.cc.
void VectorLogSpace(Vector &x, const Numeric &start, const Numeric &stop, const Numeric &step, const Verbosity &verbosity)
WORKSPACE METHOD: VectorLogSpace.
const Index GFIELD3_T_GRID
void yRadar(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_radar, const ArrayOfString &iy_aux_vars, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, 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_radar_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: yRadar.
const Index GFIELD3_DB_GRID
const Numeric LOG10_EULER_NUMBER
void RadarOnionPeelingTableCalc(Workspace &ws, ArrayOfGriddedField3 &invtable, const Vector &f_grid, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfArrayOfScatteringMetaData &scat_meta, const ArrayOfAgenda &pnd_agenda_array, const ArrayOfArrayOfString &pnd_agenda_array_input_names, const Index &i_species, const Vector &dbze_grid, const Vector &t_grid, const Numeric &wc_min, const Numeric &wc_max, const Numeric &ze_tref, const Numeric &k2, const Verbosity &verbosity)
WORKSPACE METHOD: RadarOnionPeelingTableCalc.
void iyRadarSingleScat(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, Vector &ppvar_p, Vector &ppvar_t, Matrix &ppvar_vmr, Matrix &ppvar_wind, Matrix &ppvar_mag, Matrix &ppvar_pnd, Matrix &ppvar_f, 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 Numeric &rte_alonglos_v, const Index &trans_in_jacobian, const Numeric &pext_scaling, const Index &t_interp_order, const Verbosity &verbosity)
WORKSPACE METHOD: iyRadarSingleScat.
const Numeric SPEED_OF_LIGHT
void particle_bulkpropRadarOnionPeeling(Workspace &ws, Tensor4 &particle_bulkprop_field, ArrayOfString &particle_bulkprop_names, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Matrix &z_surface, const Index &atmfields_checked, const Index &atmgeom_checked, const Vector &f_grid, const Agenda &propmat_clearsky_agenda, const ArrayOfString &scat_species, const ArrayOfGriddedField3 &invtable, const Matrix &incangles, const Tensor3 &dBZe, const Numeric &dbze_noise, const Matrix &h_clutter, const Index &fill_clutter, const Numeric &t_phase, const Numeric &wc_max, const Numeric &wc_clip, const Index &do_atten_abs, const Index &do_atten_hyd, const Numeric &atten_hyd_scaling, const Numeric &atten_hyd_max, const Verbosity &)
WORKSPACE METHOD: particle_bulkpropRadarOnionPeeling.
Numeric last(ConstVectorView x)
last
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.
void swap(ComplexVector &v1, ComplexVector &v2)
Swaps two objects.
Declarations having to do with the four output streams.
Index nelem(const Lines &l)
Number of lines.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
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 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.
Stuff related to the propagation matrix.
Numeric pow(const Rational base, Numeric exp)
Power of.
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 ze_cfac(Vector &fac, const Vector &f_grid, const Numeric &ze_tref, const Numeric &k2)
Calculates factor to convert back-scattering to Ze.
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_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 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_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 mirror_los(Vector &los_mirrored, const ConstVectorView &los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
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_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 integration_bin_by_vecmult(VectorView h, ConstVectorView x_g_in, const Numeric &limit1, const Numeric &limit2)
integration_bin_by_vecmult
void stokes2pol(VectorView w, const Index &stokes_dim, const Index &ipol_1based, const Numeric nv)
stokes2pol
Sensor modelling functions.
Structure to store a grid position.
std::array< Numeric, 2 > fd
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
Numeric end_lstep
The distance between end pos and the first position in pos.
Vector lstep
The length between ppath points.
Vector ngroup
The group index of refraction.
Radiation Vector for Stokes dimension 1-4.
Eigen::VectorXd Vec(size_t i) const
Return Vector at position by copy.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
ArrayOfTransmissionMatrix bulk_backscatter(const ConstTensor5View &Pe, const ConstMatrixView &pnd)
Bulk back-scattering.
ArrayOfArrayOfTransmissionMatrix bulk_backscatter_derivative(const ConstTensor5View &Pe, const ArrayOfMatrix &dpnd_dx)
Derivatives of bulk back-scattering
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
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 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.
@ CommutativeTransmission
Array< ArrayOfRadiationVector > ArrayOfArrayOfRadiationVector
Array< RadiationVector > ArrayOfRadiationVector
Array< TransmissionMatrix > ArrayOfTransmissionMatrix