80 const Vector& transmittance,
81 const Index& fastem_version,
91 if (fastem_version < 3 || fastem_version > 6)
92 throw std::runtime_error(
93 "Invalid fastem version: 3 <= fastem_version <= 6");
96 reflectivity.
resize(nf, 4);
100 for (
Index i = 0; i < nf; i++) {
101 if (f_grid[i] > 250e9)
102 throw std::runtime_error(
"Only frequency <= 250 GHz are allowed");
118 emissivity(i,
joker) = e;
119 reflectivity(i,
joker) = r;
124 for (
Index i = 0; i < nf; i++) {
125 for (
Index s = 0; s < 2; s++) {
126 if (emissivity(i, s) > 1) {
127 emissivity(i, s) = 1;
128 reflectivity(i, s) = 0;
130 if (emissivity(i, s) < 0) {
131 emissivity(i, s) = 0;
132 reflectivity(i, s) = 1;
134 if (reflectivity(i, s) > 1) {
135 emissivity(i, s) = 0;
136 reflectivity(i, s) = 1;
138 if (reflectivity(i, s) < 0) {
139 emissivity(i, s) = 1;
140 reflectivity(i, s) = 0;
148 const Index& atmosphere_dim,
156 Index gfield_latID = 0;
157 Index gfield_lonID = 1;
171 if (nlat < 2 || nlon < 2) {
173 os <<
"The data in *gfield2* must span a geographical region. That is,\n"
174 <<
"the latitude and longitude grids must have a length >= 2.";
175 throw runtime_error(os.str());
184 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
192 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
197 gridpos(gp_lat, GFlat, lat[0]);
198 gridpos(gp_lon, lon_shifted, lon[0]);
201 outvalue =
interp(itw, gfield2.
data, gp_lat, gp_lon);
207 const Index& atmosphere_dim,
217 "input argument *field*", field, atmosphere_dim, lat_grid, lon_grid);
223 if (rtp_pos[0] < zmin - dzok || rtp_pos[0] > zmax + dzok) {
225 os <<
"The given position does not match *z_surface*.\nThe altitude in "
226 <<
"*rtp_pos* is " << rtp_pos[0] / 1e3 <<
" km.\n"
227 <<
"The altitude range covered by *z_surface* is [" << zmin / 1e3 <<
","
228 << zmax / 1e3 <<
"] km.\n"
229 <<
"One possible mistake is to mix up *rtp_pos* and *rte_los*.";
230 throw runtime_error(os.str());
233 if (atmosphere_dim == 1) {
234 outvalue = field(0, 0);
238 gridpos(gp_lat, lat_grid, rtp_pos[1]);
239 if (atmosphere_dim == 3) {
241 gridpos(gp_lon, lon_grid, rtp_pos[2]);
249 out3 <<
" Result = " << outvalue <<
"\n";
256 const Tensor3& iy_transmittance,
258 const Index& jacobian_do,
259 const Index& atmosphere_dim,
261 const Index& cloudbox_on,
262 const Index& stokes_dim,
268 const Agenda& iy_main_agenda,
273 const Index& fastem_version,
280 Vector specular_los, surface_normal;
290 iy_aux_vars[0] =
"Optical depth";
322 for (
Index i = 0; i < nf; i++) {
323 transmittance[i] = exp(-iy_aux[0](i, 0));
352 Matrix sensor_los_dummy(1, 1, 0);
354 surface_calc(iy, I, sensor_los_dummy, surface_rmatrix, surface_emission);
359 if (iy_transmittance.
npages()) {
361 for (
Index p = 0; p < diy_dx[q].npages(); p++) {
362 for (
Index i = 0; i < nf; i++) {
377 const Tensor3& iy_transmittance,
379 const Index& jacobian_do,
380 const Index& suns_do,
381 const Index& atmosphere_dim,
383 const Index& cloudbox_on,
384 const Index& stokes_dim,
389 const Vector& refellipsoid,
394 const Tensor3& surface_reflectivity,
395 const Tensor3& surface_props_data,
399 const Agenda& iy_main_agenda,
403 ARTS_USER_ERROR_IF(atmosphere_dim==2,
"This method does not work for 2d atmospheres.")
414 surface_props_names);
420 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
432 surface_props_names);
441 Vector specular_los, surface_normal;
449 if (iy_transmittance.
npages()) {
450 iy_trans_new=iy_transmittance;
478 surface_reflectivity,
488 dsurface_emission_dx);
498 dsurface_rmatrix_dx[irq],
499 dsurface_emission_dx[irq],
506 surface_skin_t[0]+dd,
507 surface_reflectivity,
509 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
510 dsurface_rmatrix_dx[irq] /= dd;
511 dsurface_emission_dx[irq] -= surface_emission;
512 dsurface_emission_dx[irq] /= dd;
524 dsurface_emission_dx,
551 const Index& stokes_dim,
553 const Index& atmosphere_dim,
569 const Tensor3& surface_reflectivity,
570 const Vector& refellipsoid,
576 const Numeric& ppath_lraytrace,
577 const Index& ppath_inside_cloudbox_do,
578 const Index& cloudbox_on,
580 const Index& suns_do,
581 const Index& gas_scattering_do,
582 const Index& jacobian_do,
587 const Agenda& propmat_clearsky_agenda,
588 const Agenda& water_p_eq_agenda,
589 const Agenda& gas_scattering_agenda,
590 const Agenda& ppath_step_agenda,
594 "If suns are present only iy_unit=\"1\" can be used.");
636 ppath_inside_cloudbox_do,
644 propmat_clearsky_agenda,
646 gas_scattering_agenda,
654 Numeric surface_skin_t_dummy = 1.;
668 surface_skin_t_dummy,
669 surface_reflectivity,
672 surface_emission *= 0.;
677 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
690 const Tensor3& iy_transmittance,
692 const Index& jacobian_do,
693 const Index& suns_do,
694 const Index& atmosphere_dim,
696 const Index& cloudbox_on,
697 const Index& stokes_dim,
702 const Vector& refellipsoid,
708 const Tensor3& surface_props_data,
712 const Agenda& iy_main_agenda,
716 ARTS_USER_ERROR_IF(atmosphere_dim==2,
"This method does not work for 2d atmospheres.")
727 surface_props_names);
733 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
745 surface_props_names);
753 Vector specular_los, surface_normal;
761 if (iy_transmittance.
npages()) {
762 iy_trans_new=iy_transmittance;
790 surface_complex_refr_index,
800 dsurface_emission_dx);
810 dsurface_rmatrix_dx[irq],
811 dsurface_emission_dx[irq],
818 surface_skin_t[0]+dd,
819 surface_complex_refr_index,
821 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
822 dsurface_rmatrix_dx[irq] /= dd;
823 dsurface_emission_dx[irq] -= surface_emission;
824 dsurface_emission_dx[irq] /= dd;
836 dsurface_emission_dx,
863 const Index& stokes_dim,
865 const Index& atmosphere_dim,
882 const Vector& refellipsoid,
888 const Numeric& ppath_lraytrace,
889 const Index& ppath_inside_cloudbox_do,
890 const Index& cloudbox_on,
892 const Index& suns_do,
893 const Index& gas_scattering_do,
894 const Index& jacobian_do,
899 const Agenda& propmat_clearsky_agenda,
900 const Agenda& water_p_eq_agenda,
901 const Agenda& gas_scattering_agenda,
902 const Agenda& ppath_step_agenda,
906 "If suns are present only iy_unit=\"1\" can be used.");
948 ppath_inside_cloudbox_do,
956 propmat_clearsky_agenda,
958 gas_scattering_agenda,
966 Numeric surface_skin_t_dummy = 1.;
980 surface_skin_t_dummy,
981 surface_complex_refr_index,
984 surface_emission *= 0.;
989 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
999 const Index& stokes_dim,
1009 const Tensor3& iy_transmittance,
1011 const Index& jacobian_do,
1012 const Index& suns_do,
1013 const Index& atmosphere_dim,
1015 const Index& cloudbox_on,
1016 const Index& stokes_dim,
1021 const Vector& refellipsoid,
1026 const Vector& surface_scalar_reflectivity,
1027 const Tensor3& surface_props_data,
1031 const Agenda& iy_main_agenda,
1037 surface_scalar_reflectivity.
nelem() != 1,
1038 "The number of elements in *surface_scalar_reflectivity* should\n",
1039 "match length of *f_grid* or be 1.",
1040 "\n length of *f_grid* : ", f_grid.
nelem(),
1041 "\n length of *surface_scalar_reflectivity* : ",
1042 surface_scalar_reflectivity.
nelem());
1044 max(surface_scalar_reflectivity) > 1,
1045 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1046 ARTS_USER_ERROR_IF(atmosphere_dim==2,
"This method does not work for 2d atmospheres.");
1057 surface_props_names);
1063 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
1067 Vector surface_skin_t(1);
1075 surface_props_names);
1084 Vector za_grid, aa_grid, za_grid_weights;
1102 iy_aux_var.resize(1);
1103 iy_aux_var[0] =
"Direct radiation";
1109 if (iy_transmittance.
npages()) {
1110 iy_trans_new=iy_transmittance;
1115 iy.
resize(nf, stokes_dim);
1125 for (
Index i_za = 0; i_za < N_za; i_za++) {
1127 if (atmosphere_dim==1){
1136 los[0] = za_grid[i_za];
1143 Index iy_id_new = iy_id + i_za + i_aa * N_za + 1;
1169 iy_temp -= iy_aux[0];
1171 iy_temp *=
abs(cos(deg2rad(los[0])) * sin(deg2rad(los[0]))) *
1172 za_grid_weights[i_za];
1183 Vector aa_grid_rad = aa_grid;
1186 for (
Index i = 0; i < aa_grid_rad.
nelem(); i++) {
1187 aa_grid_rad[i] = deg2rad(aa_grid_rad[i]);
1195 for (
Index i_aa = 0; i_aa < N_aa; i_aa++) {
1196 for (
Index i_za = 0; i_za < N_za; i_za++) {
1199 los[0] = za_grid[i_za];
1200 los[1] = aa_grid[i_aa];
1206 Index iy_id_new = iy_id + i_za + i_aa * N_za + 1;
1232 iy_temp -= iy_aux[0];
1234 iy_temp *=
abs(cos(deg2rad(los[0])) * sin(deg2rad(los[0]))) *
1235 za_grid_weights[i_za] * aa_grid_weights[i_aa];
1241 Vector specular_los, surface_normal;
1256 planck(
b, f_grid, surface_skin_t[0]);
1260 for (
Index i_freq = 0; i_freq < f_grid.
nelem(); i_freq++) {
1261 if (i_freq == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1262 r = surface_scalar_reflectivity[i_freq];
1265 cos(deg2rad(specular_los[0])) / pi * Flx(i_freq, 0) +
1266 (1 - r) *
b[i_freq];
1270 if (jacobian_do && dsurface_names.
nelem()) {
1278 for (
Index j = 0; j < jacobian_quantities.
nelem() && ihit < 0; j++) {
1279 if (dsurface_names[irq] == jacobian_quantities[j].Subtag()) {
1285 Matrix diy_dpos0(f_grid.
nelem(), stokes_dim, 0.), diy_dpos;
1288 Vector emissivity=surface_scalar_reflectivity;
1291 diy_dpos0*=emissivity;
1298 jacobian_quantities[ihit],
1312 const Index& stokes_dim,
1314 const Index& atmosphere_dim,
1330 const Vector& surface_scalar_reflectivity,
1331 const Vector& refellipsoid,
1337 const Numeric& ppath_lraytrace,
1338 const Index& cloudbox_on,
1340 const Index& suns_do,
1341 const Index& gas_scattering_do,
1342 const Index& jacobian_do,
1345 const Numeric& rte_alonglos_v,
1347 const Agenda& propmat_clearsky_agenda,
1348 const Agenda& water_p_eq_agenda,
1349 const Agenda& gas_scattering_agenda,
1350 const Agenda& ppath_step_agenda,
1361 "If suns are present only iy_unit=\"1\" can be used.");
1366 surface_scalar_reflectivity.
nelem() != 1,
1367 "The number of elements in *surface_scalar_reflectivity* should\n",
1368 "match length of *f_grid* or be 1.",
1369 "\n length of *f_grid* : ", f_grid.
nelem(),
1370 "\n length of *surface_scalar_reflectivity* : ",
1371 surface_scalar_reflectivity.
nelem());
1373 max(surface_scalar_reflectivity) > 1,
1374 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1403 transmitted_sunlight,
1404 dtransmitted_sunlight,
1434 jacobian_quantities,
1435 propmat_clearsky_agenda,
1437 gas_scattering_agenda,
1442 Vector specular_los, surface_normal;
1444 for (
Index i_sun = 0; i_sun < suns.
nelem(); i_sun++) {
1445 if (suns_visible[i_sun]) {
1449 mirror_los(incoming_los,sun_rte_los[i_sun], atmosphere_dim);
1474 for (
Index i_freq = 0; i_freq < f_grid.
nelem(); i_freq++) {
1475 if (i_freq == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1476 r = surface_scalar_reflectivity[i_freq];
1478 iy_surface_direct[i_freq] = r / pi *
1479 transmitted_sunlight[i_sun](i_freq, 0) *
1480 cos(deg2rad(specular_los[0]));
1484 iy(
joker, 0) += iy_surface_direct;
1499 Matrix& surface_emission,
1500 const Tensor3& iy_transmittance,
1502 const Index& jacobian_do,
1503 const Index& suns_do,
1504 const Index& atmosphere_dim,
1506 const Index& cloudbox_on,
1507 const Index& stokes_dim,
1513 const Agenda& iy_main_agenda,
1514 const Agenda& surface_rtprop_agenda,
1530 surface_rtprop_agenda);
1539 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
1540 if (nlos != surface_rmatrix.
nbooks())
1541 throw runtime_error(
1542 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
1543 if (surface_rmatrix.
npages() != nf)
1544 throw runtime_error(
1545 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
1546 if (surface_rmatrix.
nrows() != stokes_dim ||
1547 surface_rmatrix.
ncols() != stokes_dim)
1548 throw runtime_error(
1549 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
1551 if (surface_emission.
ncols() != stokes_dim)
1552 throw runtime_error(
1553 "Mismatch between size of *surface_emission* and *stokes_dim*.");
1554 if (surface_emission.
nrows() != nf)
1555 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
1558 Tensor3 I(nlos, nf, stokes_dim);
1561 if (suns_do) iy_aux_var.emplace_back(
"Direct radiation");
1565 for (
Index ilos = 0; ilos < nlos; ilos++) {
1574 if (iy_transmittance.
npages()) {
1586 Index iy_id_new = iy_id + ilos + 1;
1617 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
1619 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
1622 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n"
1623 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
1624 throw runtime_error(os.str());
1632 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
1639 const Matrix& surface_los,
1640 const Tensor4& surface_rmatrix,
1641 const Matrix& surface_emission,
1645 const Tensor3& iy_transmittance,
1647 const Index& jacobian_do,
1648 const Index& suns_do,
1650 const Index& atmosphere_dim,
1652 const Index& cloudbox_on,
1653 const Index& stokes_dim,
1659 const Agenda& iy_main_agenda,
1673 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
1674 if (nlos != surface_rmatrix.
nbooks())
1675 throw runtime_error(
1676 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
1677 if (surface_rmatrix.
npages() != nf)
1678 throw runtime_error(
1679 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
1680 if (surface_rmatrix.
nrows() != stokes_dim ||
1681 surface_rmatrix.
ncols() != stokes_dim)
1682 throw runtime_error(
1683 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
1685 if (surface_emission.
ncols() != stokes_dim)
1686 throw runtime_error(
1687 "Mismatch between size of *surface_emission* and *stokes_dim*.");
1688 if (surface_emission.
nrows() != nf)
1689 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
1692 Tensor3 I(nlos, nf, stokes_dim);
1695 if (suns_do) iy_aux_var.emplace_back(
"Direct radiation");
1699 for (
Index ilos = 0; ilos < nlos; ilos++) {
1708 if (iy_transmittance.
npages()) {
1750 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
1752 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
1755 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n"
1756 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
1757 throw runtime_error(os.str());
1765 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
1768 if (jacobian_do && dsurface_names.
nelem()) {
1770 for (
Index i = 0; i < dsurface_names.
nelem(); i++) {
1773 if (dsurface_emission_dx[i].empty() || dsurface_rmatrix_dx[i].empty()) {
1775 os <<
"The derivatives for surface quantity: " << dsurface_names[i]
1776 <<
"\nwere not calculated by *iy_surface_agenda*.\n"
1777 <<
"That is, *dsurface_emission_dx* and/or *dsurface_rmatrix_dx*\n"
1779 throw runtime_error(os.str());
1783 for (
Index j = 0; j < jacobian_quantities.
nelem() && ihit < 0; j++) {
1784 if (dsurface_names[i] == jacobian_quantities[j].Subtag()) {
1790 Matrix diy_dpos0, diy_dpos;
1794 dsurface_rmatrix_dx[i],
1795 dsurface_emission_dx[i]);
1800 jacobian_quantities[ihit],
1814 const Index& atmosphere_dim,
1823 if (atmosphere_dim == 1) {
1824 surface_normal[0] = 0;
1825 if (rtp_los[0] < 90) {
1826 throw runtime_error(
1827 "Invalid zenith angle. The zenith angle corresponds "
1828 "to observe the surface from below.");
1830 specular_los[0] = 180 - rtp_los[0];
1833 else if (atmosphere_dim == 2) {
1834 specular_los[0] =
sign(rtp_los[0]) * 180 - rtp_los[0];
1835 surface_normal[0] = 0;
1838 else if (atmosphere_dim == 3) {
1839 specular_los[0] = 180 - rtp_los[0];
1840 specular_los[1] = rtp_los[1];
1841 surface_normal[0] = 0;
1842 surface_normal[1] = 0;
1851 const Index& atmosphere_dim,
1854 const Vector& refellipsoid,
1856 const Index& ignore_surface_slope,
1864 if (atmosphere_dim == 1 || ignore_surface_slope) {
1877 if (atmosphere_dim == 2) {
1880 gridpos(gp_lat, lat_grid, rtp_pos[1]);
1883 c1, lat_grid, refellipsoid, z_surface(
joker, 0), gp_lat, rtp_los[0]);
1889 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
1890 throw runtime_error(
1891 "Invalid zenith angle. The zenith angle corresponds "
1892 "to observe the surface from below.");
1895 sign(rtp_los[0]) * 180 - rtp_los[0] + 2 * surface_normal[0];
1903 gridpos(gp_lat, lat_grid, rtp_pos[1]);
1904 gridpos(gp_lon, lon_grid, rtp_pos[2]);
1907 c1, c2, lat_grid, lon_grid, refellipsoid, z_surface, gp_lat, gp_lon, 0);
1911 interp(itw, z_surface, gp_lat, gp_lon);
1925 Vector tangentSN(3), tangentEW(3), normal(3);
1926 zaaa2cart(tangentSN[0], tangentSN[1], tangentSN[2], zaSN, 0);
1927 zaaa2cart(tangentEW[0], tangentEW[1], tangentEW[2], zaEW, 90);
1928 cross3(normal, tangentSN, tangentEW);
1931 zaaa2cart(di[0], di[1], di[2], rtp_los[0], rtp_los[1]);
1935 surface_normal[0], surface_normal[1], normal[0], normal[1], normal[2]);
1936 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
1937 throw runtime_error(
1938 "Invalid zenith angle. The zenith angle corresponds "
1939 "to observe the surface from below.");
1944 for (
Index i = 0; i < 3; i++) {
1945 speccart[i] =
fac * normal[i] - di[i];
1958 Matrix& surface_emission,
1959 const Index& atmosphere_dim,
1961 const Index& stokes_dim,
1964 const Numeric& surface_skin_t,
1972 out2 <<
" Sets variables to model a blackbody surface with a temperature "
1973 <<
" of " << surface_skin_t <<
" K.\n";
1975 surface_los.
resize(0, 0);
1976 surface_rmatrix.
resize(0, 0, 0, 0);
1981 planck(
b, f_grid, surface_skin_t);
1983 surface_emission.
resize(nf, stokes_dim);
1984 surface_emission = 0.0;
1986 for (
Index iv = 0; iv < nf; iv++) {
1987 surface_emission(iv, 0) =
b[iv];
1988 for (
Index is = 1; is < stokes_dim; is++) {
1989 surface_emission(iv, is) = 0;
1997 Matrix& surface_emission,
1998 const Index& atmosphere_dim,
1999 const Index& stokes_dim,
2003 const Numeric& surface_skin_t,
2006 const Numeric& wind_direction,
2007 const Vector& transmittance,
2008 const Index& fastem_version,
2019 Vector specular_los, surface_normal;
2035 Numeric rel_azimuth = wind_direction;
2036 if (atmosphere_dim == 2 && rtp_los[0] < 0) {
2039 }
else if (atmosphere_dim == 3) {
2040 rel_azimuth -= rtp_los[1];
2045 Matrix emissivity, reflectivity;
2060 surface_los(0,
joker) = specular_los;
2065 planck(
b, f_grid, surface_skin_t);
2067 surface_emission.
resize(nf, stokes_dim);
2068 for (
Index i = 0; i < nf; i++) {
2070 surface_emission(i, 0) =
b[i] * 0.5 * (emissivity(i, 0) + emissivity(i, 1));
2072 if (stokes_dim >= 2) {
2073 surface_emission(i, 1) =
2074 b[i] * 0.5 * (emissivity(i, 0) - emissivity(i, 1));
2077 for (
Index j = 2; j < stokes_dim; j++) {
2078 surface_emission(i, j) =
b[i] * emissivity(i, j);
2084 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
2085 surface_rmatrix = 0.0;
2086 for (
Index iv = 0; iv < nf; iv++) {
2087 surface_rmatrix(0, iv, 0, 0) =
2088 0.5 * (reflectivity(iv, 0) + reflectivity(iv, 1));
2089 if (stokes_dim >= 2) {
2090 surface_rmatrix(0, iv, 0, 1) =
2091 0.5 * (reflectivity(iv, 0) - reflectivity(iv, 1));
2093 surface_rmatrix(0, iv, 1, 0) = surface_rmatrix(0, iv, 0, 1);
2094 surface_rmatrix(0, iv, 1, 1) = surface_rmatrix(0, iv, 0, 0);
2096 for (
Index i = 2; i < stokes_dim; i++) {
2097 surface_rmatrix(0, iv, i, i) = surface_rmatrix(0, iv, 0, 0);
2106 const Index& stokes_dim,
2110 "You should only use this method where the main calculations are "
2111 "done with *stokes_dim* set to 1.");
2113 Index local_stokes = surface_emission.
ncols();
2115 "This method requires that the input surface proporties match a Stokes "
2116 "dimension of 2-4. Incoming *surface_emission* matches stokes_dim=1.");
2120 Matrix se = surface_emission;
2122 surface_emission.
resize(nf, 1);
2123 surface_rmatrix.
resize(nlos, nf, 1, 1);
2125 if (local_stokes == 2) {
2129 for (
Index f=0; f<nf; ++f) {
2130 const Numeric bv = se(f,0) + se(f,1);
2131 const Numeric bh = se(f,0) - se(f,1);
2132 surface_emission(f,0) = c2*bv + s2*bh;
2133 for (
Index l=0; l<nlos; ++l) {
2134 const Numeric rv = sr(l,f,0,0) + sr(l,f,1,0);
2135 const Numeric rh = sr(l,f,0,0) - sr(l,f,1,0);
2136 surface_rmatrix(l,f,0,0) = c2*rv + s2*rh;
2145 Matrix Mleft(local_stokes,local_stokes), Mright(local_stokes,local_stokes);
2146 mult(Mleft, Cm, Lp);
2147 mult(Mright, Lm, Cs);
2150 Matrix Tmp(local_stokes,local_stokes), Mr(local_stokes,local_stokes);
2152 for (
Index f=0; f<nf; ++f) {
2154 surface_emission(f,0) = 2.0 * Vr[0];
2155 for (
Index l=0; l<nlos; ++l) {
2157 mult(Mr, Mleft, Tmp);
2158 surface_rmatrix(l,f,0,0) = Tmp(0,0);
2167 Matrix& surface_emission,
2168 const Index& atmosphere_dim,
2169 const Index& stokes_dim,
2176 const Vector& specular_los,
2177 const Numeric& surface_skin_t,
2189 "surface skin temperature", surface_skin_t, 190.0, 373.0);
2192 Matrix surface_rv_rh(nf, 2);
2198 lat, lon, atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2201 lon = fmod(lon, 360.0);
2211 throw std::runtime_error(
2212 "Given coordinates are not contained in "
2213 " TELSEM atlas. To enable nearest neighbour"
2214 "interpolation set *d_max* to a positive "
2222 std::ostringstream out{};
2223 out <<
"Distance of nearest neighbour exceeds provided limit (";
2224 out <<
d <<
" > " << d_max <<
").";
2225 throw std::runtime_error(out.str());
2241 for (
Index i = 0; i < nf; ++i) {
2242 if (f_grid[i] < 5e9)
2243 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
2244 if (f_grid[i] > 900e9)
2245 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
2249 Numeric f = std::min(f_grid[i], 700e9) * 1e-9;
2250 std::tie(e_v, e_h) =
2251 atlas.
emis_interp(theta, f, class1, class2, emis_v, emis_h);
2253 surface_rv_rh(i, 0) =
min(
max(1.0 - e_v, r_min), r_max);
2254 surface_rv_rh(i, 1) =
min(
max(1.0 - e_h, r_min), r_max);
2274 Matrix& surface_emission,
2275 const Index& atmosphere_dim,
2276 const Index& stokes_dim,
2280 const Numeric& surface_skin_t,
2291 "surface skin temperature", surface_skin_t, 260.0, 373.0);
2296 Vector specular_los, surface_normal;
2311 in[1] = 180.0 -
abs(rtp_los[0]);
2313 in[3] = surface_skin_t;
2319 Matrix surface_rv_rh(nf, 2);
2321 for (
Index i = 0; i < nf; ++i) {
2322 if (f_grid[i] < 5e9)
2323 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
2324 if (f_grid[i] > 900e9)
2325 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
2353 Matrix& surface_emission,
2355 const Index& stokes_dim,
2356 const Index& atmosphere_dim,
2359 const Vector& specular_los,
2360 const Numeric& surface_skin_t,
2377 Matrix n_real(nf, 1), n_imag(nf, 1);
2381 surface_complex_refr_index,
2382 "surface_complex_refr_index",
2384 Vector(1, surface_skin_t));
2386 out2 <<
" Sets variables to model a flat surface\n";
2387 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
2390 surface_los(0,
joker) = specular_los;
2392 surface_emission.
resize(nf, stokes_dim);
2393 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
2402 for (
Index iv = 0; iv < nf; iv++) {
2404 Complex n2(n_real(iv, 0), n_imag(iv, 0));
2411 surface_emission(iv,
joker),
2423 Matrix& surface_emission,
2425 const Index& stokes_dim,
2426 const Index& atmosphere_dim,
2429 const Vector& specular_los,
2430 const Numeric& surface_skin_t,
2431 const Tensor3& surface_reflectivity,
2444 if (surface_reflectivity.
nrows() != stokes_dim &&
2445 surface_reflectivity.
ncols() != stokes_dim) {
2447 os <<
"The number of rows and columnss in *surface_reflectivity* must\n"
2448 <<
"match *stokes_dim*."
2449 <<
"\n stokes_dim : " << stokes_dim
2450 <<
"\n number of rows in *surface_reflectivity* : "
2451 << surface_reflectivity.
nrows()
2452 <<
"\n number of columns in *surface_reflectivity* : "
2453 << surface_reflectivity.
ncols() <<
"\n";
2454 throw runtime_error(os.str());
2457 if (surface_reflectivity.
npages() != nf &&
2458 surface_reflectivity.
npages() != 1) {
2460 os <<
"The number of pages in *surface_reflectivity* should\n"
2461 <<
"match length of *f_grid* or be 1."
2462 <<
"\n length of *f_grid* : " << nf
2463 <<
"\n dimension of *surface_reflectivity* : "
2464 << surface_reflectivity.
npages() <<
"\n";
2465 throw runtime_error(os.str());
2468 out2 <<
" Sets variables to model a flat surface\n";
2471 surface_los(0,
joker) = specular_los;
2473 surface_emission.
resize(nf, stokes_dim);
2474 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
2476 Matrix R, IR(stokes_dim, stokes_dim);
2479 planck(
b, f_grid, surface_skin_t);
2483 for (
Index iv = 0; iv < nf; iv++) {
2484 if (iv == 0 || surface_reflectivity.
npages() > 1) {
2486 for (
Index i = 0; i < stokes_dim; i++) {
2487 for (
Index j = 0; j < stokes_dim; j++) {
2489 IR(i, j) = 1 - R(i, j);
2491 IR(i, j) = -R(i, j);
2500 mult(surface_emission(iv,
joker), IR, B);
2507 Matrix& surface_emission,
2509 const Index& stokes_dim,
2510 const Index& atmosphere_dim,
2513 const Vector& specular_los,
2514 const Numeric& surface_skin_t,
2515 const Matrix& surface_rv_rh,
2526 if (surface_rv_rh.
ncols() != 2) {
2528 os <<
"The number of columns in *surface_rv_rh* must be two,\n"
2529 <<
"but the actual number of columns is " << surface_rv_rh.
ncols()
2531 throw runtime_error(os.str());
2534 if (surface_rv_rh.
nrows() != nf && surface_rv_rh.
nrows() != 1) {
2536 os <<
"The number of rows in *surface_rv_rh* should\n"
2537 <<
"match length of *f_grid* or be 1."
2538 <<
"\n length of *f_grid* : " << nf
2539 <<
"\n rows in *surface_rv_rh* : " << surface_rv_rh.
nrows() <<
"\n";
2540 throw runtime_error(os.str());
2543 if (
min(surface_rv_rh) < 0 ||
max(surface_rv_rh) > 1) {
2544 throw runtime_error(
"All values in *surface_rv_rh* must be inside [0,1].");
2548 surface_los(0,
joker) = specular_los;
2550 surface_emission.
resize(nf, stokes_dim);
2551 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
2553 surface_emission = 0;
2554 surface_rmatrix = 0;
2557 planck(
b, f_grid, surface_skin_t);
2559 Numeric rmean = 0.0, rdiff = 0.0;
2561 for (
Index iv = 0; iv < nf; iv++) {
2562 if (iv == 0 || surface_rv_rh.
nrows() > 1) {
2563 rmean = 0.5 * (surface_rv_rh(iv, 0) + surface_rv_rh(iv, 1));
2564 rdiff = 0.5 * (surface_rv_rh(iv, 0) - surface_rv_rh(iv, 1));
2567 surface_emission(iv, 0) = (1.0 - rmean) *
b[iv];
2568 surface_rmatrix(0, iv, 0, 0) = rmean;
2570 if (stokes_dim > 1) {
2571 surface_emission(iv, 1) = -rdiff *
b[iv];
2573 surface_rmatrix(0, iv, 0, 1) = rdiff;
2574 surface_rmatrix(0, iv, 1, 0) = rdiff;
2575 surface_rmatrix(0, iv, 1, 1) = rmean;
2577 for (
Index i = 2; i < stokes_dim; i++) {
2578 surface_rmatrix(0, iv, i, i) = rmean;
2587 Matrix& surface_emission,
2589 const Index& stokes_dim,
2590 const Index& atmosphere_dim,
2593 const Vector& specular_los,
2594 const Numeric& surface_skin_t,
2595 const Vector& surface_scalar_reflectivity,
2606 if (surface_scalar_reflectivity.
nelem() != nf &&
2607 surface_scalar_reflectivity.
nelem() != 1) {
2609 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
2610 <<
"match length of *f_grid* or be 1."
2611 <<
"\n length of *f_grid* : " << nf
2612 <<
"\n length of *surface_scalar_reflectivity* : "
2613 << surface_scalar_reflectivity.
nelem() <<
"\n";
2614 throw runtime_error(os.str());
2617 if (
min(surface_scalar_reflectivity) < 0 ||
2618 max(surface_scalar_reflectivity) > 1) {
2619 throw runtime_error(
2620 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
2624 surface_los(0,
joker) = specular_los;
2626 surface_emission.
resize(nf, stokes_dim);
2627 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
2629 surface_emission = 0;
2630 surface_rmatrix = 0;
2633 planck(
b, f_grid, surface_skin_t);
2637 for (
Index iv = 0; iv < nf; iv++) {
2638 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
2639 r = surface_scalar_reflectivity[iv];
2642 surface_emission(iv, 0) = (1.0 - r) *
b[iv];
2643 surface_rmatrix(0, iv, 0, 0) = r;
2644 for (
Index i = 1; i < stokes_dim; i++) {
2645 surface_rmatrix(0, iv, i, i) = r;
2653 Matrix& surface_emission,
2655 const Index& stokes_dim,
2656 const Index& atmosphere_dim,
2659 const Vector& surface_normal,
2660 const Numeric& surface_skin_t,
2661 const Vector& surface_scalar_reflectivity,
2662 const Index& lambertian_nza,
2674 if (surface_scalar_reflectivity.
nelem() != nf &&
2675 surface_scalar_reflectivity.
nelem() != 1) {
2677 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
2678 <<
"match length of *f_grid* or be 1."
2679 <<
"\n length of *f_grid* : " << nf
2680 <<
"\n length of *surface_scalar_reflectivity* : "
2681 << surface_scalar_reflectivity.
nelem() <<
"\n";
2682 throw runtime_error(os.str());
2685 if (
min(surface_scalar_reflectivity) < 0 ||
2686 max(surface_scalar_reflectivity) > 1) {
2687 throw runtime_error(
2688 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
2693 surface_los.
resize(lambertian_nza, rtp_los.
nelem());
2694 surface_rmatrix.
resize(lambertian_nza, nf, stokes_dim, stokes_dim);
2695 surface_emission.
resize(nf, stokes_dim);
2698 surface_rmatrix = 0.0;
2699 surface_emission = 0.0;
2704 const Vector za_lims(0.0, lambertian_nza + 1, dza);
2707 for (
Index ip = 0; ip < lambertian_nza; ip++) {
2708 surface_los(ip, 0) = za_lims[ip] + za_pos * dza;
2709 if (atmosphere_dim == 2) {
2710 if (rtp_los[0] < 0) {
2711 surface_los(ip, 0) *= -1.0;
2714 }
else if (atmosphere_dim == 3) {
2715 surface_los(ip, 1) = rtp_los[1];
2720 planck(
b, f_grid, surface_skin_t);
2726 for (
Index iv = 0; iv < nf; iv++) {
2728 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
2729 r = surface_scalar_reflectivity[iv];
2740 for (
Index ip = 0; ip < lambertian_nza; ip++) {
2743 (cos(2 *
DEG2RAD * za_lims[ip]) - cos(2 *
DEG2RAD * za_lims[ip + 1]));
2744 surface_rmatrix(ip, iv, 0, 0) =
w;
2748 surface_emission(iv, 0) = (1 - r) *
b[iv];
2755 const Index& atmosphere_dim,
2763 Index gfield_fID = 0;
2764 Index gfield_tID = 1;
2765 Index gfield_compID = 2;
2766 Index gfield_latID = 3;
2767 Index gfield_lonID = 4;
2787 if (nlat < 2 || nlon < 2) {
2789 os <<
"The data in *complex_refr_index_field* must span a geographical "
2790 <<
"region. That is,\nthe latitude and longitude grids must have a "
2792 throw runtime_error(os.str());
2797 os <<
"The data in *complex_refr_index_field* must have exactly two "
2798 <<
"pages. One page each\nfor the real and imaginary part of the "
2799 <<
"complex refractive index.";
2800 throw runtime_error(os.str());
2809 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2817 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
2820 surface_complex_refr_index.
resize(nf, nt, 2);
2822 surface_complex_refr_index.
set_grid(
2825 surface_complex_refr_index.
set_grid(
2828 surface_complex_refr_index.
set_grid(2, {
"real",
"imaginary"});
2833 gridpos(gp_lat, GFlat, lat[0]);
2834 gridpos(gp_lon, lon_shifted, lon[0]);
2838 for (
Index iv = 0; iv < nf; iv++) {
2839 for (
Index it = 0; it < nt; it++) {
2840 surface_complex_refr_index.
data(iv, it, 0) =
interp(
2841 itw, complex_n_field.
data(iv, it, 0,
joker,
joker), gp_lat, gp_lon);
2842 surface_complex_refr_index.
data(iv, it, 1) =
interp(
2843 itw, complex_n_field.
data(iv, it, 1,
joker,
joker), gp_lat, gp_lon);
2850 const Index& stokes_dim,
2852 const Index& atmosphere_dim,
2881 if (nlat < 2 || nlon < 2) {
2883 os <<
"The data in *r_field* must span a geographical region. That is,\n"
2884 <<
"the latitude and longitude grids must have a length >= 2.";
2885 throw runtime_error(os.str());
2890 os <<
"The data in *r_field* must span a range of zenith angles. That\n"
2891 <<
"is the zenith angle grid must have a length >= 2.";
2892 throw runtime_error(os.str());
2894 if (ns1 < stokes_dim || ns2 < stokes_dim || ns1 > 4 || ns2 > 4) {
2896 os <<
"The \"Stokes dimensions\" must have a size that is >= "
2897 <<
"*stokes_dim* (but not exceeding 4).";
2898 throw runtime_error(os.str());
2904 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2911 Tensor4 r_f_za(nf_in, stokes_dim, stokes_dim, nza);
2918 gridpos(gp_lon, lon_shifted, lon[0]);
2921 for (
Index iv = 0; iv < nf_in; iv++) {
2922 for (
Index iz = 0; iz < nza; iz++) {
2923 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2924 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2925 r_f_za(iv, is1, is2, iz) =
2937 Tensor3 r_f(nf_in, stokes_dim, stokes_dim);
2944 "Incidence angle interpolation", r_field.
get_numeric_grid(3), 180 - rtp_los[0]);
2948 for (
Index i = 0; i < nf_in; i++) {
2949 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2950 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2951 r_f(i, is1, is2) =
interp(r_f_za(i, is1, is2,
joker), itw, lag);
2960 surface_reflectivity = r_f;
2965 surface_reflectivity.
resize(nf_out, stokes_dim, stokes_dim);
2971 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2972 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2975 r_f(
joker, is1, is2),
2984 Vector& surface_scalar_reflectivity,
2985 const Index& stokes_dim,
2987 const Index& atmosphere_dim,
3012 if (nlat < 2 || nlon < 2) {
3014 os <<
"The data in *r_field* must span a geographical region. That is,\n"
3015 <<
"the latitude and longitude grids must have a length >= 2.";
3016 throw runtime_error(os.str());
3021 os <<
"The data in *r_field* must span a range of zenith angles. That\n"
3022 <<
"is the zenith angle grid must have a length >= 2.";
3023 throw runtime_error(os.str());
3029 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
3036 Matrix r_f_za(nf_in, nza);
3043 gridpos(gp_lon, lon_shifted, lon[0]);
3046 for (
Index iv = 0; iv < nf_in; iv++) {
3047 for (
Index iz = 0; iz < nza; iz++) {
3062 "Incidence angle interpolation", r_field.
get_numeric_grid(1), 180 - rtp_los[0]);
3065 for (
Index i = 0; i < nf_in; i++) {
3073 surface_scalar_reflectivity.
resize(1);
3074 surface_scalar_reflectivity[0] = r_f[0];
3079 surface_scalar_reflectivity.
resize(nf_out);
3085 interp(surface_scalar_reflectivity, itw, r_f, gp);
3091 Vector& surface_scalar_reflectivity,
3092 const Tensor4& surface_rmatrix,
3097 surface_scalar_reflectivity.
resize(nf);
3098 surface_scalar_reflectivity = 0;
3100 for (
Index i = 0; i < nf; i++) {
3101 for (
Index l = 0; l < nlos; l++) {
3102 surface_scalar_reflectivity[i] += surface_rmatrix(l, i, 0, 0);
3109 const Index& atmosphere_dim,
3117 Index gfield_latID = 0;
3118 Index gfield_lonID = 1;
3132 if (nlat < 2 || nlon < 2) {
3134 os <<
"The data in *surface_type_mask* must span a geographical "
3135 <<
"region. Accordingly,\nthe latitude and longitude grids must "
3136 <<
"both have a length >= 2.";
3137 throw runtime_error(os.str());
3146 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
3154 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
3158 gridpos(gp_lat, GFlat, lat[0]);
3159 gridpos(gp_lon, lon_shifted, lon[0]);
3163 if (gp_lat.
fd[0] < 0.5) {
3166 ilat = gp_lat.
idx + 1;
3168 if (gp_lon.
fd[0] < 0.5) {
3171 ilon = gp_lon.
idx + 1;
3173 surface_type = (
Index)round(surface_type_mask.
data(ilat, ilon));
3179 Vector& surface_type_mix,
3183 Matrix& surface_emission,
3185 const Index& stokes_dim,
3186 const Index& atmosphere_dim,
3193 const Vector& refellipsoid,
3198 const Vector& dlos_weight_vector,
3204 Vector sat_pos = rtp_pos;
3205 Vector sat_los = rtp_los;
3218 const Index ntypes = surface_rtprop_agenda_array.
nelem();
3222 Matrix ground_pos, ground_los, sensor_pos(nlos, 3), sensor_los;
3224 sensor_pos(
joker, 0) = sat_pos[0];
3225 sensor_pos(
joker, 1) = sat_pos[1];
3226 sensor_pos(
joker, 2) = sat_pos[2];
3240 surface_type_mix.
resize(ntypes);
3241 surface_type_mix = 0.;
3242 surface_skin_t = 0.;
3245 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
3246 surface_rmatrix = 0.;
3247 surface_emission.
resize(nf, stokes_dim);
3248 surface_emission = 0.;
3251 const Numeric weight_sum = dlos_weight_vector.
sum();
3254 Matrix tmp_emission, tmp_los;
3258 for (
Index i=0; i<nlos; ++i) {
3270 ground_pos(i,
joker),
3271 ground_los(i,
joker),
3273 surface_rtprop_agenda_array,
3276 "This method requires that all surface types "
3277 "returns a *surface_los* with one row.");
3280 const Numeric weight = dlos_weight_vector[i] / weight_sum;
3281 tmp_type_mix *= weight;
3282 surface_type_mix += tmp_type_mix;
3283 surface_skin_t += weight * tmp_skin_t;
3285 surface_los += tmp_los;
3286 tmp_rmatrix *= weight;
3287 surface_rmatrix += tmp_rmatrix;
3288 tmp_emission *= weight;
3289 surface_emission += tmp_emission;
3295 Vector& surface_type_mix,
3299 Matrix& surface_emission,
3304 const Index& surface_type,
3308 surface_type >= surface_rtprop_agenda_array.
nelem(),
3309 "Provided surface type index invalid (<0 or too high w.r.t. "
3310 "length of *surface_rtprop_agenda_array*).");
3312 surface_type_mix.
resize(surface_rtprop_agenda_array.
nelem());
3313 surface_type_mix = 0.0;
3314 surface_type_mix[surface_type] = 1.0;
3325 surface_rtprop_agenda_array);
3330 Vector& surface_type_mix,
3334 Matrix& surface_emission,
3336 const Index& atmosphere_dim,
3356 surface_type >= surface_rtprop_agenda_array.
nelem(),
3357 "Interpolation gave invalid surface type index (<0 or too "
3358 "high w.f.t. length of *surface_rtprop_agenda_array*).");
3360 surface_type_mix.
resize(surface_rtprop_agenda_array.
nelem());
3361 surface_type_mix = 0.0;
3362 surface_type_mix[surface_type] = 1.0;
3373 surface_rtprop_agenda_array);
3379 Matrix& surface_emission,
3389 "Different number of frequencies in *f_grid* and *surface_emission*.");
3391 "Different number of frequencies in *f_grid* and *surface_rmatrix*.");
3393 "Different number of Stokes elements in *surface_emission* and *surface_rmatrix*.");
3403 Tensor4 rmatrix = surface_rmatrix;
3404 Matrix emission = surface_emission;
3405 surface_rmatrix.
resize(nlos, nnew, ns, ns);
3406 surface_emission.
resize(nnew, ns);
3408 for (
Index is = 0; is < ns; ++is) {
3410 for (
Index il = 0; il < nlos; ++il) {
3411 for (
Index is2 = 0; is2 < ns; ++is2) {
3414 rmatrix(il,
joker, is, is2),
3426 Matrix& surface_emission,
3428 const Index& stokes_dim,
3429 const Index& atmosphere_dim,
3435 const Tensor3& surface_props_data,
3438 const Index& jacobian_do,
3445 surface_props_names);
3451 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
3463 surface_props_names);
3476 surface_rmatrix.
resize(1, f_grid.
nelem(), stokes_dim, stokes_dim);
3477 surface_rmatrix = 0.0;
3483 dsurface_rmatrix_dx,
3484 dsurface_emission_dx);
3493 dsurface_emission_dx[irq] = dbdt;
3494 dsurface_rmatrix_dx[irq].resize(surface_rmatrix.
nbooks(),
3495 surface_rmatrix.
npages(),
3496 surface_rmatrix.
nrows(),
3497 surface_rmatrix.
ncols());
3498 dsurface_rmatrix_dx[irq] = 0;
3506 const Index& atmosphere_dim,
3509 const Tensor3& surface_props_data,
3512 const Index& jacobian_do,
3514 if (surface_props_names.
nelem())
3515 throw runtime_error(
3516 "When calling this method, *surface_props_names* should be empty.");
3522 surface_props_names);
3527 dsurface_rmatrix_dx,
3528 dsurface_emission_dx);
3536 Matrix& surface_emission,
3538 const Index& stokes_dim,
3539 const Index& atmosphere_dim,
3545 const Tensor3& surface_props_data,
3548 const Index& jacobian_do,
3549 const Vector& transmittance,
3550 const Index& fastem_version,
3557 surface_props_names);
3563 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
3569 "Water skin temperature",
3575 surface_props_names);
3586 surface_props_names);
3589 Vector wind_direction(1);
3597 surface_props_names);
3608 surface_props_names);
3631 dsurface_rmatrix_dx,
3632 dsurface_emission_dx);
3642 dsurface_rmatrix_dx[irq],
3643 dsurface_emission_dx[irq],
3657 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3658 dsurface_rmatrix_dx[irq] /= dd;
3659 dsurface_emission_dx[irq] -= surface_emission;
3660 dsurface_emission_dx[irq] /= dd;
3669 dsurface_rmatrix_dx[irq],
3670 dsurface_emission_dx[irq],
3684 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3685 dsurface_rmatrix_dx[irq] /= dd;
3686 dsurface_emission_dx[irq] -= surface_emission;
3687 dsurface_emission_dx[irq] /= dd;
3696 dsurface_rmatrix_dx[irq],
3697 dsurface_emission_dx[irq],
3706 wind_direction[0] + dd,
3711 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3712 dsurface_rmatrix_dx[irq] /= dd;
3713 dsurface_emission_dx[irq] -= surface_emission;
3714 dsurface_emission_dx[irq] /= dd;
3723 dsurface_rmatrix_dx[irq],
3724 dsurface_emission_dx[irq],
3738 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3739 dsurface_rmatrix_dx[irq] /= dd;
3740 dsurface_emission_dx[irq] -= surface_emission;
3741 dsurface_emission_dx[irq] /= dd;
3751 Matrix& surface_emission,
3753 const Index& stokes_dim,
3754 const Index& atmosphere_dim,
3760 const Vector& specular_los,
3761 const Tensor3& surface_props_data,
3764 const Index& jacobian_do,
3765 const Vector& f_reflectivities,
3772 surface_props_names);
3785 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
3789 Vector surface_skin_t(1);
3797 surface_props_names);
3800 Vector reflectivities(nr);
3802 for (
Index i=0; i<nr; i++) {
3805 sstr <<
"Scalar reflectivity " << i;
3813 surface_props_names);
3814 reflectivities[i] = rv[0];
3818 Vector surface_scalar_reflectivity(nf);
3823 gridpos(gp, f_reflectivities, f_grid, 1e99);
3828 interp( surface_scalar_reflectivity, itw2, reflectivities, gp);
3841 surface_scalar_reflectivity,
3848 dsurface_rmatrix_dx,
3849 dsurface_emission_dx);
3859 dsurface_rmatrix_dx[irq],
3860 dsurface_emission_dx[irq],
3867 surface_skin_t[0]+dd,
3868 surface_scalar_reflectivity,
3870 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3871 dsurface_rmatrix_dx[irq] /= dd;
3872 dsurface_emission_dx[irq] -= surface_emission;
3873 dsurface_emission_dx[irq] /= dd;
3877 for (
Index i=0; i<nr; i++) {
3879 sstr <<
"Scalar reflectivity " << i;
3883 Vector rpert = reflectivities;
3885 interp( surface_scalar_reflectivity, itw2, rpert, gp);
3889 dsurface_rmatrix_dx[irq],
3890 dsurface_emission_dx[irq],
3898 surface_scalar_reflectivity,
3900 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3901 dsurface_rmatrix_dx[irq] /= dd;
3902 dsurface_emission_dx[irq] -= surface_emission;
3903 dsurface_emission_dx[irq] /= dd;
3913 Matrix& surface_emission,
3915 const Index& stokes_dim,
3916 const Index& atmosphere_dim,
3924 const Tensor3& surface_props_data,
3927 const Index& jacobian_do,
3934 surface_props_names);
3940 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
3946 "Water skin temperature",
3952 surface_props_names);
3963 surface_props_names);
3974 surface_props_names);
3996 dsurface_rmatrix_dx,
3997 dsurface_emission_dx);
4007 dsurface_rmatrix_dx[irq],
4008 dsurface_emission_dx[irq],
4021 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
4022 dsurface_rmatrix_dx[irq] /= dd;
4023 dsurface_emission_dx[irq] -= surface_emission;
4024 dsurface_emission_dx[irq] /= dd;
4033 dsurface_rmatrix_dx[irq],
4034 dsurface_emission_dx[irq],
4047 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
4048 dsurface_rmatrix_dx[irq] /= dd;
4049 dsurface_emission_dx[irq] -= surface_emission;
4050 dsurface_emission_dx[irq] /= dd;
4059 dsurface_rmatrix_dx[irq],
4060 dsurface_emission_dx[irq],
4073 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
4074 dsurface_rmatrix_dx[irq] /= dd;
4075 dsurface_emission_dx[irq] -= surface_emission;
4076 dsurface_emission_dx[irq] /= dd;
4088 for (
Index i = 0; i < iy_aux_vars.
nelem(); i++) {
4089 if (iy_aux_vars[i] ==
"Optical depth") {
4096 throw runtime_error(
"No element in *iy_aux* holds optical depths.");
4098 const Index n = iy_aux[ihit].nrows();
4102 for (
Index i = 0; i < n; i++) {
4103 transmittance[i] = exp(-iy_aux[ihit](i, 0));
This file contains the definition of Array.
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
The global header file for ARTS.
Constants of physical expressions as constexpr.
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, Vector &geo_pos, const Index iy_agenda_call1, const Tensor3 &iy_transmittance, const ArrayOfString &iy_aux_vars, const Index iy_id, const String &iy_unit, const Index cloudbox_on, const Index jacobian_do, const Vector &f_grid, const EnergyLevelMap &nlte_field, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Agenda &input_agenda)
void surface_rtprop_agenda_arrayExecute(Workspace &ws, Numeric &surface_skin_t, Matrix &surface_emission, Matrix &surface_los, Tensor4 &surface_rmatrix, const Index agenda_array_index, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const ArrayOfAgenda &input_agenda_array)
void surface_rtprop_agendaExecute(Workspace &ws, Numeric &surface_skin_t, Matrix &surface_emission, Matrix &surface_los, Tensor4 &surface_rmatrix, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
String name() const
Agenda name.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
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 ncols() const noexcept
Index nrows() const noexcept
Index nbooks() const noexcept
Index npages() const noexcept
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nbooks() const noexcept
Index nshelves() const noexcept
Index nbooks() const noexcept
Index nvitrines() const noexcept
Index ncols() const noexcept
Index npages() const noexcept
Index nshelves() const noexcept
Index nrows() const noexcept
Numeric sum() const ARTS_NOEXCEPT
The sum of all elements of a Vector.
Index nelem() const noexcept
Returns the number of elements.
void checksize_strict() const final
Strict consistency check.
void resize(const GriddedField3 &gf)
Make this GriddedField3 the same size as the given one.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void set_grid_name(Index i, const String &s)
Set grid name.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
void resize(Index r, Index c)
Resize function.
Index calc_cellnum(Numeric lat, Numeric lon) const
bool contains(Index cellnumber) const
Index get_class2(Index cellnumber) const
Index calc_cellnum_nearest_neighbor(Numeric lat, Numeric lon) const
Vector get_emis_h(Index cellnum) const
std::pair< Numeric, Numeric > get_coordinates(Index cellnum) const
Index get_class1(Index cellnumber) const
std::pair< Numeric, Numeric > emis_interp(Numeric theta, Numeric freq, Index class1, Index class2, const ConstVectorView &ev, const ConstVectorView &eh) const
Vector get_emis_v(Index i) const
void resize(Index p, Index r, Index c)
Resize function.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index n)
Resize function.
void mult(MatrixView C, ConstMatrixView A, const Block &B)
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR_IF(condition,...)
void fastem(Vector &emissivity, Vector &reflectivity, const Numeric frequency, const Numeric za, const Numeric temperature, const Numeric salinity, const Numeric wind_speed, const Numeric transmittance, const Numeric rel_azimuth, const Index fastem_version)
Calculate the surface emissivity using FASTEM.
This file contains functions that are adapted from FASTEM code which is used to calculate surface emi...
Header file for functions related to gas scattering.
Numeric sphdist(const Numeric &lat1, const Numeric &lon1, const Numeric &lat2, const Numeric &lon2)
sphdist
void lon_shiftgrid(Vector &longrid_out, ConstVectorView longrid_in, const Numeric lon)
lon_shiftgrid
Numeric refell2d(ConstVectorView refellipsoid, ConstVectorView lat_grid, const GridPos gp)
refell2d
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.
void gp4length1grid(ArrayOfGridPos &gp)
Grid position matching a grid of length 1.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
Header file for interpolation.cc.
void diy_from_pos_to_rgrids(Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstMatrixView diy_dpos, const Index &atmosphere_dim, ConstVectorView rtp_pos)
diy_from_pos_to_rgrids
void jacobian_type_extrapol(ArrayOfGridPos &gp)
Adopts grid positions to extrapolation used for jacobians.
void AngularGridsSetFluxCalc(Vector &za_grid, Vector &aa_grid, Vector &za_grid_weights, const Index &N_za_grid, const Index &N_aa_grid, const String &za_grid_type, const Verbosity &)
WORKSPACE METHOD: AngularGridsSetFluxCalc.
void IntersectionGeometricalWithAltitude(Matrix &pos, Matrix &los, const Matrix &sensor_pos, const Matrix &sensor_los, const Vector &refellipsoid, const Vector &lat_grid, const Vector &lon_grid, const Numeric &altitude, const Verbosity &)
WORKSPACE METHOD: IntersectionGeometricalWithAltitude.
void losAddLosAndDlos(Matrix &new_los, const Vector &ref_los, const Matrix &dlos, const Verbosity &)
WORKSPACE METHOD: losAddLosAndDlos.
void rte_pos_losBackwardToAltitude(Vector &rte_pos, Vector &rte_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Numeric &altitude, const Index &los_is_reversed, const Verbosity &verbosity)
WORKSPACE METHOD: rte_pos_losBackwardToAltitude.
void surfaceTelsem(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Index &atmosphere_dim, const Index &stokes_dim, const Vector &f_grid, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Numeric &surface_skin_t, const TelsemAtlas &atlas, const Numeric &r_min, const Numeric &r_max, const Numeric &d_max, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceTelsem.
void surface_scalar_reflectivityFromGriddedField4(Vector &surface_scalar_reflectivity, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const Vector &rtp_los, const GriddedField4 &r_field, const Verbosity &)
WORKSPACE METHOD: surface_scalar_reflectivityFromGriddedField4.
void surface_complex_refr_indexFromGriddedField5(GriddedField3 &surface_complex_refr_index, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const GriddedField5 &complex_n_field, const Verbosity &)
WORKSPACE METHOD: surface_complex_refr_indexFromGriddedField5.
void InterpSurfaceFieldToPosition(Numeric &outvalue, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &rtp_pos, const Matrix &z_surface, const Matrix &field, const Verbosity &verbosity)
WORKSPACE METHOD: InterpSurfaceFieldToPosition.
void surfaceTessem(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Index &atmosphere_dim, const Index &stokes_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Numeric &surface_skin_t, const TessemNN &net_h, const TessemNN &net_v, const Numeric &salinity, const Numeric &wind_speed, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceTessem.
constexpr Numeric EARTH_RADIUS
void specular_losCalc(Vector &specular_los, Vector &surface_normal, const Vector &rtp_pos, const Vector &rtp_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &ignore_surface_slope, const Verbosity &verbosity)
WORKSPACE METHOD: specular_losCalc.
constexpr Numeric DEG2RAD
void surfaceFastem(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Index &atmosphere_dim, const Index &stokes_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Numeric &surface_skin_t, const Numeric &salinity, const Numeric &wind_speed, const Numeric &wind_direction, const Vector &transmittance, const Index &fastem_version, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceFastem.
void surfaceMapToLinearPolarisation(Matrix &surface_emission, Tensor4 &surface_rmatrix, const Index &stokes_dim, const Numeric &pol_angle, const Verbosity &)
WORKSPACE METHOD: surfaceMapToLinearPolarisation.
void surfaceFlatRefractiveIndex(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Numeric &surface_skin_t, const GriddedField3 &surface_complex_refr_index, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceFlatRefractiveIndex.
void surface_rtpropFromTypesNearest(Workspace &ws, Vector &surface_type_mix, Numeric &surface_skin_t, Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const Vector &rtp_los, const GriddedField2 &surface_type_mask, const ArrayOfAgenda &surface_rtprop_agenda_array, const Verbosity &verbosity)
WORKSPACE METHOD: surface_rtpropFromTypesNearest.
void SurfaceBlackbody(Matrix &surface_los, Tensor4 &surface_rmatrix, ArrayOfTensor4 &dsurface_rmatrix_dx, Matrix &surface_emission, ArrayOfMatrix &dsurface_emission_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const Index &jacobian_do, const Verbosity &verbosity)
WORKSPACE METHOD: SurfaceBlackbody.
void surface_rtpropInterpFreq(Vector &f_grid, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_new, const Verbosity &)
WORKSPACE METHOD: surface_rtpropInterpFreq.
void specular_losCalcNoTopography(Vector &specular_los, Vector &surface_normal, const Vector &rtp_pos, const Vector &rtp_los, const Index &atmosphere_dim, const Verbosity &)
WORKSPACE METHOD: specular_losCalcNoTopography.
void iySurfaceFlatRefractiveIndex(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, ArrayOfTensor4 &dsurface_rmatrix_dx, ArrayOfMatrix &dsurface_emission_dx, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &suns_do, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &lat_grid, const Vector &lon_grid, const Matrix &z_surface, const Vector &refellipsoid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const GriddedField3 &surface_complex_refr_index, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &iy_main_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceFlatRefractiveIndex.
void iySurfaceLambertian(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &suns_do, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &lat_grid, const Vector &lon_grid, const Matrix &z_surface, const Vector &refellipsoid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const Vector &surface_scalar_reflectivity, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &iy_main_agenda, const Index &N_za, const Index &N_aa, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceLambertian.
void surfaceBlackbody(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Index &atmosphere_dim, const Vector &f_grid, const Index &stokes_dim, const Vector &rtp_pos, const Vector &rtp_los, const Numeric &surface_skin_t, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceBlackbody.
void InterpSurfaceTypeMask(Index &surface_type, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const GriddedField2 &surface_type_mask, const Verbosity &)
WORKSPACE METHOD: InterpSurfaceTypeMask.
void SurfaceFastem(Matrix &surface_los, Tensor4 &surface_rmatrix, ArrayOfTensor4 &dsurface_rmatrix_dx, Matrix &surface_emission, ArrayOfMatrix &dsurface_emission_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const Index &jacobian_do, const Vector &transmittance, const Index &fastem_version, const Verbosity &verbosity)
WORKSPACE METHOD: SurfaceFastem.
void iySurfaceRtpropAgenda(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, Numeric &surface_skin_t, Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &suns_do, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const Agenda &iy_main_agenda, const Agenda &surface_rtprop_agenda, const Verbosity &)
WORKSPACE METHOD: iySurfaceRtpropAgenda.
void surfaceFlatScalarReflectivity(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Numeric &surface_skin_t, const Vector &surface_scalar_reflectivity, const Verbosity &)
WORKSPACE METHOD: surfaceFlatScalarReflectivity.
void surface_reflectivityFromGriddedField6(Tensor3 &surface_reflectivity, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const Vector &rtp_los, const GriddedField6 &r_field, const Verbosity &)
WORKSPACE METHOD: surface_reflectivityFromGriddedField6.
void surfaceFlatReflectivity(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Numeric &surface_skin_t, const Tensor3 &surface_reflectivity, const Verbosity &verbosity)
WORKSPACE METHOD: surfaceFlatReflectivity.
void surfaceFlatRvRh(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Numeric &surface_skin_t, const Matrix &surface_rv_rh, const Verbosity &)
WORKSPACE METHOD: surfaceFlatRvRh.
void surface_rtpropFromTypesAverage(Workspace &ws, Vector &surface_type_mix, Numeric &surface_skin_t, Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const Vector &rtp_los, const Vector &refellipsoid, const GriddedField2 &surface_type_mask, const ArrayOfAgenda &surface_rtprop_agenda_array, const Numeric &z_sensor, const Matrix &dlos, const Vector &dlos_weight_vector, const Verbosity &verbosity)
WORKSPACE METHOD: surface_rtpropFromTypesAverage.
void iySurfaceLambertianDirect(Workspace &ws, Matrix &iy, const Vector &rtp_pos, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Matrix &z_surface, const Vector &surface_scalar_reflectivity, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &suns_do, const Index &gas_scattering_do, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSun &suns, const Numeric &rte_alonglos_v, const String &iy_unit, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceLambertianDirect.
void transmittanceFromIy_aux(Vector &transmittance, const ArrayOfString &iy_aux_vars, const ArrayOfMatrix &iy_aux, const Verbosity &)
WORKSPACE METHOD: transmittanceFromIy_aux.
void iySurfaceFlatReflectivity(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, ArrayOfTensor4 &dsurface_rmatrix_dx, ArrayOfMatrix &dsurface_emission_dx, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &suns_do, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &lat_grid, const Vector &lon_grid, const Matrix &z_surface, const Vector &refellipsoid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const Tensor3 &surface_reflectivity, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &iy_main_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceFlatReflectivity.
void surfaceLambertianSimple(Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Vector &surface_normal, const Numeric &surface_skin_t, const Vector &surface_scalar_reflectivity, const Index &lambertian_nza, const Numeric &za_pos, const Verbosity &)
WORKSPACE METHOD: surfaceLambertianSimple.
void iySurfaceFastem(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const Agenda &iy_main_agenda, const Numeric &surface_skin_t, const Numeric &salinity, const Numeric &wind_speed, const Numeric &wind_direction, const Index &fastem_version, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceFastem.
void surface_scalar_reflectivityFromSurface_rmatrix(Vector &surface_scalar_reflectivity, const Tensor4 &surface_rmatrix, const Verbosity &)
WORKSPACE METHOD: surface_scalar_reflectivityFromSurface_rmatrix.
void iySurfaceRtpropCalc(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Matrix &surface_los, const Tensor4 &surface_rmatrix, const Matrix &surface_emission, const ArrayOfString &dsurface_names, const ArrayOfTensor4 &dsurface_rmatrix_dx, const ArrayOfMatrix &dsurface_emission_dx, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &jacobian_do, const Index &suns_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &atmosphere_dim, const EnergyLevelMap &nlte_field, const Index &cloudbox_on, const Index &stokes_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const String &iy_unit, const Agenda &iy_main_agenda, const Verbosity &)
WORKSPACE METHOD: iySurfaceRtpropCalc.
void SurfaceTessem(Matrix &surface_los, Tensor4 &surface_rmatrix, ArrayOfTensor4 &dsurface_rmatrix_dx, Matrix &surface_emission, ArrayOfMatrix &dsurface_emission_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const TessemNN &net_h, const TessemNN &net_v, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const Index &jacobian_do, const Verbosity &verbosity)
WORKSPACE METHOD: SurfaceTessem.
void SurfaceDummy(ArrayOfTensor4 &dsurface_rmatrix_dx, ArrayOfMatrix &dsurface_emission_dx, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const Index &jacobian_do, const Verbosity &)
WORKSPACE METHOD: SurfaceDummy.
void surface_rtpropFromTypesManual(Workspace &ws, Vector &surface_type_mix, Numeric &surface_skin_t, Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const ArrayOfAgenda &surface_rtprop_agenda_array, const Index &surface_type, const Verbosity &)
WORKSPACE METHOD: surface_rtpropFromTypesManual.
void iySurfaceInit(Matrix &iy, const Vector &f_grid, const Index &stokes_dim, const Verbosity &)
WORKSPACE METHOD: iySurfaceInit.
void iySurfaceFlatReflectivityDirect(Workspace &ws, Matrix &iy, const Vector &rtp_pos, const Vector &rtp_los, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Matrix &z_surface, const Tensor3 &surface_reflectivity, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &ppath_inside_cloudbox_do, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &suns_do, const Index &gas_scattering_do, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSun &suns, const Numeric &rte_alonglos_v, const String &iy_unit, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceFlatReflectivityDirect.
void InterpGriddedField2ToPosition(Numeric &outvalue, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lat_true, const Vector &lon_true, const Vector &rtp_pos, const GriddedField2 &gfield2, const Verbosity &)
WORKSPACE METHOD: InterpGriddedField2ToPosition.
void iySurfaceFlatRefractiveIndexDirect(Workspace &ws, Matrix &iy, const Vector &rtp_pos, const Vector &rtp_los, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Matrix &z_surface, const GriddedField3 &surface_complex_refr_index, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &ppath_inside_cloudbox_do, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &suns_do, const Index &gas_scattering_do, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSun &suns, const Numeric &rte_alonglos_v, const String &iy_unit, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: iySurfaceFlatRefractiveIndexDirect.
void FastemStandAlone(Matrix &emissivity, Matrix &reflectivity, const Vector &f_grid, const Numeric &surface_skin_t, const Numeric &za, const Numeric &salinity, const Numeric &wind_speed, const Numeric &rel_aa, const Vector &transmittance, const Index &fastem_version, const Verbosity &)
WORKSPACE METHOD: FastemStandAlone.
void SurfaceFlatScalarReflectivity(Matrix &surface_los, Tensor4 &surface_rmatrix, ArrayOfTensor4 &dsurface_rmatrix_dx, Matrix &surface_emission, ArrayOfMatrix &dsurface_emission_dx, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &specular_los, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const Index &jacobian_do, const Vector &f_reflectivities, const Verbosity &verbosity)
WORKSPACE METHOD: SurfaceFlatScalarReflectivity.
Numeric fac(const Index n)
fac
Numeric sign(const Numeric &x)
sign
void calculate_int_weights_arbitrary_grid(Vector &w, const Vector &x)
Calculates trapezoidal integration weights for arbitray grid.
void abs(Sparse &A, const Sparse &B)
Absolute value of sparse matrix elements.
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b) ARTS_NOEXCEPT
cross3
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
std::complex< Numeric > Complex
Declarations having to do with the four output streams.
my_basic_string< char > String
The String type for ARTS.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric earth_radius
Global constant, the radius of the Earth [m].
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
Numeric planck(const Numeric &f, const Numeric &t)
planck
Numeric dplanck_dt(const Numeric &f, const Numeric &t)
dplanck_dt
void fresnel(Complex &Rv, Complex &Rh, const Complex &n1, const Complex &n2, const Numeric &theta)
fresnel
This file contains declerations of functions of physical character.
void zaaa2cart(Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
Converts zenith and azimuth angles to a cartesian unit vector.
void cart2zaaa(Numeric &za, Numeric &aa, const Numeric &dx, const Numeric &dy, const Numeric &dz)
Converts a cartesian directional vector to zenith and azimuth.
void plevel_slope_3d(Numeric &c1, Numeric &c2, const Numeric &lat1, const Numeric &lat3, const Numeric &lon5, const Numeric &lon6, const Numeric &r15, const Numeric &r35, const Numeric &r36, const Numeric &r16, const Numeric &lat, const Numeric &lon, const Numeric &aa)
void resolve_lon(Numeric &lon, const Numeric &lon5, const Numeric &lon6)
Resolves which longitude angle that shall be used.
Numeric plevel_angletilt(const Numeric &r, const Numeric &c1)
Calculates the angular tilt of the surface or a pressure level.
void plevel_slope_2d(Numeric &c1, ConstVectorView lat_grid, ConstVectorView refellipsoid, ConstVectorView z_surf, const GridPos &gp, const Numeric &za)
Calculates the radial slope of the surface or a pressure level for 2D.
Propagation path structure and functions.
Numeric pow(const Rational base, Numeric exp)
Power of.
void mueller_stokes2modif(Matrix &Cm, const Index &stokes_dim)
mueller_stokes2modif
void pos2true_latlon(Numeric &lat, Numeric &lon, const Index &atmosphere_dim, const ConstVectorView &lat_grid, const ConstVectorView &lat_true, const ConstVectorView &lon_true, const ConstVectorView &pos)
Determines the true alt and lon for an "ARTS position".
void iy_transmittance_mult(Tensor3 &iy_trans_total, const ConstTensor3View &iy_trans_old, const ConstTensor3View &iy_trans_new)
Multiplicates iy_transmittance with transmissions.
void mueller_modif2stokes(Matrix &Cs, const Index &stokes_dim)
mueller_modif2stokes
void mueller_rotation(Matrix &L, const Index &stokes_dim, const Numeric &rotangle)
mueller_rotation
void mirror_los(Vector &los_mirrored, const ConstVectorView &los, const Index &atmosphere_dim)
Determines the backward direction for a given line-of-sight.
Declaration of functions in rte.cc.
void complex_n_interp(MatrixView n_real, MatrixView n_imag, const GriddedField3 &complex_n, const String &varname, ConstVectorView f_grid, ConstVectorView t_grid)
General function for interpolating data of complex n type.
void interp_atmsurface_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of a surface-type variable.
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 interp_atmsurface_by_gp(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates a surface-type variable given the grid positions.
Header file for special_interp.cc.
Structure to store a grid position.
std::array< Numeric, 2 > fd
A Lagrange interpolation computer.
The structure to describe a propagation path and releated quantities.
void get_direct_radiation(Workspace &ws, ArrayOfMatrix &direct_radiation, ArrayOfArrayOfTensor3 &ddirect_radiation_dx, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Index &irradiance_flag, const ArrayOfPpath &sun_ppaths, const ArrayOfSun &suns, const ArrayOfIndex &suns_visible, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Numeric &rte_alonglos_v, const Verbosity &verbosity)
Calculates the transmitted sun radiation at the end position of the ppath.
void get_sun_ppaths(Workspace &ws, ArrayOfPpath &sun_ppaths, ArrayOfIndex &suns_visible, ArrayOfVector &sun_rte_los, const Vector &rte_pos, const ArrayOfSun &suns, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &z_surface, const Vector &refellipsoid, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
Calculates the ppath towards the suns from a given position and indicates if sun is visible or not.
void surface_get_incoming_direct(Workspace &ws, Matrix &iy_incoming, Index &stars_visible, Vector &specular_los, const Vector &rtp_pos, const Vector &rtp_los, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Matrix &z_surface, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Index &ppath_inside_cloudbox_do, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfSun &suns, const Numeric &rte_alonglos_v, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
Calculate the incoming direct radiation at the surface for a given line of sight.
void dsurface_check(const ArrayOfString &surface_props_names, const ArrayOfString &dsurface_names, const ArrayOfTensor4 dsurface_rmatrix_dx, const ArrayOfMatrix &dsurface_emission_dx)
Peforms basic checks of the dsurface variables.
void surface_calc(Matrix &iy, ConstTensor3View I, ConstMatrixView surface_los, ConstTensor4View surface_rmatrix, ConstMatrixView surface_emission)
Weights together downwelling radiation and surface emission.
void surface_props_check(const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names)
Peforms basic checks of surface_props_data and surface_props_names
Numeric calc_incang(ConstVectorView rte_los, ConstVectorView specular_los)
Calculates the incidence angle for a flat surface, based on rte_los and specular_los.
void surface_props_interp(Vector &v, const String &vname, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, const Matrix &itw, const Tensor3 &surface_props_data, const ArrayOfString &surface_props_names)
Peforms an interpolation of surface_props_data
void surface_specular_R_and_b(MatrixView surface_rmatrix, VectorView surface_emission, const Complex &Rv, const Complex &Rh, const Numeric &f, const Index &stokes_dim, const Numeric &surface_skin_t)
Sets up the surface reflection matrix and emission vector for the case of specular reflection.
void tessem_prop_nn(VectorView &ny, const TessemNN &net, ConstVectorView nx)
This file contains functions that are adapted from TESSEM code which is used to calculate surface emi...