32#include "matpack_data.h"
39inline constexpr Numeric
PI=pi;
41#define F11 pha_mat_int[0]
42#define F12 pha_mat_int[1]
43#define F22 pha_mat_int[2]
44#define F33 pha_mat_int[3]
45#define F34 pha_mat_int[4]
46#define F44 pha_mat_int[5]
93 const ArrayOfTensor5& ext_mat_ss,
94 const ArrayOfTensor4& abs_vec_ss,
96 ARTS_ASSERT(ext_mat_ss.nelem() == abs_vec_ss.nelem());
98 ext_mat = ext_mat_ss[0];
99 abs_vec = abs_vec_ss[0];
101 for (Index i_ss = 1; i_ss < ext_mat_ss.nelem(); i_ss++) {
102 ext_mat += ext_mat_ss[i_ss];
103 abs_vec += abs_vec_ss[i_ss];
105 ptype =
max(ptypes_ss);
135 ArrayOfTensor5& ext_mat,
136 ArrayOfTensor4& abs_vec,
139 const ArrayOfArrayOfTensor5& ext_mat_se,
140 const ArrayOfArrayOfTensor4& abs_vec_se,
142 ConstMatrixView pnds,
143 ConstMatrixView t_ok) {
148 ARTS_ASSERT(ext_mat_se.nelem() == abs_vec_se.nelem());
150 const Index nT = pnds.ncols();
151 const Index nf = abs_vec_se[0][0].nbooks();
152 const Index nDir = abs_vec_se[0][0].nrows();
153 const Index stokes_dim = abs_vec_se[0][0].ncols();
155 const Index nss = ext_mat_se.nelem();
164 for (Index i_ss = 0; i_ss < nss; i_ss++) {
165 ARTS_ASSERT(ext_mat_se[i_ss].nelem() == abs_vec_se[i_ss].nelem());
169 ext_mat[i_ss].resize(nf, nT, nDir, stokes_dim, stokes_dim);
171 abs_vec[i_ss].resize(nf, nT, nDir, stokes_dim);
174 for (Index i_se = 0; i_se < ext_mat_se[i_ss].nelem(); i_se++) {
175 ARTS_ASSERT(nT == ext_mat_se[i_ss][i_se].nbooks());
176 ARTS_ASSERT(nT == abs_vec_se[i_ss][i_se].npages());
178 for (Index Tind = 0; Tind < nT; Tind++) {
179 if (pnds(i_se_flat, Tind) != 0.) {
180 if (t_ok(i_se_flat, Tind) > 0.) {
181 ext_tmp = ext_mat_se[i_ss][i_se](joker, Tind, joker, joker, joker);
182 ext_tmp *= pnds(i_se_flat, Tind);
183 ext_mat[i_ss](joker, Tind, joker, joker, joker) += ext_tmp;
185 abs_tmp = abs_vec_se[i_ss][i_se](joker, Tind, joker, joker);
186 abs_tmp *= pnds(i_se_flat, Tind);
187 abs_vec[i_ss](joker, Tind, joker, joker) += abs_tmp;
190 "Interpolation error for (flat-array) scattering element #",
192 "at location/temperature point #", Tind,
"\n")
198 ptype[i_ss] =
max(ptypes_se[i_ss]);
234 ArrayOfArrayOfTensor5& ext_mat,
235 ArrayOfArrayOfTensor4& abs_vec,
240 const Index& stokes_dim,
241 const Vector& T_array,
242 const Matrix& dir_array,
243 const Index& f_index,
244 const Index& t_interp_order) {
247 nf = scat_data[0][0].ext_mat_data.nshelves();
252 if (scat_data[0][0].ext_mat_data.nshelves() == 1)
259 const Index nT = T_array.
nelem();
260 const Index nDir = dir_array.nrows();
262 const Index nss = scat_data.
nelem();
268 t_ok.resize(Nse_all, nT);
271 for (Index i_ss = 0; i_ss < nss; i_ss++) {
272 Index nse = scat_data[i_ss].
nelem();
273 ext_mat[i_ss].resize(nse);
274 abs_vec[i_ss].resize(nse);
275 ptypes[i_ss].resize(nse);
277 for (Index i_se = 0; i_se < nse; i_se++) {
278 ext_mat[i_ss][i_se].resize(nf, nT, nDir, stokes_dim, stokes_dim);
279 abs_vec[i_ss][i_se].resize(nf, nT, nDir, stokes_dim);
284 t_ok(i_se_flat, joker),
285 scat_data[i_ss][i_se],
316 Index& this_T_interp_order,
318 ConstVectorView T_grid,
319 const Vector& T_array,
320 const Index& t_interp_order) {
321 const Index nTin = T_grid.nelem();
322 const Index nTout = T_array.nelem();
324 this_T_interp_order = -1;
328 this_T_interp_order =
min(t_interp_order, nTin - 1);
337 const Numeric extrapolfac = 0.5;
338 const Numeric lowlim = T_grid[0] - extrapolfac * (T_grid[1] - T_grid[0]);
339 const Numeric uplim =
340 T_grid[nTin - 1] + extrapolfac * (T_grid[nTin - 1] - T_grid[nTin - 2]);
342 bool any_T_exceed =
false;
343 for (Index Tind = 0; Tind < nTout; Tind++) {
344 if (T_array[Tind] < lowlim || T_array[Tind] > uplim) {
353 ArrayOfLagrangeInterpolation T_lag;
354 T_lag.reserve(nTout);
356 bool grid_unchecked =
true;
358 for (Index iT = 0; iT < nTout; iT++) {
360 T_lag.emplace_back(this_T_interp_order);
362 if (grid_unchecked) {
364 "Temperature interpolation in pha_mat_1ScatElem",
366 T_array[Range(iT, 1)],
367 this_T_interp_order);
368 grid_unchecked =
false;
370 T_lag.emplace_back(0, T_array[iT], T_grid, this_T_interp_order);
375 return my_interp::lagrange_interpolation_list<LagrangeInterpolation>(T_array, T_grid, this_T_interp_order, extrapolfac);
414 const Vector& T_array,
415 const Matrix& dir_array,
416 const Index& f_start,
417 const Index& t_interp_order) {
437 const Index nf = ext_mat.nshelves();
443 const Index nTout = T_array.nelem();
448 const Index nDir = dir_array.nrows();
452 const Index stokes_dim = abs_vec.ncols();
461 const Index nTin = ssd.
T_grid.nelem();
462 Index this_T_interp_order;
474 if (this_T_interp_order < 0)
478 Tensor3 ext_mat_tmp(nf, stokes_dim, stokes_dim);
479 Matrix abs_vec_tmp(nf, stokes_dim);
480 for (Index find = 0; find < nf; find++) {
490 for (Index Tind = 0; Tind < nTout; Tind++)
491 for (Index dind = 0; dind < nDir; dind++) {
492 ext_mat(joker, Tind, dind, joker, joker) = ext_mat_tmp;
493 abs_vec(joker, Tind, dind, joker) = abs_vec_tmp;
498 Tensor4 ext_mat_tmp(nf, nTout, stokes_dim, stokes_dim);
499 Tensor3 abs_vec_tmp(nf, nTout, stokes_dim);
500 Matrix ext_mat_tmp_ssd(nTout, ssd.
ext_mat_data.ncols());
501 Matrix abs_vec_tmp_ssd(nTout, ssd.
abs_vec_data.ncols());
502 for (Index find = 0; find < nf; find++) {
503 for (Index nst = 0; nst < ext_mat_tmp_ssd.ncols(); nst++) {
504 reinterp(ext_mat_tmp_ssd(joker, nst),
508 for (Index Tind = 0; Tind < nTout; Tind++)
511 ext_mat_tmp_ssd(Tind, joker),
515 ext_mat_tmp(find, Tind, joker, joker) = 0.;
517 for (Index nst = 0; nst < abs_vec_tmp_ssd.ncols(); nst++) {
518 reinterp(abs_vec_tmp_ssd(joker, nst),
523 for (Index Tind = 0; Tind < nTout; Tind++)
526 abs_vec_tmp_ssd(Tind, joker),
530 abs_vec_tmp(find, Tind, joker) = 0.;
533 for (Index dind = 0; dind < nDir; dind++) {
534 ext_mat(joker, joker, dind, joker, joker) = ext_mat_tmp;
535 abs_vec(joker, joker, dind, joker) = abs_vec_tmp;
551 Matrix dir_itw(nDir, 2);
557 if (this_T_interp_order < 0)
559 Matrix ext_mat_tmp_ssd(nDir, next);
560 Matrix abs_vec_tmp_ssd(nDir, nabs);
561 Tensor4 ext_mat_tmp(nf, nDir, stokes_dim, stokes_dim);
562 Tensor3 abs_vec_tmp(nf, nDir, stokes_dim);
563 for (Index find = 0; find < nf; find++) {
564 for (Index nst = 0; nst < next; nst++)
565 interp(ext_mat_tmp_ssd(joker, nst),
569 for (Index Dind = 0; Dind < nDir; Dind++)
571 ext_mat_tmp_ssd(Dind, joker),
575 for (Index nst = 0; nst < nabs; nst++)
576 interp(abs_vec_tmp_ssd(joker, nst),
580 for (Index Dind = 0; Dind < nDir; Dind++)
582 abs_vec_tmp_ssd(Dind, joker),
587 for (Index Tind = 0; Tind < nTout; Tind++) {
588 ext_mat(joker, Tind, joker, joker, joker) = ext_mat_tmp;
589 abs_vec(joker, Tind, joker, joker) = abs_vec_tmp;
594 Tensor3 ext_mat_tmp_ssd(nTin, nDir, next);
595 Tensor3 abs_vec_tmp_ssd(nTin, nDir, nabs);
596 Matrix ext_mat_tmp(nTout, next);
597 Matrix abs_vec_tmp(nTout, nabs);
599 for (Index find = 0; find < nf; find++) {
600 for (Index Tind = 0; Tind < nTin; Tind++) {
601 for (Index nst = 0; nst < next; nst++)
602 interp(ext_mat_tmp_ssd(Tind, joker, nst),
606 for (Index nst = 0; nst < nabs; nst++)
607 interp(abs_vec_tmp_ssd(Tind, joker, nst),
613 for (Index Dind = 0; Dind < nDir; Dind++) {
614 for (Index nst = 0; nst < next; nst++) {
615 reinterp(ext_mat_tmp(joker, nst),
616 ext_mat_tmp_ssd(joker, Dind, nst),
620 for (Index Tind = 0; Tind < nTout; Tind++)
622 ext_mat_tmp(Tind, joker),
626 for (Index nst = 0; nst < nabs; nst++) {
627 reinterp(abs_vec_tmp(joker, nst),
628 abs_vec_tmp_ssd(joker, Dind, nst),
632 for (Index Tind = 0; Tind < nTout; Tind++)
634 abs_vec_tmp(Tind, joker),
658 MatrixView ext_mat_stokes,
660 ConstVectorView ext_mat_ssd,
661 const Index& stokes_dim,
662 const Index& ptype) {
669 for (Index ist = 0; ist < stokes_dim; ist++) {
670 ext_mat_stokes(ist, ist) = ext_mat_ssd[0];
674 switch (stokes_dim) {
676 ext_mat_stokes(2, 3) = ext_mat_ssd[2];
677 ext_mat_stokes(3, 2) = -ext_mat_ssd[2];
684 ext_mat_stokes(0, 1) = ext_mat_ssd[1];
685 ext_mat_stokes(1, 0) = ext_mat_ssd[1];
706 VectorView abs_vec_stokes,
708 ConstVectorView abs_vec_ssd,
709 const Index& stokes_dim,
710 const Index& ptype) {
717 abs_vec_stokes[0] = abs_vec_ssd[0];
720 abs_vec_stokes[1] = abs_vec_ssd[1];
746 const ArrayOfTensor6& pha_mat_ss,
748 pha_mat = pha_mat_ss[0];
750 for (Index i_ss = 1; i_ss < pha_mat_ss.nelem(); i_ss++)
751 pha_mat += pha_mat_ss[i_ss];
753 ptype =
max(ptypes_ss);
781 ArrayOfTensor6& pha_mat,
784 const ArrayOfArrayOfTensor6&
787 ConstMatrixView pnds,
788 ConstMatrixView t_ok) {
793 const Index nT = pnds.ncols();
794 const Index nf = pha_mat_se[0][0].nvitrines();
795 const Index npDir = pha_mat_se[0][0].nbooks();
796 const Index niDir = pha_mat_se[0][0].npages();
797 const Index stokes_dim = pha_mat_se[0][0].ncols();
799 const Index nss = pha_mat_se.nelem();
806 for (Index i_ss = 0; i_ss < nss; i_ss++) {
809 pha_mat[i_ss].resize(nf, nT, npDir, niDir, stokes_dim, stokes_dim);
812 for (Index i_se = 0; i_se < pha_mat_se[i_ss].nelem(); i_se++) {
813 ARTS_ASSERT(nT == pha_mat_se[i_ss][i_se].nshelves());
815 for (Index Tind = 0; Tind < nT; Tind++) {
816 if (pnds(i_se_flat, Tind) != 0.) {
817 if (t_ok(i_se_flat, Tind) > 0.) {
819 pha_mat_se[i_ss][i_se](joker, Tind, joker, joker, joker, joker);
820 pha_tmp *= pnds(i_se_flat, Tind);
821 pha_mat[i_ss](joker, Tind, joker, joker, joker, joker) += pha_tmp;
824 "Interpolation error for (flat-array) scattering element #",
826 "at location/temperature point #", Tind,
"\n")
832 ptype[i_ss] =
max(ptypes_se[i_ss]);
868 ArrayOfArrayOfTensor6& pha_mat,
873 const Index& stokes_dim,
874 const Vector& T_array,
875 const Matrix& pdir_array,
876 const Matrix& idir_array,
877 const Index& f_index,
878 const Index& t_interp_order) {
881 nf = scat_data[0][0].pha_mat_data.nlibraries();
886 if (scat_data[0][0].pha_mat_data.nlibraries() == 1)
893 const Index nT = T_array.
nelem();
894 const Index npDir = pdir_array.nrows();
895 const Index niDir = idir_array.nrows();
897 const Index nss = scat_data.
nelem();
902 t_ok.resize(Nse_all, nT);
905 for (Index i_ss = 0; i_ss < nss; i_ss++) {
906 Index nse = scat_data[i_ss].
nelem();
907 pha_mat[i_ss].resize(nse);
908 ptypes[i_ss].resize(nse);
910 for (Index i_se = 0; i_se < nse; i_se++) {
911 pha_mat[i_ss][i_se].resize(nf, nT, npDir, niDir, stokes_dim, stokes_dim);
915 t_ok(i_se_flat, joker),
916 scat_data[i_ss][i_se],
958 const Vector& T_array,
959 const Matrix& pdir_array,
960 const Matrix& idir_array,
961 const Index& f_start,
962 const Index& t_interp_order) {
965 const Index nf = pha_mat.nvitrines();
970 const Index nTout = T_array.nelem();
974 const Index npDir = pdir_array.nrows();
977 const Index niDir = idir_array.nrows();
980 const Index stokes_dim = pha_mat.ncols();
988 const Index nTin = ssd.
T_grid.nelem();
989 Index this_T_interp_order;
1004 if (stokes_dim == 1)
1006 else if (stokes_dim < 4)
1010 if (this_T_interp_order < 0)
1014 for (Index pdir = 0; pdir < npDir; pdir++)
1015 for (Index idir = 0; idir < niDir; idir++) {
1017 Numeric theta =
scat_angle(pdir_array(pdir, 0),
1018 pdir_array(pdir, 1),
1019 idir_array(idir, 0),
1020 idir_array(idir, 1));
1028 Vector pha_mat_int(npha, 0.);
1029 Matrix pha_mat_tmp(stokes_dim, stokes_dim);
1030 for (Index find = 0; find < nf; find++) {
1032 for (Index nst = 0; nst < npha; nst++)
1033 pha_mat_int[nst] =
interp(
1035 ssd.
pha_mat_data(find + f_start, 0, joker, 0, 0, 0, nst),
1041 pdir_array(pdir, 0),
1042 pdir_array(pdir, 1),
1043 idir_array(idir, 0),
1044 idir_array(idir, 1),
1047 for (Index Tind = 0; Tind < nTout; Tind++)
1048 pha_mat(find, Tind, pdir, idir, joker, joker) = pha_mat_tmp;
1053 for (Index pdir = 0; pdir < npDir; pdir++)
1054 for (Index idir = 0; idir < niDir; idir++) {
1056 Numeric theta =
scat_angle(pdir_array(pdir, 0),
1057 pdir_array(pdir, 1),
1058 idir_array(idir, 0),
1059 idir_array(idir, 1));
1067 Matrix pha_mat_int(nTin, npha, 0.);
1068 Matrix pha_mat_tmp(nTout, npha, 0.);
1069 for (Index find = 0; find < nf; find++) {
1070 for (Index Tind = 0; Tind < nTin; Tind++)
1072 for (Index nst = 0; nst < npha; nst++) {
1073 pha_mat_int(Tind, nst) =
interp(
1075 ssd.
pha_mat_data(find + f_start, Tind, joker, 0, 0, 0, nst),
1079 for (Index nst = 0; nst < npha; nst++) {
1080 reinterp(pha_mat_tmp(joker, nst),
1081 pha_mat_int(joker, nst),
1090 for (Index Tind = 0; Tind < nTout; Tind++) {
1093 pha_mat_tmp(Tind, joker),
1094 pdir_array(pdir, 0),
1095 pdir_array(pdir, 1),
1096 idir_array(idir, 0),
1097 idir_array(idir, 1),
1107 Index nDir = npDir * niDir;
1108 Vector adelta_aa(nDir);
1109 Matrix delta_aa(npDir, niDir);
1117 for (Index pdir = 0; pdir < npDir; pdir++) {
1118 for (Index idir = 0; idir < niDir; idir++) {
1119 delta_aa(pdir, idir) =
1120 pdir_array(pdir, 1) - idir_array(idir, 1) +
1121 (pdir_array(pdir, 1) - idir_array(idir, 1) < -180) * 360 -
1122 (pdir_array(pdir, 1) - idir_array(idir, 1) > 180) * 360;
1123 adelta_aa[j] = abs(delta_aa(pdir, idir));
1124 pza_gp[j] = pza_gp_tmp[pdir];
1125 iza_gp[j] = iza_gp_tmp[idir];
1132 Matrix dir_itw(nDir, 8);
1135 if (this_T_interp_order < 0)
1137 Tensor3 pha_mat_int(nDir, stokes_dim, stokes_dim, 0.);
1138 Tensor4 pha_mat_tmp(npDir, niDir, stokes_dim, stokes_dim);
1140 for (Index find = 0; find < nf; find++) {
1144 for (Index ist1 = 0; ist1 < stokes_dim; ist1++)
1145 for (Index ist2 = 0; ist2 < stokes_dim; ist2++)
1147 pha_mat_int(joker, ist1, ist2),
1150 find + f_start, 0, joker, joker, joker, 0, ist1 * 4 + ist2),
1158 for (Index pdir = 0; pdir < npDir; pdir++)
1159 for (Index idir = 0; idir < niDir; idir++) {
1160 pha_mat_tmp(pdir, idir, joker, joker) =
1161 pha_mat_int(i, joker, joker);
1165 if (stokes_dim > 2) {
1166 for (Index pdir = 0; pdir < npDir; pdir++)
1167 for (Index idir = 0; idir < niDir; idir++)
1168 if (delta_aa(pdir, idir) < 0.) {
1169 pha_mat_tmp(pdir, idir, 0, 2) *= -1;
1170 pha_mat_tmp(pdir, idir, 1, 2) *= -1;
1171 pha_mat_tmp(pdir, idir, 2, 0) *= -1;
1172 pha_mat_tmp(pdir, idir, 2, 1) *= -1;
1176 if (stokes_dim > 3) {
1177 for (Index pdir = 0; pdir < npDir; pdir++)
1178 for (Index idir = 0; idir < niDir; idir++)
1179 if (delta_aa(pdir, idir) < 0.) {
1180 pha_mat_tmp(pdir, idir, 0, 3) *= -1;
1181 pha_mat_tmp(pdir, idir, 1, 3) *= -1;
1182 pha_mat_tmp(pdir, idir, 3, 0) *= -1;
1183 pha_mat_tmp(pdir, idir, 3, 1) *= -1;
1187 for (Index Tind = 0; Tind < nTout; Tind++)
1188 pha_mat(find, Tind, joker, joker, joker, joker) = pha_mat_tmp;
1195 Tensor4 pha_mat_int(nTin, nDir, stokes_dim, stokes_dim, 0.);
1197 for (Index find = 0; find < nf; find++) {
1200 for (Index Tind = 0; Tind < nTin; Tind++) {
1201 for (Index ist1 = 0; ist1 < stokes_dim; ist1++)
1202 for (Index ist2 = 0; ist2 < stokes_dim; ist2++)
1203 interp(pha_mat_int(Tind, joker, ist1, ist2),
1221 for (Index pdir = 0; pdir < npDir; pdir++)
1222 for (Index idir = 0; idir < niDir; idir++) {
1223 for (Index ist1 = 0; ist1 < stokes_dim; ist1++)
1224 for (Index ist2 = 0; ist2 < stokes_dim; ist2++)
1225 reinterp(pha_mat(find, joker, pdir, idir, ist1, ist2),
1226 pha_mat_int(joker, i, ist1, ist2),
1232 if (stokes_dim > 2) {
1233 for (Index pdir = 0; pdir < npDir; pdir++)
1234 for (Index idir = 0; idir < niDir; idir++)
1235 if (delta_aa(pdir, idir) < 0.) {
1236 pha_mat(find, joker, pdir, idir, 0, 2) *= -1;
1237 pha_mat(find, joker, pdir, idir, 1, 2) *= -1;
1238 pha_mat(find, joker, pdir, idir, 2, 0) *= -1;
1239 pha_mat(find, joker, pdir, idir, 2, 1) *= -1;
1243 if (stokes_dim > 3) {
1244 for (Index pdir = 0; pdir < npDir; pdir++)
1245 for (Index idir = 0; idir < niDir; idir++)
1246 if (delta_aa(pdir, idir) < 0.) {
1247 pha_mat(find, joker, pdir, idir, 0, 3) *= -1;
1248 pha_mat(find, joker, pdir, idir, 1, 3) *= -1;
1249 pha_mat(find, joker, pdir, idir, 3, 0) *= -1;
1250 pha_mat(find, joker, pdir, idir, 3, 1) *= -1;
1281 StokesVector& abs_vec_lab,
1283 ConstTensor3View abs_vec_data,
1284 ConstVectorView za_datagrid,
1285 ConstVectorView aa_datagrid
_U_,
1287 const Numeric& za_sca
_U_,
1288 const Numeric& aa_sca
_U_,
1290 const Index stokes_dim = abs_vec_lab.StokesDimensions();
1291 ARTS_ASSERT(abs_vec_lab.NumberOfFrequencies() == 1);
1294 "The dimension of the stokes vector \n"
1295 "must be 1,2,3 or 4");
1309 out0 <<
"Case PTYPE_GENERAL not yet implemented. \n";
1316 abs_vec_lab.SetZero();
1318 abs_vec_lab.Kjj()[0] = abs_vec_data(0, 0, 0);
1334 gridpos(gp, za_datagrid, za_sca);
1337 abs_vec_lab.SetZero();
1339 abs_vec_lab.Kjj()[0] =
interp(itw, abs_vec_data(Range(joker), 0, 0), gp);
1341 if (stokes_dim == 1) {
1344 abs_vec_lab.K12()[0] =
interp(itw, abs_vec_data(Range(joker), 0, 1), gp);
1349 out0 <<
"Not all ptype cases are implemented\n";
1377 PropagationMatrix& ext_mat_lab,
1379 ConstTensor3View ext_mat_data,
1380 ConstVectorView za_datagrid,
1381 ConstVectorView aa_datagrid
_U_,
1383 const Numeric& za_sca,
1384 const Numeric& aa_sca
_U_,
1386 const Index stokes_dim = ext_mat_lab.StokesDimensions();
1387 ARTS_ASSERT(ext_mat_lab.NumberOfFrequencies() == 1);
1390 "The dimension of the stokes vector \n"
1391 "must be 1,2,3 or 4");
1405 out0 <<
"Case PTYPE_GENERAL not yet implemented. \n";
1415 ext_mat_lab.SetZero();
1417 ext_mat_lab.Kjj() = ext_mat_data(0, 0, 0);
1436 gridpos(gp, za_datagrid, za_sca);
1439 ext_mat_lab.SetZero();
1441 Kjj =
interp(itw, ext_mat_data(Range(joker), 0, 0), gp);
1442 ext_mat_lab.Kjj() = Kjj;
1444 if (stokes_dim < 2) {
1448 K12 =
interp(itw, ext_mat_data(Range(joker), 0, 1), gp);
1449 ext_mat_lab.K12()[0] = K12;
1451 if (stokes_dim < 4) {
1455 K34 =
interp(itw, ext_mat_data(Range(joker), 0, 2), gp);
1456 ext_mat_lab.K34()[0] = K34;
1461 out0 <<
"Not all ptype cases are implemented\n";
1495 MatrixView pha_mat_lab,
1497 ConstTensor5View pha_mat_data,
1498 ConstVectorView za_datagrid,
1499 ConstVectorView aa_datagrid,
1501 const Index& za_sca_idx,
1502 const Index& aa_sca_idx,
1503 const Index& za_inc_idx,
1504 const Index& aa_inc_idx,
1505 ConstVectorView za_grid,
1506 ConstVectorView aa_grid,
1508 const Index stokes_dim = pha_mat_lab.ncols();
1510 Numeric za_sca = za_grid[za_sca_idx];
1511 Numeric aa_sca = aa_grid[aa_sca_idx];
1512 Numeric za_inc = za_grid[za_inc_idx];
1513 Numeric aa_inc = aa_grid[aa_inc_idx];
1516 "The dimension of the stokes vector \n"
1517 "must be 1,2,3 or 4");
1531 out0 <<
"Case PTYPE_GENERAL not yet implemented. \n";
1536 Numeric theta_rad =
scat_angle(za_sca, aa_sca, za_inc, aa_inc);
1537 const Numeric theta =
RAD2DEG * theta_rad;
1540 Vector pha_mat_int(6);
1545 pha_mat_lab, pha_mat_int, za_sca, aa_sca, za_inc, aa_inc, theta_rad);
1555 ARTS_ASSERT(pha_mat_data.npages() == za_datagrid.nelem());
1556 Numeric delta_aa = aa_sca - aa_inc + (aa_sca - aa_inc < -180) * 360 -
1557 (aa_sca - aa_inc > 180) *
1565 gridpos(delta_aa_gp, aa_datagrid, abs(delta_aa));
1566 gridpos(za_inc_gp, za_datagrid, za_inc);
1567 gridpos(za_sca_gp, za_datagrid, za_sca);
1573 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 0),
1577 if (stokes_dim == 1) {
1582 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 1),
1588 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 4),
1594 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 5),
1598 if (stokes_dim == 2) {
1601 if (delta_aa >= 0) {
1602 pha_mat_lab(0, 2) =
interp(
1604 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 2),
1608 pha_mat_lab(1, 2) =
interp(
1610 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 6),
1614 pha_mat_lab(2, 0) =
interp(
1616 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 8),
1620 pha_mat_lab(2, 1) =
interp(
1622 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 9),
1627 pha_mat_lab(0, 2) = -
interp(
1629 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 2),
1633 pha_mat_lab(1, 2) = -
interp(
1635 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 6),
1639 pha_mat_lab(2, 0) = -
interp(
1641 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 8),
1645 pha_mat_lab(2, 1) = -
interp(
1647 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 9),
1652 pha_mat_lab(2, 2) =
interp(
1654 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 10),
1658 if (stokes_dim == 3) {
1661 if (delta_aa >= 0) {
1662 pha_mat_lab(0, 3) =
interp(
1664 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 3),
1668 pha_mat_lab(1, 3) =
interp(
1670 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 7),
1674 pha_mat_lab(3, 0) =
interp(
1676 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 12),
1680 pha_mat_lab(3, 1) =
interp(
1682 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 13),
1687 pha_mat_lab(0, 3) = -
interp(
1689 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 3),
1693 pha_mat_lab(1, 3) = -
interp(
1695 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 7),
1699 pha_mat_lab(3, 0) = -
interp(
1701 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 12),
1705 pha_mat_lab(3, 1) = -
interp(
1707 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 13),
1712 pha_mat_lab(2, 3) =
interp(
1714 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 11),
1718 pha_mat_lab(3, 2) =
interp(
1720 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 14),
1724 pha_mat_lab(3, 3) =
interp(
1726 pha_mat_data(Range(joker), Range(joker), Range(joker), 0, 15),
1735 out0 <<
"Not all ptype cases are implemented\n";
1772 ConstVectorView abs_vec,
1773 const Index& stokes_dim) {
1780 for (Index is = 0; is < stokes_dim; is++) {
1781 ext_mat(is, is) += abs_vec[0];
1784 for (Index is = 1; is < stokes_dim; is++) {
1785 ext_mat(0, is) += abs_vec[is];
1786 ext_mat(is, 0) += abs_vec[is];
1805 const Numeric& aa_sca,
1806 const Numeric& za_inc,
1807 const Numeric& aa_inc) {
1809 Numeric ANG_TOL = 1e-7;
1818 if ((abs(aa_sca - aa_inc) < ANG_TOL) ||
1819 (abs(abs(aa_sca - aa_inc) - 360) < ANG_TOL)) {
1821 }
else if (abs(abs(aa_sca - aa_inc) - 180) < ANG_TOL) {
1823 if (theta_rad >
PI) {
1824 theta_rad = 2 *
PI - theta_rad;
1859 VectorView pha_mat_int,
1861 ConstTensor5View pha_mat_data,
1862 ConstVectorView za_datagrid,
1863 const Numeric theta) {
1865 gridpos(thet_gp, za_datagrid, theta);
1871 for (Index i = 0; i < 6; i++) {
1872 pha_mat_int[i] =
interp(itw, pha_mat_data(joker, 0, 0, 0, i), thet_gp);
1903 MatrixView pha_mat_lab,
1905 ConstVectorView pha_mat_int,
1906 const Numeric& za_sca,
1907 const Numeric& aa_sca,
1908 const Numeric& za_inc,
1909 const Numeric& aa_inc,
1910 const Numeric& theta_rad) {
1911 const Index stokes_dim = pha_mat_lab.ncols();
1914 "NaN value(s) detected in *pha_mat_labCalc* (0,0). Could the "
1915 "input data contain NaNs? Please check with *scat_dataCheck*. If "
1916 "input data are OK and you critically need the ongoing calculations, "
1917 "try to change the observation LOS slightly. If you can reproduce "
1918 "this error, please contact Patrick in order to help tracking down "
1919 "the reason to this problem. If you see this message occasionally "
1920 "when doing MC calculations, it should not be critical. This path "
1921 "sampling will be rejected and replaced with a new one.");
1924 pha_mat_lab(0, 0) =
F11;
1926 if (stokes_dim > 1) {
1932 const Numeric ANGTOL_RAD = 1e-6;
1940 if ((abs(theta_rad) < ANGTOL_RAD)
1943 (abs(aa_inc_rad - aa_sca_rad) < ANGTOL_RAD)
1945 || (abs(abs(aa_inc_rad - aa_sca_rad) -
Constant::pi) < ANGTOL_RAD)
1947 pha_mat_lab(0, 1) =
F12;
1948 pha_mat_lab(1, 0) =
F12;
1949 pha_mat_lab(1, 1) =
F22;
1951 if (stokes_dim > 2) {
1952 pha_mat_lab(0, 2) = 0;
1953 pha_mat_lab(1, 2) = 0;
1954 pha_mat_lab(2, 0) = 0;
1955 pha_mat_lab(2, 1) = 0;
1956 pha_mat_lab(2, 2) =
F33;
1958 if (stokes_dim > 3) {
1959 pha_mat_lab(0, 3) = 0;
1960 pha_mat_lab(1, 3) = 0;
1961 pha_mat_lab(2, 3) =
F34;
1962 pha_mat_lab(3, 0) = 0;
1963 pha_mat_lab(3, 1) = 0;
1964 pha_mat_lab(3, 2) = -
F34;
1965 pha_mat_lab(3, 3) =
F44;
1978 if (za_inc_rad < ANGTOL_RAD) {
1979 sigma1 = pi + aa_sca_rad - aa_inc_rad;
1981 }
else if (za_inc_rad > pi - ANGTOL_RAD) {
1982 sigma1 = aa_sca_rad - aa_inc_rad;
1984 }
else if (za_sca_rad < ANGTOL_RAD) {
1986 sigma2 = pi + aa_sca_rad - aa_inc_rad;
1987 }
else if (za_sca_rad > pi - ANGTOL_RAD) {
1989 sigma2 = aa_sca_rad - aa_inc_rad;
1991 s1 = (cos(za_sca_rad) - cos(za_inc_rad) * cos(theta_rad)) /
1992 (sin(za_inc_rad) * sin(theta_rad));
1993 s2 = (cos(za_inc_rad) - cos(za_sca_rad) * cos(theta_rad)) /
1994 (sin(za_sca_rad) * sin(theta_rad));
2002 if (std::isnan(sigma1) || std::isnan(sigma2)) {
2003 if (abs(s1 - 1) < ANGTOL_RAD) sigma1 = 0;
2004 if (abs(s1 + 1) < ANGTOL_RAD) sigma1 = pi;
2005 if (abs(s2 - 1) < ANGTOL_RAD) sigma2 = 0;
2006 if (abs(s2 + 1) < ANGTOL_RAD) sigma2 = pi;
2010 const Numeric C1 = cos(2 * sigma1);
2011 const Numeric C2 = cos(2 * sigma2);
2013 const Numeric S1 = sin(2 * sigma1);
2014 const Numeric S2 = sin(2 * sigma2);
2016 pha_mat_lab(0, 1) = C1 *
F12;
2017 pha_mat_lab(1, 0) = C2 *
F12;
2018 pha_mat_lab(1, 1) = C1 * C2 *
F22 - S1 * S2 *
F33;
2023 ARTS_USER_ERROR_IF (std::isnan(pha_mat_lab(0, 1)) || std::isnan(pha_mat_lab(1, 0)) ||
2024 std::isnan(pha_mat_lab(1, 1)),
2025 "NaN value(s) detected in *pha_mat_labCalc* (0/1,1). Could the "
2026 "input data contain NaNs? Please check with *scat_dataCheck*. If "
2027 "input data are OK and you critically need the ongoing calculations, "
2028 "try to change the observation LOS slightly. If you can reproduce "
2029 "this error, please contact Patrick in order to help tracking down "
2030 "the reason to this problem. If you see this message occasionally "
2031 "when doing MC calculations, it should not be critical. This path "
2032 "sampling will be rejected and replaced with a new one.");
2034 if (stokes_dim > 2) {
2044 Numeric delta_aa = aa_sca - aa_inc + (aa_sca - aa_inc < -180) * 360 -
2045 (aa_sca - aa_inc > 180) * 360;
2046 if (delta_aa >= 0) {
2047 pha_mat_lab(0, 2) = S1 *
F12;
2048 pha_mat_lab(1, 2) = S1 * C2 *
F22 + C1 * S2 *
F33;
2049 pha_mat_lab(2, 0) = -S2 *
F12;
2050 pha_mat_lab(2, 1) = -C1 * S2 *
F22 - S1 * C2 *
F33;
2052 pha_mat_lab(0, 2) = -S1 *
F12;
2053 pha_mat_lab(1, 2) = -S1 * C2 *
F22 - C1 * S2 *
F33;
2054 pha_mat_lab(2, 0) = S2 *
F12;
2055 pha_mat_lab(2, 1) = C1 * S2 *
F22 + S1 * C2 *
F33;
2057 pha_mat_lab(2, 2) = -S1 * S2 *
F22 + C1 * C2 *
F33;
2059 if (stokes_dim > 3) {
2060 if (delta_aa >= 0) {
2061 pha_mat_lab(1, 3) = S2 *
F34;
2062 pha_mat_lab(3, 1) = S1 *
F34;
2064 pha_mat_lab(1, 3) = -S2 *
F34;
2065 pha_mat_lab(3, 1) = -S1 *
F34;
2067 pha_mat_lab(0, 3) = 0;
2068 pha_mat_lab(2, 3) = C2 *
F34;
2069 pha_mat_lab(3, 0) = 0;
2070 pha_mat_lab(3, 2) = -C1 *
F34;
2071 pha_mat_lab(3, 3) =
F44;
2079 os <<
"SingleScatteringData: Output operator not implemented";
2084 os <<
"ScatteringMetaData: Output operator not implemented";
2105 PropagationMatrix& ext_mat,
2106 StokesVector& abs_vec,
2108 const PropagationMatrix& propmat_clearsky) {
2109 const Index stokes_dim = propmat_clearsky.StokesDimensions();
2110 const Index freq_dim = propmat_clearsky.NumberOfFrequencies();
2113 abs_vec = StokesVector(freq_dim, stokes_dim);
2116 ext_mat = PropagationMatrix(freq_dim, stokes_dim);
2120 abs_vec += propmat_clearsky;
2121 ext_mat += propmat_clearsky;
2137 if (ptype_string ==
"general")
2139 else if (ptype_string ==
"totally_random")
2141 else if (ptype_string ==
"azimuthally_random")
2145 "Unknown ptype: ", ptype_string,
"\n"
2146 "Valid types are: general, totally_random and "
2147 "azimuthally_random.")
2166 if (ptype_string ==
"general")
2168 else if (ptype_string ==
"macroscopically_isotropic")
2170 else if (ptype_string ==
"horizontally_aligned")
2174 "Unknown ptype: ", ptype_string,
"\n"
2175 "Valid types are: general, macroscopically_isotropic and "
2176 "horizontally_aligned.")
2196 ptype_string =
"general";
2199 ptype_string =
"totally_random";
2202 ptype_string =
"azimuthally_random";
2206 "Internal error: Cannot map PType enum value ",
2207 ptype,
" to String.")
2211 return ptype_string;
2225 Index nza = ssd.
za_grid.nelem();
2226 for (Index i = 0; i < nza / 2; i++) {
2228 180. - ssd.
za_grid[nza - 1 - i], ssd.
za_grid[i], 2 * DBL_EPSILON),
2229 "Zenith grid of azimuthally_random single scattering data\n"
2230 "is not symmetric with respect to 90degree.")
2233 "Zenith grid of azimuthally_random single scattering data\n"
2234 "does not contain 90 degree grid point.")
2237 ostringstream os_pha_mat;
2238 os_pha_mat <<
"pha_mat ";
2239 ostringstream os_ext_mat;
2240 os_ext_mat <<
"ext_mat ";
2241 ostringstream os_abs_vec;
2242 os_abs_vec <<
"abs_vec ";
2277 ssd.
abs_vec_data(joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT5;
2278 for (Index i = 0; i < nza / 2; i++) {
2279 ssd.
abs_vec_data(joker, joker, nza - 1 - i, joker, joker) =
2280 tmpT5(joker, joker, i, joker, joker);
2289 ssd.
ext_mat_data(joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT5;
2290 for (Index i = 0; i < nza / 2; i++) {
2291 ssd.
ext_mat_data(joker, joker, nza - 1 - i, joker, joker) =
2292 tmpT5(joker, joker, i, joker, joker);
2304 joker, joker, joker, joker, Range(0, nza / 2 + 1), joker, joker) = tmpT7;
2308 tmpT7(joker, joker, joker, joker, joker, joker, Range(2, 2)) *= -1.;
2309 tmpT7(joker, joker, joker, joker, joker, joker, Range(6, 4)) *= -1.;
2310 tmpT7(joker, joker, joker, joker, joker, joker, Range(12, 2)) *= -1.;
2314 for (Index i = 0; i < nza / 2; i++)
2315 for (Index j = 0; j < nza; j++)
2317 joker, joker, nza - 1 - j, joker, nza - 1 - i, joker, joker) =
2318 tmpT7(joker, joker, j, joker, i, joker, joker);
2331 const String& particle_ssdmethod_string) {
2333 if (particle_ssdmethod_string ==
"tmatrix")
2337 "Unknown particle SSD method: ",
2338 particle_ssdmethod_string,
"\n"
2339 "Valid methods: tmatrix")
2342 return particle_ssdmethod;
2355 String particle_ssdmethod_string;
2357 switch (particle_ssdmethod) {
2359 particle_ssdmethod_string =
"tmatrix";
2363 "Internal error: Cannot map ParticleSSDMethod enum value ",
2364 particle_ssdmethod,
" to String.")
2368 return particle_ssdmethod_string;
2401 MatrixView abs_data,
2402 Tensor3View pfun_data,
2405 ConstMatrixView pnd_data,
2407 ConstVectorView T_grid,
2408 ConstVectorView sa_grid)
2411 const Index nse = scat_data.
nelem();
2412 const Index nf = scat_data[0].f_grid.
nelem();
2413 [[maybe_unused]]
const Index nt = T_grid.nelem();
2414 const Index nsa = sa_grid.nelem();
2415 const Index ncl = cloudbox_limits[1] - cloudbox_limits[0] + 1;
2430 bool all_totrand =
true;
2431 for (Index ie = 0; ie < nse; ie++) {
2433 all_totrand =
false;
2436 "This method demands that all scat_data are TRO");
2440 const Index cl_start = cloudbox_limits[0];
2441 Vector T_values(ncl);
2445 for (Index ie = 0; ie < nse; ie++) {
2447 const Index
last = scat_data[ie].T_grid.
nelem() - 1;
2448 const Numeric tmin = 1.5*scat_data[ie].T_grid[0] -
2449 0.5*scat_data[ie].T_grid[1];
2450 const Numeric tmax = 1.5*scat_data[ie].T_grid[
last] -
2451 0.5*scat_data[ie].T_grid[
last-1];
2454 for(Index icl=0; icl<ncl; ++icl){
2456 if (abs(pnd_data(ie,icl)) > 1e-3) {
2457 const Numeric Tthis = T_grid[cl_start + icl];
2459 "Temperature interpolation error for scattering element ", ie,
2460 " of species ", iss,
"\nYour temperature: ", Tthis,
" K\n"
2461 "Allowed range of temperatures: ", tmin,
" - ", tmax,
" K");
2462 T_values[nvals] = Tthis;
2463 cboxlayer[nvals] = icl;
2471 gridpos(gp_t, scat_data[ie].T_grid, T_values[Range(0,nvals)]);
2472 Matrix itw1(nvals, 2);
2477 gridpos(gp_sa, scat_data[ie].za_grid, sa_grid);
2478 Tensor3 itw2(nvals, nsa, 4);
2482 for (Index iv = 0; iv < nf; iv++) {
2484 Vector ext1(nvals), abs1(nvals);
2485 Matrix pfu1(nvals,nsa);
2486 interp(ext1, itw1, scat_data[ie].ext_mat_data(iv,joker,0,0,0), gp_t);
2487 interp(abs1, itw1, scat_data[ie].abs_vec_data(iv,joker,0,0,0), gp_t);
2488 interp(pfu1, itw2, scat_data[ie].pha_mat_data(iv,joker,joker,0,0,0,0),
2492 for (Index i = 0; i < nvals; i++) {
2493 const Index ic = cboxlayer[i];
2494 const Index it = cl_start + ic;
2495 ext_data(iv,it) += pnd_data(ie,ic) * ext1[i];
2496 abs_data(iv,it) += pnd_data(ie,ic) * abs1[i];
2497 for (Index ia = 0; ia < nsa; ia++) {
2498 pfun_data(iv,it,ia) += pnd_data(ie,ic) * pfu1(i,ia);
This file contains the definition of Array.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
The global header file for ARTS.
Index nelem() const ARTS_NOEXCEPT
#define ARTS_ASSERT(condition,...)
#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.
Header file for interpolation.cc.
Numeric last(ConstVectorView x)
last
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 two_pi
Two times pi.
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
auto sind(auto x) noexcept
Returns the sine of the deg2rad of the input.
constexpr auto rad2deg(auto x) noexcept
Converts radians to degrees.
auto cosd(auto x) noexcept
Returns the cosine of the deg2rad of the input.
PType PType2FromString(const String &ptype_string)
Convert ptype name to enum value.
void ext_mat_SSD2Stokes(MatrixView ext_mat_stokes, ConstVectorView ext_mat_ssd, const Index &stokes_dim, const Index &ptype)
Extinction matrix scat_data to stokes format conversion.
void opt_prop_ScatSpecBulk(ArrayOfTensor5 &ext_mat, ArrayOfTensor4 &abs_vec, ArrayOfIndex &ptype, const ArrayOfArrayOfTensor5 &ext_mat_se, const ArrayOfArrayOfTensor4 &abs_vec_se, const ArrayOfArrayOfIndex &ptypes_se, ConstMatrixView pnds, ConstMatrixView t_ok)
Scattering species bulk extinction and absorption.
constexpr Numeric DEG2RAD
void ext_matFromabs_vec(MatrixView ext_mat, ConstVectorView abs_vec, const Index &stokes_dim)
Derive extinction matrix from absorption vector.
void opt_prop_sum_propmat_clearsky(PropagationMatrix &ext_mat, StokesVector &abs_vec, const PropagationMatrix &propmat_clearsky)
Get optical properties from propmat_clearsky.
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.
Numeric scat_angle(const Numeric &za_sca, const Numeric &aa_sca, const Numeric &za_inc, const Numeric &aa_inc)
Calculates the scattering angle.
ostream & operator<<(ostream &os, const SingleScatteringData &)
void pha_mat_labCalc(MatrixView pha_mat_lab, ConstVectorView pha_mat_int, const Numeric &za_sca, const Numeric &aa_sca, const Numeric &za_inc, const Numeric &aa_inc, const Numeric &theta_rad)
Calculate phase matrix in laboratory coordinate system.
void abs_vecTransform(StokesVector &abs_vec_lab, ConstTensor3View abs_vec_data, ConstVectorView za_datagrid, ConstVectorView aa_datagrid, const PType &ptype, const Numeric &za_sca, const Numeric &aa_sca, const Verbosity &verbosity)
Transformation of absorption vector.
ArrayOfLagrangeInterpolation ssd_tinterp_parameters(VectorView t_ok, Index &this_T_interp_order, ConstVectorView T_grid, const Vector &T_array, const Index &t_interp_order)
Determine T-interpol parameters for a specific scattering element.
constexpr Numeric RAD2DEG
PType PTypeFromString(const String &ptype_string)
Convert ptype name to enum value.
void pha_mat_ScatSpecBulk(ArrayOfTensor6 &pha_mat, ArrayOfIndex &ptype, const ArrayOfArrayOfTensor6 &pha_mat_se, const ArrayOfArrayOfIndex &ptypes_se, ConstMatrixView pnds, ConstMatrixView t_ok)
Scattering species bulk phase matrices.
void pha_mat_Bulk(Tensor6 &pha_mat, Index &ptype, const ArrayOfTensor6 &pha_mat_ss, const ArrayOfIndex &ptypes_ss)
Scattering species bulk phase matrix.
void ext_matTransform(PropagationMatrix &ext_mat_lab, ConstTensor3View ext_mat_data, ConstVectorView za_datagrid, ConstVectorView aa_datagrid, const PType &ptype, const Numeric &za_sca, const Numeric &aa_sca, const Verbosity &verbosity)
Transformation of extinction matrix.
void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData &ssd)
Convert azimuthally-random oriented SingleScatteringData to latest version.
void abs_vec_SSD2Stokes(VectorView abs_vec_stokes, ConstVectorView abs_vec_ssd, const Index &stokes_dim, const Index &ptype)
Absorption vector scat_data to stokes format conversion.
void opt_prop_Bulk(Tensor5 &ext_mat, Tensor4 &abs_vec, Index &ptype, const ArrayOfTensor5 &ext_mat_ss, const ArrayOfTensor4 &abs_vec_ss, const ArrayOfIndex &ptypes_ss)
one-line descript
ParticleSSDMethod ParticleSSDMethodFromString(const String &particle_ssdmethod_string)
Convert particle ssd method name to enum value.
void opt_prop_NScatElems(ArrayOfArrayOfTensor5 &ext_mat, ArrayOfArrayOfTensor4 &abs_vec, ArrayOfArrayOfIndex &ptypes, Matrix &t_ok, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &stokes_dim, const Vector &T_array, const Matrix &dir_array, const Index &f_index, const Index &t_interp_order)
Extinction and absorption from all scattering elements.
void pha_mat_NScatElems(ArrayOfArrayOfTensor6 &pha_mat, ArrayOfArrayOfIndex &ptypes, Matrix &t_ok, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &stokes_dim, const Vector &T_array, const Matrix &pdir_array, const Matrix &idir_array, const Index &f_index, const Index &t_interp_order)
Phase matrices from all scattering elements.
void interpolate_scat_angle(VectorView pha_mat_int, ConstTensor5View pha_mat_data, ConstVectorView za_datagrid, const Numeric theta)
Interpolate data on the scattering angle.
void opt_prop_1ScatElem(Tensor5View ext_mat, Tensor4View abs_vec, Index &ptype, VectorView t_ok, const SingleScatteringData &ssd, const Vector &T_array, const Matrix &dir_array, const Index &f_start, const Index &t_interp_order)
Preparing extinction and absorption from one scattering element.
void pha_matTransform(MatrixView pha_mat_lab, ConstTensor5View pha_mat_data, ConstVectorView za_datagrid, ConstVectorView aa_datagrid, const PType &ptype, const Index &za_sca_idx, const Index &aa_sca_idx, const Index &za_inc_idx, const Index &aa_inc_idx, ConstVectorView za_grid, ConstVectorView aa_grid, const Verbosity &verbosity)
Transformation of phase matrix.
String PTypeToString(const PType &ptype)
Convert particle type enum value to String.
void ext_abs_pfun_from_tro(MatrixView ext_data, MatrixView abs_data, Tensor3View pfun_data, const ArrayOfSingleScatteringData &scat_data, const Index &iss, ConstMatrixView pnd_data, ArrayOfIndex &cloudbox_limits, ConstVectorView T_grid, ConstVectorView sa_grid)
Extinction, absorption and phase function for one scattering species, 1D and TRO.
Scattering database structure and functions.
PType
An attribute to classify the particle type (ptype) of a SingleScatteringData.
ParticleSSDMethod
An attribute to classify the method to be used for SingleScatteringData.
@ PARTICLE_SSDMETHOD_TMATRIX
Structure to store a grid position.
This file contains basic functions to handle XML data files.