60 if (ref_los.
nelem() != 2)
61 throw runtime_error(
"*ref_los* must have two columns.");
62 if (dlos.
ncols() != 2)
throw runtime_error(
"*dlos* must have two columns.");
83 if (ref_los.
nelem() != 2)
84 throw runtime_error(
"*ref_los* must have two columns.");
85 if (other_los.
ncols() != 2)
86 throw runtime_error(
"*other_los* must have two columns.");
115 out2 <<
" Sets geo-position to:\n" << geo_pos;
132 if (ppath.
pos(
i, 0) < geo_pos[0]) {
141 out2 <<
" Sets geo-position to:\n" << geo_pos;
156 if (ppath.
pos(0, 0) >= z_ref) {
160 while (!found && ihit < ppath.
np - 1) {
162 if (above && ppath.
pos(ihit, 0) < z_ref) {
164 }
else if (!above && ppath.
pos(ihit, 0) >= z_ref) {
173 const Numeric w = (z_ref - ppath.
pos(ihit - 1, 0)) /
174 (ppath.
pos(ihit, 0) - ppath.
pos(ihit - 1, 0));
176 geo_pos[3] = w * ppath.
los(ihit, 0) + (1 -
w) * ppath.
los(ihit - 1, 0);
179 geo_pos[1] = w * ppath.
pos(ihit, 1) + (1 -
w) * ppath.
pos(ihit - 1, 1);
182 geo_pos[2] = w * ppath.
pos(ihit, 2) + (1 -
w) * ppath.
pos(ihit - 1, 2);
183 geo_pos[4] = w * ppath.
los(ihit, 1) + (1 -
w) * ppath.
los(ihit - 1, 1);
189 out2 <<
" Sets geo-position to:\n" << geo_pos;
195 const Agenda& ppath_agenda,
197 const Numeric& ppath_lraytrace,
198 const Index& atmgeom_checked,
200 const Index& cloudbox_on,
201 const Index& cloudbox_checked,
202 const Index& ppath_inside_cloudbox_do,
209 if (atmgeom_checked != 1)
211 "The atmospheric geometry must be flagged to have " 212 "passed a consistency check (atmgeom_checked=1).");
213 if (cloudbox_checked != 1)
215 "The cloudbox must be flagged to have " 216 "passed a consistency check (cloudbox_checked=1).");
226 ppath_inside_cloudbox_do,
234 const Agenda& ppath_agenda,
236 const Numeric& ppath_lraytrace,
237 const Index& atmgeom_checked,
239 const Index& cloudbox_on,
240 const Index& cloudbox_checked,
241 const Index& ppath_inside_cloudbox_do,
257 ppath_inside_cloudbox_do,
278 ppath_inside_cloudbox_do,
285 if (
std::abs(ppath.
pos(pos, 0) - altitude) < accuracy) {
295 ppath_inside_cloudbox_do,
310 const Agenda& ppath_step_agenda,
311 const Index& atmosphere_dim,
317 const Vector& refellipsoid,
327 if (atmosphere_dim == 2)
329 "2D atmospheres not yet handled. Support for negative" 330 " zenith angles needed. Remind me (Patrick) to fix this.");
346 pos2refell_r(atmosphere_dim, refellipsoid, lat_grid, lon_grid, rte_pos) +
349 pos2refell_r(atmosphere_dim, refellipsoid, lat_grid, lon_grid, rte_pos2) +
355 if (atmosphere_dim <= 2) {
356 if (atmosphere_dim == 2) {
362 distance3D(l12, r1, rte_pos[1], rte_pos[2], r2, rte_pos2[1], rte_pos2[2]);
363 sph2cart(
x1, y1, z1, r1, rte_pos[1], rte_pos[2]);
386 const Index maxiter = 99;
387 Vector t_za(maxiter, -999), t_dza(maxiter, -999);
424 while (lip >= l12 && ip > 0) {
426 if (atmosphere_dim <= 2) {
447 za_new = rte_los[0] - 1;
448 za_upp_limit = rte_los[0];
457 if (atmosphere_dim <= 2) {
460 xip, zip, dxip, dzip, ppt.
r[ip], ppt.
pos(ip, 1), ppt.
los(ip, 0));
469 atmosphere_dim, refellipsoid, lat_grid, lon_grid, posc);
487 xc, yc, zc, xip, yip, zip, dxip, dyip, dzip,
x1, y1, z1, l12);
502 atmosphere_dim, refellipsoid, lat_grid, lon_grid, posc);
514 dza = los[0] - rte_los_geom[0];
518 t_za[it] = rte_los[0];
521 if (dza > 0 && rte_los[0] < za_upp_limit) {
522 za_upp_limit = rte_los[0];
523 }
else if (dza < 0 && rte_los[0] > za_low_limit) {
524 za_low_limit = rte_los[0];
528 if (
abs(dza) <= za_accuracy) {
530 }
else if (za_upp_limit - za_low_limit <= za_accuracy / 10) {
531 if (
max(t_dza) < -10 * za_accuracy) {
533 out3 <<
" Ground intersection determined !!!\n";
537 out3 <<
" Zenith angle search range closed !!!\n";
544 if (ntries >= maxiter) {
546 out3 <<
" Too many iterations !!!\n";
552 za_new = rte_los[0] - dza;
557 const Index i0 = it - nfit + 1;
560 za_new = -p[0] / p[1];
563 if (atmosphere_dim == 3) {
564 daa = los[1] - rte_los_geom[1];
571 if (std::isinf(za_new) || std::isnan(za_new) ||
572 abs(za_new - rte_los[0]) < 0.99 * za_accuracy ||
573 za_new <= za_low_limit || za_new >= za_upp_limit) {
574 rte_los[0] = (za_low_limit + za_upp_limit) / 2;
577 if (atmosphere_dim == 3) {
579 if (rte_los[1] < -180) {
581 }
else if (rte_los[1] > 180) {
592 ppath_lraytrace /= pplrt_factor;
594 if (ppath_lraytrace >= pplrt_lowest) {
595 out2 <<
" Re-start with ppath_lraytrace = " << ppath_lraytrace;
636 if (atmosphere_dim <= 2) {
640 ll, rc, posc[1], posc[2], ppt.
r[ip], ppt.
pos(ip, 1), ppt.
pos(ip, 2));
645 if (ip == ppt.
np - 1) {
651 if (atmosphere_dim <= 2) {
691 if (atmosphere_dim <= 2) {
730 assert(ll < ppt.
lstep[i - 1]);
745 ppath.
pos(i,
Range(0, atmosphere_dim)));
746 if (atmosphere_dim >= 2) {
748 if (atmosphere_dim == 3) {
762 const Index& atmosphere_dim,
765 const Index& cloudbox_on,
767 const Index& ppath_inside_cloudbox_do,
777 const Numeric z_sensor = rte_pos[0];
778 const Numeric za_sensor = rte_los[0];
780 const Numeric z_toa = z_field(nz - 1, 0, 0);
781 const bool above_toa = z_sensor > z_toa ? true :
false;
782 const Numeric z_end = above_toa ? z_toa : z_sensor;
784 Index background = -99;
787 if (atmosphere_dim != 1)
788 throw runtime_error(
"The function can only be used for 1D atmospheres.");
791 if (ppath_inside_cloudbox_do && !cloudbox_on)
793 "The WSV *ppath_inside_cloudbox_do* can only be set " 794 "to 1 if also *cloudbox_on* is 1.");
795 if (z_sensor < z_surface(0, 0)) {
797 os <<
"The sensor is below the surface." 798 <<
" altitude of sensor : " << z_sensor << endl
799 <<
" altitude of surface : " << z_surface(0, 0);
800 throw runtime_error(os.
str());
802 if (
abs(za_sensor - 90) < 0.1) {
804 os <<
"The zenith angle is " << za_sensor << endl
805 <<
"The method does not allow this. The zenith angle must deviate\n" 806 <<
"from 90 deg with at least 1 deg. That is, to be outside [89.9,90.1].";
807 throw runtime_error(os.
str());
817 for (
Index i = 0;
i < nz - 1;
i++) {
818 if (z_sensor < z_field(
i + 1, 0, 0)) {
820 gp_end.fd[0] = (z_sensor - z_field(
i, 0, 0)) /
821 (z_field(
i + 1, 0, 0) - z_field(
i, 0, 0));
822 gp_end.fd[1] = 1 - gp_end.fd[0];
829 bool path_to_follow =
true;
830 if (above_toa && za_sensor < 90) {
834 path_to_follow =
false;
835 }
else if (z_sensor == z_surface(0, 0) && za_sensor > 90) {
839 path_to_follow =
false;
840 }
else if (cloudbox_on) {
841 if (!ppath_inside_cloudbox_do &&
842 z_sensor > z_field(cloudbox_limits[0], 0, 0) &&
843 z_sensor < z_field(cloudbox_limits[1], 0, 0)) {
847 path_to_follow =
false;
848 }
else if ((z_sensor == z_field(cloudbox_limits[0], 0, 0) &&
850 (z_sensor == z_field(cloudbox_limits[1], 0, 0) &&
855 path_to_follow =
false;
856 }
else if (above_toa && cloudbox_limits[1] == nz - 1) {
860 path_to_follow =
false;
865 if (path_to_follow) {
866 const Numeric max_dz = ppath_lmax > 0 ? ppath_lmax / dz2dl : 9e99;
892 l_idx[0] = gp_end.idx;
893 l_fd0[0][0] = gp_end.fd[0];
896 for (
Index i = gp_end.idx;
i >= 0 && background < 0;
i--) {
899 if (z_field(
i, 0, 0) > z_surface(0, 0)) {
900 dz_step = z - z_field(
i, 0, 0);
902 dz_step = z - z_surface(0, 0);
907 dz_step <= max_dz ? 1 :
Index(ceil(dz_step / max_dz));
909 const Numeric dz_layer = z_field(
i + 1, 0, 0) - z_field(
i, 0, 0);
914 l_fd0[iout].resize(np);
915 l_z[iout].resize(np);
918 for (
Index j = 0; j < np - 1; j++) {
919 l_z[iout][j] = z - (
Numeric(j) + 1) * dz;
920 l_fd0[iout][j] = (l_z[iout][j] - z_field(
i, 0, 0)) / dz_layer;
927 l_z[iout][np - 1] = z_surface(0, 0);
928 l_fd0[iout][np - 1] =
929 (l_z[iout][np - 1] - z_field(
i, 0, 0)) / dz_layer;
931 l_z[iout][np - 1] = z_field(
i, 0, 0);
932 l_fd0[iout][np - 1] = 0;
935 (
i == cloudbox_limits[1] ||
i == cloudbox_limits[0])) {
941 z = z_field(
i, 0, 0);
947 for (
Index i = gp_end.idx;
i < nz && background < 0;
i++) {
950 if (cloudbox_on &&
i != gp_end.idx &&
951 (
i == cloudbox_limits[0] ||
952 i == cloudbox_limits[1])) {
956 }
else if (
i == nz - 1) {
961 dz_step = z_field(
i + 1, 0, 0) - z;
962 dz_layer = z_field(
i + 1, 0, 0) - z_field(
i, 0, 0);
966 dz_step <= max_dz ? 1 :
Index(ceil(dz_step / max_dz));
972 l_fd0[iout].resize(np);
973 l_z[iout].resize(np);
976 if (
i == gp_end.idx) {
978 l_z[iout][0] = z_sensor;
979 l_fd0[iout][0] = gp_end.fd[0];
980 }
else if (
i == nz - 1) {
982 l_z[iout][0] = z_field(
i, 0, 0);
986 l_z[iout][0] = z_field(
i, 0, 0);
991 for (
Index j = 1; j < np; j++) {
992 l_z[iout][j] = z +
Numeric(j) * dz;
993 l_fd0[iout][j] = (l_z[iout][j] - z_field(
i, 0, 0)) / dz_layer;
997 if (background < 0) {
998 z = z_field(
i + 1, 0, 0);
1012 ppath.
pos(iout, 0) = l_z[
i][j];
1013 ppath.
gp_p[iout].idx = l_idx[
i];
1014 ppath.
gp_p[iout].fd[0] = l_fd0[
i][j];
1015 ppath.
gp_p[iout].fd[1] = 1 - l_fd0[
i][j];
1017 z_last = ppath.
pos(iout, 0);
1019 ppath.
lstep[iout - 1] = dz2dl *
abs(z_last - l_z[
i][j]);
1028 if (ppath.
np == 1) {
1029 ppath.
pos(0, 0) = z_end;
1030 ppath.
gp_p[0] = gp_end;
1043 ppath.
end_lstep = dz2dl * (z_sensor - z_toa);
1052 const Agenda& ppath_step_agenda,
1053 const Index& ppath_inside_cloudbox_do,
1054 const Index& atmosphere_dim,
1060 const Vector& refellipsoid,
1062 const Index& cloudbox_on,
1067 const Numeric& ppath_lraytrace,
1086 ppath_inside_cloudbox_do,
1092 const String& file_format,
1096 const Index& file_index,
1099 Ppath ppath_partial = ppath;
1103 ppath_partial.
gp_p = empty_gp;
1104 ppath_partial.
gp_lat = empty_gp;
1105 ppath_partial.
gp_lon = empty_gp;
1109 if (file_index >= 0) {
1114 WriteXML(file_format, ppath_partial, filename, 0,
"ppath",
"",
"", verbosity);
1122 const Agenda& ppath_agenda,
1124 const Numeric& ppath_lraytrace,
1125 const Index& atmgeom_checked,
1128 const Index& cloudbox_on,
1129 const Index& cloudbox_checked,
1130 const Index& ppath_inside_cloudbox_do,
1134 const Vector& refellipsoid,
1135 const Index& atmosphere_dim,
1136 const Index& zenith_angles_per_position,
1138 if (atmosphere_dim not_eq 1)
1139 throw std::runtime_error(
"Only for 1D atmospheres");
1140 if (refellipsoid[1] not_eq 0.0)
1141 throw std::runtime_error(
"Not allowed for non-spherical planets");
1142 if (ppath_lmax >= 0)
1143 throw std::runtime_error(
"Only allowed for long paths (ppath_lmax < 0)");
1146 const Numeric zmin = z_field(0, 0, 0);
1149 const Numeric above_surface_tangent =
1150 90 -
RAD2DEG * std::acos((r) / (r + zmax)) + 1e-4;
1151 const Numeric below_surface_tangent =
1152 90 -
RAD2DEG * std::acos((r) / (r + zmax)) - 1e-4;
1153 const Numeric top_tangent = 90 - 1e-4;
1155 ppath_field.resize(3 * zenith_angles_per_position);
1156 Index ppath_field_pos = 0;
1158 Vector zenith_angles(zenith_angles_per_position);
1161 nlinspace(zenith_angles, 0, 90, zenith_angles_per_position);
1162 Vector rte_pos_true = rte_pos;
1163 rte_pos_true[0] = zmin;
1164 Vector rte_los_true = rte_los;
1165 for (
Index iz = 0; iz < zenith_angles_per_position; iz++) {
1166 rte_los_true[0] = zenith_angles[iz];
1169 ppath_field[ppath_field_pos],
1177 ppath_inside_cloudbox_do,
1188 above_surface_tangent,
1190 zenith_angles_per_position);
1191 rte_pos_true[0] = zmax;
1192 for (
Index iz = 0; iz < zenith_angles_per_position; iz++) {
1193 rte_los_true[0] = 180 - zenith_angles[iz];
1196 ppath_field[ppath_field_pos],
1204 ppath_inside_cloudbox_do,
1215 zenith_angles, 0, below_surface_tangent, zenith_angles_per_position);
1216 for (
Index iz = 0; iz < zenith_angles_per_position; iz++) {
1217 rte_los_true[0] = 180 - zenith_angles[iz];
1220 ppath_field[ppath_field_pos],
1228 ppath_inside_cloudbox_do,
1241 const Agenda& ppath_agenda,
1243 const Numeric& ppath_lraytrace,
1244 const Index& atmgeom_checked,
1246 const Index& cloudbox_on,
1247 const Index& cloudbox_checked,
1248 const Index& ppath_inside_cloudbox_do,
1249 const Matrix& sensor_pos,
1250 const Matrix& sensor_los,
1253 auto n = sensor_pos.
nrows();
1254 ppath_field.resize(
n);
1256 if (sensor_los.
nrows() not_eq
n)
1257 throw std::runtime_error(
1258 "Your sensor position matrix and sensor line of sight matrix do not match in size.\n");
1260 for (
auto i = 0;
i <
n;
i++)
1270 ppath_inside_cloudbox_do,
1271 sensor_pos(i,
joker),
1272 sensor_los(i,
joker),
1281 const Index& atmosphere_dim,
1285 const Vector& refellipsoid,
1296 if (atmosphere_dim == 1) {
1298 z_field(
joker, 0, 0),
1304 else if (atmosphere_dim == 2) {
1309 z_surface(
joker, 0),
1313 else if (atmosphere_dim == 3) {
1324 throw runtime_error(
"The atmospheric dimensionality must be 1-3.");
1329 assert(ppath_step.
np == 1);
1330 ppath_step.
nreal[0] = 1;
1331 ppath_step.
ngroup[0] = 1;
1338 const Agenda& refr_index_air_agenda,
1339 const Index& atmosphere_dim,
1346 const Vector& refellipsoid,
1350 const Numeric& ppath_lraytrace,
1354 assert(ppath_lraytrace > 0);
1359 if (atmosphere_dim == 1) {
1370 refr_index_air_agenda,
1373 }
else if (atmosphere_dim == 2) {
1383 z_surface(
joker, 0),
1385 refr_index_air_agenda,
1388 }
else if (atmosphere_dim == 3) {
1401 refr_index_air_agenda,
1405 throw runtime_error(
"The atmospheric dimensionality must be 1-3.");
1410 assert(ppath_step.
np == 1);
1411 if (atmosphere_dim == 1) {
1413 ppath_step.
nreal[0],
1415 refr_index_air_agenda,
1423 }
else if (atmosphere_dim == 2) {
1425 ppath_step.
nreal[0],
1427 refr_index_air_agenda,
1436 ppath_step.
pos(0, 1));
1439 ppath_step.
nreal[0],
1441 refr_index_air_agenda,
1451 ppath_step.
pos(0, 1),
1452 ppath_step.
pos(0, 2));
1459 const Index& atmosphere_dim,
1466 if (atmosphere_dim == 1) {
1477 const Index& atmosphere_dim,
1480 const Vector& refellipsoid,
1490 pos2refell_r(atmosphere_dim, refellipsoid, lat_grid, lon_grid, rte_pos) +
1493 pos2refell_r(atmosphere_dim, refellipsoid, lat_grid, lon_grid, rte_pos2) +
1501 if (atmosphere_dim == 1) {
1506 }
else if (atmosphere_dim == 2) {
1514 sph2cart(x2, y2, z2, r2, rte_pos2[1], rte_pos2[2]);
1520 los2xyz(za, aa, r1, lat1, lon1,
x1, y1, z1, x2, y2, z2);
1522 if (atmosphere_dim == 3) {
1529 if (atmosphere_dim == 2 && aa < 0)
1538 const Index& atmosphere_dim,
1546 rte_pos.
resize(atmosphere_dim);
1548 if (atmosphere_dim >= 2) {
1551 if (atmosphere_dim == 3) {
1559 const Index& atmosphere_dim,
1566 if (np == 0)
throw runtime_error(
"The input *ppath* is empty.");
1568 throw runtime_error(
1569 "Internal inconsistency in *ppath* (size of data " 1570 "does not match np).");
1572 rte_pos = ppath.
pos(np - 1,
Range(0, atmosphere_dim));
1573 if (atmosphere_dim < 3) {
1574 rte_los = ppath.
los(np - 1,
Range(0, 1));
1576 rte_los = ppath.
los(np - 1,
Range(0, 2));
1583 const Index& atmosphere_dim,
1586 const Vector& refellipsoid,
1587 const Matrix& sensor_pos,
1588 const Matrix& target_pos,
1592 if (sensor_pos.
ncols() != atmosphere_dim)
1593 throw runtime_error(
1594 "The number of columns of sensor_pos must be " 1595 "equal to the atmospheric dimensionality.");
1596 if ((atmosphere_dim == 1 && target_pos.
ncols() != 2) ||
1597 (atmosphere_dim >= 2 && target_pos.
ncols() != atmosphere_dim))
1598 throw runtime_error(
1599 "The number of columns of targe_pos must be equal to " 1600 "the atmospheric dimensionality, except for 1D where " 1601 "two columns are demended (as for *rte_pos2*).");
1602 if (target_pos.
nrows() !=
n)
1603 throw runtime_error(
1604 "*sensor_pos* and *target_pos* must have the same " 1607 atmosphere_dim < 3 ? sensor_los.
resize(n, 1) : sensor_los.
resize(n, 2);
1618 sensor_los(
i,
joker) = rte_los;
1632 tan_pos = std::numeric_limits<Numeric>::quiet_NaN();
1634 tan_pos[0] = ppath.
pos(it, 0);
1635 tan_pos[1] = ppath.
pos(it, 1);
1637 tan_pos[2] = ppath.
pos(it, 2);
1652 os <<
"Lowest altitude found at the end of the propagation path.\n" 1653 <<
"This indicates that the tangent point is either above the\n" 1654 <<
"top-of-the-atmosphere or below the planet's surface.";
1656 os <<
"Tangent point position:\n-----------------------\n" 1657 <<
" z = " << ppath.
pos(it, 0) / 1e3 <<
" km\n" 1658 <<
" lat = " << ppath.
pos(it, 1) <<
" deg";
1660 os <<
"\n lon: " << ppath.
pos(it, 2) <<
" deg";
1670 const Agenda& refr_index_air_agenda,
1671 const Matrix& sensor_pos,
1676 const Vector& refellipsoid,
1677 const Index& atmosphere_dim,
1679 const Vector& ztan_vector,
1681 if (atmosphere_dim != 1) {
1682 throw runtime_error(
"The function can only be used for 1D atmospheres.");
1685 if (ztan_vector.
nelem() != sensor_pos.
nrows()) {
1687 os <<
"The number of altitudes in true tangent altitude vector must\n" 1688 <<
"match the number of positions in *sensor_pos*.";
1689 throw runtime_error(os.
str());
1696 Numeric refr_index_air, refr_index_air_group;
1700 if (ztan_vector[
i] > sensor_pos(
i, 0)) {
1702 os <<
"Invalid observation geometry: sensor (at z=" << sensor_pos(
i, 0)
1703 <<
"m) is located below the requested tangent altitude (tanh=" 1704 << ztan_vector[
i] <<
"m)";
1705 throw runtime_error(os.
str());
1709 refr_index_air_group,
1710 refr_index_air_agenda,
1717 ztan_vector[
i] + refellipsoid[0]);
1720 za_vector[
i] = 180 -
RAD2DEG * asin(refr_index_air *
1721 (refellipsoid[0] + ztan_vector[
i]) /
1722 (refellipsoid[0] + sensor_pos(i, 0)));
1729 const Matrix& sensor_pos,
1730 const Vector& refellipsoid,
1731 const Index& atmosphere_dim,
1732 const Vector& ztan_vector,
1734 if (atmosphere_dim != 1) {
1735 throw runtime_error(
"The function can only be used for 1D atmospheres.");
1740 if (ztan_vector.
nelem() != npos) {
1742 os <<
"The number of altitudes in the geometric tangent altitude vector\n" 1743 <<
"must match the number of positions in *sensor_pos*.";
1744 throw runtime_error(os.
str());
1750 if (ztan_vector[
i] > sensor_pos(
i, 0)) {
1752 os <<
"Invalid observation geometry: sensor (at z=" << sensor_pos(
i, 0)
1753 <<
"m) is located below the requested tangent altitude (tanh=" 1754 << ztan_vector[
i] <<
"m)";
1755 throw runtime_error(os.
str());
1759 refellipsoid[0] + sensor_pos(i, 0));
INDEX Index
The type to use for all integer numbers and indices.
Template functions for general supergeneric ws methods.
void rte_losGeometricFromRtePosToRtePos2(Vector &rte_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Vector &rte_pos, const Vector &rte_pos2, const Verbosity &)
WORKSPACE METHOD: rte_losGeometricFromRtePosToRtePos2.
void TangentPointPrint(const Ppath &ppath, const Index &level, const Verbosity &verbosity)
WORKSPACE METHOD: TangentPointPrint.
void get_refr_index_2d(Workspace &ws, Numeric &refr_index_air, Numeric &refr_index_air_group, const Agenda &refr_index_air_agenda, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView refellipsoid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &r, const Numeric &lat)
get_refr_index_2d
void los2xyz(Numeric &za, Numeric &aa, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &x1, const Numeric &y1, const Numeric &z1, const Numeric &x2, const Numeric &y2, const Numeric &z2)
los2xyz
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
void ppath_calc(Workspace &ws, Ppath &ppath, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const bool &ppath_inside_cloudbox_do, const Verbosity &verbosity)
This is the core for the WSM ppathStepByStep.
void distance2D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &r2, const Numeric &lat2)
distance2D
void get_refr_index_3d(Workspace &ws, Numeric &refr_index_air, Numeric &refr_index_air_group, const Agenda &refr_index_air_agenda, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView refellipsoid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &r, const Numeric &lat, const Numeric &lon)
void geo_posEndOfPpath(Vector &geo_pos, const Ppath &ppath, const Verbosity &verbosity)
WORKSPACE METHOD: geo_posEndOfPpath.
Numeric geompath_za_at_r(const Numeric &ppc, const Numeric &a_za, const Numeric &r)
Calculates the zenith angle for a given radius along a geometrical propagation path.
Numeric constant
The propagation path constant (only used for 1D)
void pol2cart(Numeric &x, Numeric &z, const Numeric &r, const Numeric &lat)
pol2cart
Index nelem() const
Number of elements.
void filename_xml_with_index(String &filename, const Index &file_index, const String &varname, const Index &digits)
Gives the default filename, with file index, for the XML formats.
Declarations having to do with the four output streams.
void geo_posWherePpathPassesZref(Vector &geo_pos, const Ppath &ppath, const Numeric &z_ref, const Verbosity &verbosity)
WORKSPACE METHOD: geo_posWherePpathPassesZref.
void geo_posLowestAltitudeOfPpath(Vector &geo_pos, const Ppath &ppath, const Verbosity &verbosity)
WORKSPACE METHOD: geo_posLowestAltitudeOfPpath.
void ppath_copy(Ppath &ppath1, const Ppath &ppath2, const Index &ncopy)
Copy the content in ppath2 to ppath1.
Matrix los
Line-of-sight at each ppath point.
Vector end_pos
End position.
Index dim
Atmospheric dimensionality.
void line_circle_intersect(Numeric &x, Numeric &z, const Numeric &xl, const Numeric &zl, const Numeric &dx, const Numeric &dz, const Numeric &xc, const Numeric &zc, const Numeric &r)
geomtanpoint2d
void find_tanpoint(Index &it, const Ppath &ppath)
Identifies the tangent point of a propagation path.
void ppath_step_refr_2d(Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstVectorView lat_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstVectorView z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
Calculates 2D propagation path steps, with refraction, using a simple and fast ray tracing scheme...
Vector lstep
The length between ppath points.
Linear algebra functions.
void ppath_step_geom_3d(Ppath &ppath, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Numeric &lmax)
Calculates 3D geometrical propagation path steps.
void rte_posSet(Vector &rte_pos, const Index &atmosphere_dim, const Numeric &z, const Numeric &lat, const Numeric &lon, const Verbosity &)
WORKSPACE METHOD: rte_posSet.
void ppathFromRtePos2(Workspace &ws, Ppath &ppath, Vector &rte_los, Numeric &ppath_lraytrace, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Vector &rte_pos, const Vector &rte_pos2, const Numeric &ppath_lmax, const Numeric &za_accuracy, const Numeric &pplrt_factor, const Numeric &pplrt_lowest, const Verbosity &verbosity)
WORKSPACE METHOD: ppathFromRtePos2.
cmplx FADDEEVA() w(cmplx z, double relerr)
Matrix pos
The distance between start pos and the last position in pos.
This file contains basic functions to handle XML data files.
void ppathCalcFromAltitude(Workspace &ws, Ppath &ppath, const Agenda &ppath_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &atmgeom_checked, const Vector &f_grid, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &ppath_inside_cloudbox_do, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Numeric &altitude, const Numeric &accuracy, const Verbosity &verbosity)
WORKSPACE METHOD: ppathCalcFromAltitude.
Vector ngroup
The group index of refraction.
Vector start_pos
Start position.
Vector r
Radius of each ppath point.
void get_refr_index_1d(Workspace &ws, Numeric &refr_index_air, Numeric &refr_index_air_group, const Agenda &refr_index_air_agenda, ConstVectorView p_grid, ConstVectorView refellipsoid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &r)
get_refr_index_1d
Index nelem() const
Returns the number of elements.
void ppath_fieldFromDownUpLimbGeoms(Workspace &ws, ArrayOfPpath &ppath_field, const Agenda &ppath_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &atmgeom_checked, const Tensor3 &z_field, const Vector &f_grid, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &ppath_inside_cloudbox_do, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Vector &refellipsoid, const Index &atmosphere_dim, const Index &zenith_angles_per_position, const Verbosity &verbosity)
WORKSPACE METHOD: ppath_fieldFromDownUpLimbGeoms.
Structure to store a grid position.
void ppath_stepRefractionBasic(Workspace &ws, Ppath &ppath_step, const Agenda &refr_index_air_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const Tensor4 &vmr_field, const Vector &refellipsoid, const Matrix &z_surface, const Vector &f_grid, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Verbosity &)
WORKSPACE METHOD: ppath_stepRefractionBasic.
Array< Index > ArrayOfIndex
An array of Index.
void ppath_stepGeometric(Ppath &ppath_step, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &refellipsoid, const Matrix &z_surface, const Numeric &ppath_lmax, const Verbosity &)
WORKSPACE METHOD: ppath_stepGeometric.
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.
Vector end_los
End line-of-sight.
void diff_za_aa(Numeric &dza, Numeric &daa, const Numeric &za0, const Numeric &aa0, const Numeric &za, const Numeric &aa)
Takes the difference of zenith and azimuth angles.
Index ncols() const
Returns the number of columns.
void ppath_agendaExecute(Workspace &ws, Ppath &ppath, const Numeric ppath_lmax, const Numeric ppath_lraytrace, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Index cloudbox_on, const Index ppath_inside_cloudbox_do, const Vector &f_grid, const Agenda &input_agenda)
void ppath_set_background(Ppath &ppath, const Index &case_nr)
Sets the background field of a Ppath structure.
The global header file for ARTS.
void sensor_losGeometricFromSensorPosToOtherPositions(Matrix &sensor_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Matrix &sensor_pos, const Matrix &target_pos, const Verbosity &verbosity)
WORKSPACE METHOD: sensor_losGeometricFromSensorPosToOtherPositions.
_CS_string_type str() const
void ppath_init_structure(Ppath &ppath, const Index &atmosphere_dim, const Index &np)
Initiates a Ppath structure to hold the given number of points.
void cart2poslos(Numeric &r, Numeric &lat, Numeric &za, const Numeric &x, const Numeric &z, const Numeric &dx, const Numeric &dz, const Numeric &ppc, const Numeric &lat0, const Numeric &za0)
cart2poslos
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
void ppathWriteXMLPartial(const String &file_format, const Ppath &ppath, const String &f, const Index &file_index, const Verbosity &verbosity)
WORKSPACE METHOD: ppathWriteXMLPartial.
Numeric start_lstep
Length between sensor and atmospheric boundary.
void DiffZaAa(Matrix &dlos, const Vector &ref_los, const Matrix &other_los, const Verbosity &)
WORKSPACE METHOD: DiffZaAa.
void add_za_aa(Numeric &za, Numeric &aa, const Numeric &za0, const Numeric &aa0, const Numeric &dza, const Numeric &daa)
Adds up zenith and azimuth angles.
void AddZaAa(Matrix &new_los, const Vector &ref_los, const Matrix &dlos, const Verbosity &)
WORKSPACE METHOD: AddZaAa.
Index first_pos_before_altitude(const Ppath &p, const Numeric &alt)
Determines ppath position just below an altitude.
void ppathCalc(Workspace &ws, Ppath &ppath, const Agenda &ppath_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &atmgeom_checked, const Vector &f_grid, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &ppath_inside_cloudbox_do, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Verbosity &)
WORKSPACE METHOD: ppathCalc.
NUMERIC Numeric
The type to use for all floating point numbers.
Vector nreal
The real part of the refractive index at each path position.
void distance3D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
distance3D
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy
Header file for special_interp.cc.
Propagation path structure and functions.
void ppath_step_geom_2d(Ppath &ppath, ConstVectorView lat_grid, ConstMatrixView z_field, ConstVectorView refellipsoid, ConstVectorView z_surface, const Numeric &lmax)
Calculates 2D geometrical propagation path steps.
void ppath_step_geom_1d(Ppath &ppath, ConstVectorView z_field, ConstVectorView refellipsoid, const Numeric &z_surface, const Numeric &lmax)
Calculates 1D geometrical propagation path steps.
Index npages() const
Returns the number of pages.
This can be used to make arrays out of anything.
void rte_pos_losMoveToStartOfPpath(Vector &rte_pos, Vector &rte_los, const Index &atmosphere_dim, const Ppath &ppath, const Verbosity &)
WORKSPACE METHOD: rte_pos_losMoveToStartOfPpath.
void ppath_step_refr_1d(Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, const Numeric &z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
Calculates 1D propagation path steps including effects of refraction.
void rte_pos2gridpos(GridPos &gp_p, GridPos &gp_lat, GridPos &gp_lon, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView rte_pos)
Converts a geographical position (rte_pos) to grid positions for p, lat and lon.
void cart2pol(Numeric &r, Numeric &lat, const Numeric &x, const Numeric &z, const Numeric &lat0, const Numeric &za0)
cart2pol
void resize(Index n)
Resize function.
Index np
Number of points describing the ppath.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
void ppath_fieldCalc(Workspace &ws, ArrayOfPpath &ppath_field, const Agenda &ppath_agenda, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &atmgeom_checked, const Vector &f_grid, const Index &cloudbox_on, const Index &cloudbox_checked, const Index &ppath_inside_cloudbox_do, const Matrix &sensor_pos, const Matrix &sensor_los, const Vector &rte_pos2, const Verbosity &verbosity)
WORKSPACE METHOD: ppath_fieldCalc.
Workspace methods and template functions for supergeneric XML IO.
void ppathStepByStep(Workspace &ws, Ppath &ppath, const Agenda &ppath_step_agenda, const Index &ppath_inside_cloudbox_do, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Verbosity &verbosity)
WORKSPACE METHOD: ppathStepByStep.
void TangentPointExtract(Vector &tan_pos, const Ppath &ppath, const Verbosity &)
WORKSPACE METHOD: TangentPointExtract.
Vector start_los
Start line-of-sight.
void VectorZtanToZaRefr1D(Workspace &ws, Vector &za_vector, const Agenda &refr_index_air_agenda, const Matrix &sensor_pos, const Vector &p_grid, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &refellipsoid, const Index &atmosphere_dim, const Vector &f_grid, const Vector &ztan_vector, const Verbosity &)
WORKSPACE METHOD: VectorZtanToZaRefr1D.
void ppathPlaneParallel(Ppath &ppath, const Index &atmosphere_dim, const Tensor3 &z_field, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &ppath_inside_cloudbox_do, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lmax, const Verbosity &)
WORKSPACE METHOD: ppathPlaneParallel.
void cart2sph(Numeric &r, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &lat0, const Numeric &lon0, const Numeric &za0, const Numeric &aa0)
cart2sph
void WriteXML(const String &file_format, const T &v, const String &f, const Index &no_clobber, const String &v_name, const String &f_name, const String &no_clobber_name, const Verbosity &verbosity)
WORKSPACE METHOD: WriteXML.
The structure to describe a propagation path and releated quantities.
void linreg(Vector &p, ConstVectorView x, ConstVectorView y)
void sph2cart(Numeric &x, Numeric &y, Numeric &z, const Numeric &r, const Numeric &lat, const Numeric &lon)
sph2cart
void ppath_step_refr_3d(Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
Calculates 3D propagation path steps, with refraction, using a simple and fast ray tracing scheme...
void poslos2cart(Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
poslos2cart
#define SWITCH_OUTPUT(x, y)
Index nrows() const
Returns the number of rows.
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.
void line_sphere_intersect(Numeric &x, Numeric &y, Numeric &z, const Numeric &xl, const Numeric &yl, const Numeric &zl, const Numeric &dx, const Numeric &dy, const Numeric &dz, const Numeric &xc, const Numeric &yc, const Numeric &zc, const Numeric &r)
geomtanpoint
void rte_losSet(Vector &rte_los, const Index &atmosphere_dim, const Numeric &za, const Numeric &aa, const Verbosity &)
WORKSPACE METHOD: rte_losSet.
void VectorZtanToZa1D(Vector &za_vector, const Matrix &sensor_pos, const Vector &refellipsoid, const Index &atmosphere_dim, const Vector &ztan_vector, const Verbosity &)
WORKSPACE METHOD: VectorZtanToZa1D.
void resize(Index r, Index c)
Resize function.
Numeric pos2refell_r(const Index &atmosphere_dim, ConstVectorView refellipsoid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
pos2refell_r