74 const Vector& transmittance,
75 const Index& fastem_version,
85 if (fastem_version < 3 || fastem_version > 6)
86 throw std::runtime_error(
87 "Invalid fastem version: 3 <= fastem_version <= 6");
90 reflectivity.
resize(nf, 4);
94 for (
Index i = 0; i < nf; i++) {
95 if (f_grid[i] > 250e9)
96 throw std::runtime_error(
"Only frequency <= 250 GHz are allowed");
112 emissivity(i,
joker) = e;
113 reflectivity(i,
joker) = r;
118 for (
Index i = 0; i < nf; i++) {
119 for (
Index s = 0; s < 2; s++) {
120 if (emissivity(i, s) > 1) {
121 emissivity(i, s) = 1;
122 reflectivity(i, s) = 0;
124 if (emissivity(i, s) < 0) {
125 emissivity(i, s) = 0;
126 reflectivity(i, s) = 1;
128 if (reflectivity(i, s) > 1) {
129 emissivity(i, s) = 0;
130 reflectivity(i, s) = 1;
132 if (reflectivity(i, s) < 0) {
133 emissivity(i, s) = 1;
134 reflectivity(i, s) = 0;
142 const Index& atmosphere_dim,
150 Index gfield_latID = 0;
151 Index gfield_lonID = 1;
165 if (nlat < 2 || nlon < 2) {
167 os <<
"The data in *gfield2* must span a geographical region. That is,\n"
168 <<
"the latitude and longitude grids must have a length >= 2.";
169 throw runtime_error(os.str());
178 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
186 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
191 gridpos(gp_lat, GFlat, lat[0]);
192 gridpos(gp_lon, lon_shifted, lon[0]);
195 outvalue =
interp(itw, gfield2.
data, gp_lat, gp_lon);
201 const Index& atmosphere_dim,
211 "input argument *field*", field, atmosphere_dim, lat_grid, lon_grid);
217 if (rtp_pos[0] < zmin - dzok || rtp_pos[0] > zmax + dzok) {
219 os <<
"The given position does not match *z_surface*.\nThe altitude in "
220 <<
"*rtp_pos* is " << rtp_pos[0] / 1e3 <<
" km.\n"
221 <<
"The altitude range covered by *z_surface* is [" << zmin / 1e3 <<
","
222 << zmax / 1e3 <<
"] km.\n"
223 <<
"One possible mistake is to mix up *rtp_pos* and *rte_los*.";
224 throw runtime_error(os.str());
227 if (atmosphere_dim == 1) {
228 outvalue = field(0, 0);
232 gridpos(gp_lat, lat_grid, rtp_pos[1]);
233 if (atmosphere_dim == 3) {
235 gridpos(gp_lon, lon_grid, rtp_pos[2]);
243 out3 <<
" Result = " << outvalue <<
"\n";
251 const Tensor3& iy_transmittance,
253 const Index& cloudbox_on,
254 const Index& jacobian_do,
256 const Agenda& iy_main_agenda,
262 const Vector& surface_types_aux,
263 const Vector& surface_types_weights,
268 throw runtime_error(
"*surface_types* is empty!");
274 for (
Index t=0; t<ntypes; t++ ) {
276 if (surface_types[t] < 0)
278 "No element in *surface_types* is allowed to be negative.");
279 if (surface_types[t] >= iy_surface_agenda_array.
nelem()) {
281 os <<
"*iy_surface_agenda_array* has only "
282 << iy_surface_agenda_array.
nelem()
283 <<
" elements,\n while you have selected element " << surface_types[t];
284 throw runtime_error(os.str());
304 surface_types_aux[t],
305 iy_surface_agenda_array);
307 iy1 *= surface_types_weights[t];
309 diy_dx1[i] *= surface_types_weights[t];
310 wtot += surface_types_weights[t];;
318 diy_dx[i] += diy_dx1[i];
321 if (
abs(wtot-1)>1e-4)
322 throw runtime_error(
"Sum of *surface_types_weights* deviates from 1.");
329 const Tensor3& iy_transmittance,
331 const Index& jacobian_do,
332 const Index& atmosphere_dim,
334 const Index& cloudbox_on,
335 const Index& stokes_dim,
341 const Agenda& iy_main_agenda,
346 const Index& fastem_version,
353 Vector specular_los, surface_normal;
363 iy_aux_vars[0] =
"Optical depth";
393 for (
Index i = 0; i < nf; i++) {
394 transmittance[i] = exp(-iy_aux[0](i, 0));
423 Matrix sensor_los_dummy(1, 1, 0);
425 surface_calc(iy, I, sensor_los_dummy, surface_rmatrix, surface_emission);
430 if (iy_transmittance.
npages()) {
432 for (
Index p = 0; p < diy_dx[
q].npages(); p++) {
433 for (
Index i = 0; i < nf; i++) {
450 const Tensor3& iy_transmittance,
452 const Index& jacobian_do,
453 const Index& atmosphere_dim,
455 const Index& cloudbox_on,
456 const Index& stokes_dim,
462 const Agenda& iy_main_agenda,
463 const Agenda& surface_rtprop_agenda,
479 surface_rtprop_agenda);
488 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
489 if (nlos != surface_rmatrix.
nbooks())
491 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
492 if (surface_rmatrix.
npages() != nf)
494 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
495 if (surface_rmatrix.
nrows() != stokes_dim ||
496 surface_rmatrix.
ncols() != stokes_dim)
498 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
500 if (surface_emission.
ncols() != stokes_dim)
502 "Mismatch between size of *surface_emission* and *stokes_dim*.");
503 if (surface_emission.
nrows() != nf)
504 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
507 Tensor3 I(nlos, nf, stokes_dim);
511 for (
Index ilos = 0; ilos < nlos; ilos++) {
520 if (iy_transmittance.
npages()) {
531 Index iy_id_new = iy_id + ilos + 1;
552 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
554 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
557 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n"
558 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
559 throw runtime_error(os.str());
567 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
574 const Matrix& surface_los,
575 const Tensor4& surface_rmatrix,
576 const Matrix& surface_emission,
580 const Tensor3& iy_transmittance,
582 const Index& jacobian_do,
584 const Index& atmosphere_dim,
586 const Index& cloudbox_on,
587 const Index& stokes_dim,
593 const Agenda& iy_main_agenda,
607 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
608 if (nlos != surface_rmatrix.
nbooks())
610 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
611 if (surface_rmatrix.
npages() != nf)
613 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
614 if (surface_rmatrix.
nrows() != stokes_dim ||
615 surface_rmatrix.
ncols() != stokes_dim)
617 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
619 if (surface_emission.
ncols() != stokes_dim)
621 "Mismatch between size of *surface_emission* and *stokes_dim*.");
622 if (surface_emission.
nrows() != nf)
623 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
626 Tensor3 I(nlos, nf, stokes_dim);
630 for (
Index ilos = 0; ilos < nlos; ilos++) {
639 if (iy_transmittance.
npages()) {
670 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
672 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
675 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n"
676 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
677 throw runtime_error(os.str());
685 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
688 if (jacobian_do && dsurface_names.
nelem()) {
690 for (
Index i = 0; i < dsurface_names.
nelem(); i++) {
693 if (dsurface_emission_dx[i].empty() || dsurface_rmatrix_dx[i].empty()) {
695 os <<
"The derivatives for surface quantity: " << dsurface_names[i]
696 <<
"\nwere not calculated by *iy_surface_agenda*.\n"
697 <<
"That is, *dsurface_emission_dx* and/or *dsurface_rmatrix_dx*\n"
699 throw runtime_error(os.str());
703 for (
Index j = 0; j < jacobian_quantities.
nelem() && ihit < 0; j++) {
704 if (dsurface_names[i] == jacobian_quantities[j].Subtag()) {
710 Matrix diy_dpos0, diy_dpos;
714 dsurface_rmatrix_dx[i],
715 dsurface_emission_dx[i]);
720 jacobian_quantities[ihit],
734 const Index& atmosphere_dim,
743 if (atmosphere_dim == 1) {
744 surface_normal[0] = 0;
745 if (rtp_los[0] < 90) {
747 "Invalid zenith angle. The zenith angle corresponds "
748 "to observe the surface from below.");
750 specular_los[0] = 180 - rtp_los[0];
753 else if (atmosphere_dim == 2) {
754 specular_los[0] =
sign(rtp_los[0]) * 180 - rtp_los[0];
755 surface_normal[0] = 0;
758 else if (atmosphere_dim == 3) {
759 specular_los[0] = 180 - rtp_los[0];
760 specular_los[1] = rtp_los[1];
761 surface_normal[0] = 0;
762 surface_normal[1] = 0;
771 const Index& atmosphere_dim,
774 const Vector& refellipsoid,
776 const Index& ignore_surface_slope,
784 if (atmosphere_dim == 1 || ignore_surface_slope) {
797 if (atmosphere_dim == 2) {
800 gridpos(gp_lat, lat_grid, rtp_pos[1]);
803 c1, lat_grid, refellipsoid, z_surface(
joker, 0), gp_lat, rtp_los[0]);
809 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
811 "Invalid zenith angle. The zenith angle corresponds "
812 "to observe the surface from below.");
815 sign(rtp_los[0]) * 180 - rtp_los[0] + 2 * surface_normal[0];
823 gridpos(gp_lat, lat_grid, rtp_pos[1]);
824 gridpos(gp_lon, lon_grid, rtp_pos[2]);
827 c1, c2, lat_grid, lon_grid, refellipsoid, z_surface, gp_lat, gp_lon, 0);
831 interp(itw, z_surface, gp_lat, gp_lon);
845 Vector tangentSN(3), tangentEW(3), normal(3);
846 zaaa2cart(tangentSN[0], tangentSN[1], tangentSN[2], zaSN, 0);
847 zaaa2cart(tangentEW[0], tangentEW[1], tangentEW[2], zaEW, 90);
848 cross3(normal, tangentSN, tangentEW);
851 zaaa2cart(di[0], di[1], di[2], rtp_los[0], rtp_los[1]);
855 surface_normal[0], surface_normal[1], normal[0], normal[1], normal[2]);
856 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
858 "Invalid zenith angle. The zenith angle corresponds "
859 "to observe the surface from below.");
864 for (
Index i = 0; i < 3; i++) {
865 speccart[i] =
fac * normal[i] - di[i];
879 const Index& atmosphere_dim,
881 const Index& stokes_dim,
892 out2 <<
" Sets variables to model a blackbody surface with a temperature "
893 <<
" of " << surface_skin_t <<
" K.\n";
896 surface_rmatrix.
resize(0, 0, 0, 0);
901 planck(
b, f_grid, surface_skin_t);
903 surface_emission.
resize(nf, stokes_dim);
904 surface_emission = 0.0;
906 for (
Index iv = 0; iv < nf; iv++) {
907 surface_emission(iv, 0) =
b[iv];
908 for (
Index is = 1; is < stokes_dim; is++) {
909 surface_emission(iv, is) = 0;
918 const Index& atmosphere_dim,
919 const Index& stokes_dim,
927 const Vector& transmittance,
928 const Index& fastem_version,
939 Vector specular_los, surface_normal;
955 Numeric rel_azimuth = wind_direction;
956 if (atmosphere_dim == 2 && rtp_los[0] < 0) {
959 }
else if (atmosphere_dim == 3) {
960 rel_azimuth -= rtp_los[1];
965 Matrix emissivity, reflectivity;
980 surface_los(0,
joker) = specular_los;
985 planck(
b, f_grid, surface_skin_t);
987 surface_emission.
resize(nf, stokes_dim);
988 for (
Index i = 0; i < nf; i++) {
990 surface_emission(i, 0) =
b[i] * 0.5 * (emissivity(i, 0) + emissivity(i, 1));
992 if (stokes_dim >= 2) {
993 surface_emission(i, 1) =
994 b[i] * 0.5 * (emissivity(i, 0) - emissivity(i, 1));
997 for (
Index j = 2; j < stokes_dim; j++) {
998 surface_emission(i, j) =
b[i] * emissivity(i, j);
1004 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1005 surface_rmatrix = 0.0;
1006 for (
Index iv = 0; iv < nf; iv++) {
1007 surface_rmatrix(0, iv, 0, 0) =
1008 0.5 * (reflectivity(iv, 0) + reflectivity(iv, 1));
1009 if (stokes_dim >= 2) {
1010 surface_rmatrix(0, iv, 0, 1) =
1011 0.5 * (reflectivity(iv, 0) - reflectivity(iv, 1));
1013 surface_rmatrix(0, iv, 1, 0) = surface_rmatrix(0, iv, 0, 1);
1014 surface_rmatrix(0, iv, 1, 1) = surface_rmatrix(0, iv, 0, 0);
1016 for (
Index i = 2; i < stokes_dim; i++) {
1017 surface_rmatrix(0, iv, i, i) = surface_rmatrix(0, iv, 0, 0);
1026 const Index& stokes_dim,
1030 "You should only use this method where the main calculations are "
1031 "done with *stokes_dim* set to 1.");
1033 Index local_stokes = surface_emission.
ncols();
1035 "This method requires that the input surface proporties match a Stokes "
1036 "dimension of 2-4. Incoming *surface_emission* matches stokes_dim=1.");
1040 Matrix se = surface_emission;
1042 surface_emission.
resize(nf, 1);
1043 surface_rmatrix.
resize(nlos, nf, 1, 1);
1045 if (local_stokes == 2) {
1049 for (
Index f=0; f<nf; ++f) {
1050 const Numeric bv = se(f,0) + se(f,1);
1051 const Numeric bh = se(f,0) - se(f,1);
1052 surface_emission(f,0) = c2*bv + s2*bh;
1054 const Numeric rv = sr(
l,f,0,0) + sr(
l,f,1,0);
1055 const Numeric rh = sr(
l,f,0,0) - sr(
l,f,1,0);
1056 surface_rmatrix(
l,f,0,0) = c2*rv + s2*rh;
1065 Matrix Mleft(local_stokes,local_stokes), Mright(local_stokes,local_stokes);
1066 mult(Mleft, Cm, Lp);
1067 mult(Mright, Lm, Cs);
1070 Matrix Tmp(local_stokes,local_stokes), Mr(local_stokes,local_stokes);
1072 for (
Index f=0; f<nf; ++f) {
1074 surface_emission(f,0) = 2.0 * Vr[0];
1077 mult(Mr, Mleft, Tmp);
1078 surface_rmatrix(
l,f,0,0) = Tmp(0,0);
1087 Matrix& surface_emission,
1088 const Index& atmosphere_dim,
1089 const Index& stokes_dim,
1096 const Vector& specular_los,
1097 const Numeric& surface_skin_t,
1109 "surface skin temperature", surface_skin_t, 190.0, 373.0);
1112 Matrix surface_rv_rh(nf, 2);
1118 lat, lon, atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
1121 lon = fmod(lon, 360.0);
1131 throw std::runtime_error(
1132 "Given coordinates are not contained in "
1133 " TELSEM atlas. To enable nearest neighbour"
1134 "interpolation set *d_max* to a positive "
1142 std::ostringstream out{};
1143 out <<
"Distance of nearest neighbour exceeds provided limit (";
1144 out <<
d <<
" > " << d_max <<
").";
1145 throw std::runtime_error(out.str());
1161 for (
Index i = 0; i < nf; ++i) {
1162 if (f_grid[i] < 5e9)
1163 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
1164 if (f_grid[i] > 900e9)
1165 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
1170 std::tie(e_v, e_h) =
1171 atlas.
emis_interp(theta, f, class1, class2, emis_v, emis_h);
1173 surface_rv_rh(i, 0) =
min(
max(1.0 - e_v, r_min), r_max);
1174 surface_rv_rh(i, 1) =
min(
max(1.0 - e_h, r_min), r_max);
1194 Matrix& surface_emission,
1195 const Index& atmosphere_dim,
1196 const Index& stokes_dim,
1200 const Numeric& surface_skin_t,
1211 "surface skin temperature", surface_skin_t, 260.0, 373.0);
1216 Vector specular_los, surface_normal;
1231 in[1] = 180.0 -
abs(rtp_los[0]);
1233 in[3] = surface_skin_t;
1239 Matrix surface_rv_rh(nf, 2);
1241 for (
Index i = 0; i < nf; ++i) {
1242 if (f_grid[i] < 5e9)
1243 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
1244 if (f_grid[i] > 900e9)
1245 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
1273 Matrix& surface_emission,
1275 const Index& stokes_dim,
1276 const Index& atmosphere_dim,
1279 const Vector& specular_los,
1280 const Numeric& surface_skin_t,
1297 Matrix n_real(nf, 1), n_imag(nf, 1);
1301 surface_complex_refr_index,
1302 "surface_complex_refr_index",
1304 Vector(1, surface_skin_t));
1306 out2 <<
" Sets variables to model a flat surface\n";
1307 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
1310 surface_los(0,
joker) = specular_los;
1312 surface_emission.
resize(nf, stokes_dim);
1313 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1322 for (
Index iv = 0; iv < nf; iv++) {
1324 Complex n2(n_real(iv, 0), n_imag(iv, 0));
1331 surface_emission(iv,
joker),
1343 Matrix& surface_emission,
1345 const Index& stokes_dim,
1346 const Index& atmosphere_dim,
1349 const Vector& specular_los,
1350 const Numeric& surface_skin_t,
1351 const Tensor3& surface_reflectivity,
1364 if (surface_reflectivity.
nrows() != stokes_dim &&
1365 surface_reflectivity.
ncols() != stokes_dim) {
1367 os <<
"The number of rows and columnss in *surface_reflectivity* must\n"
1368 <<
"match *stokes_dim*."
1369 <<
"\n stokes_dim : " << stokes_dim
1370 <<
"\n number of rows in *surface_reflectivity* : "
1371 << surface_reflectivity.
nrows()
1372 <<
"\n number of columns in *surface_reflectivity* : "
1373 << surface_reflectivity.
ncols() <<
"\n";
1374 throw runtime_error(os.str());
1377 if (surface_reflectivity.
npages() != nf &&
1378 surface_reflectivity.
npages() != 1) {
1380 os <<
"The number of pages in *surface_reflectivity* should\n"
1381 <<
"match length of *f_grid* or be 1."
1382 <<
"\n length of *f_grid* : " << nf
1383 <<
"\n dimension of *surface_reflectivity* : "
1384 << surface_reflectivity.
npages() <<
"\n";
1385 throw runtime_error(os.str());
1388 out2 <<
" Sets variables to model a flat surface\n";
1391 surface_los(0,
joker) = specular_los;
1393 surface_emission.
resize(nf, stokes_dim);
1394 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1396 Matrix R, IR(stokes_dim, stokes_dim);
1399 planck(
b, f_grid, surface_skin_t);
1403 for (
Index iv = 0; iv < nf; iv++) {
1404 if (iv == 0 || surface_reflectivity.
npages() > 1) {
1406 for (
Index i = 0; i < stokes_dim; i++) {
1407 for (
Index j = 0; j < stokes_dim; j++) {
1409 IR(i, j) = 1 - R(i, j);
1411 IR(i, j) = -R(i, j);
1420 mult(surface_emission(iv,
joker), IR, B);
1427 Matrix& surface_emission,
1429 const Index& stokes_dim,
1430 const Index& atmosphere_dim,
1433 const Vector& specular_los,
1434 const Numeric& surface_skin_t,
1435 const Matrix& surface_rv_rh,
1446 if (surface_rv_rh.
ncols() != 2) {
1448 os <<
"The number of columns in *surface_rv_rh* must be two,\n"
1449 <<
"but the actual number of columns is " << surface_rv_rh.
ncols()
1451 throw runtime_error(os.str());
1454 if (surface_rv_rh.
nrows() != nf && surface_rv_rh.
nrows() != 1) {
1456 os <<
"The number of rows in *surface_rv_rh* should\n"
1457 <<
"match length of *f_grid* or be 1."
1458 <<
"\n length of *f_grid* : " << nf
1459 <<
"\n rows in *surface_rv_rh* : " << surface_rv_rh.
nrows() <<
"\n";
1460 throw runtime_error(os.str());
1463 if (
min(surface_rv_rh) < 0 ||
max(surface_rv_rh) > 1) {
1464 throw runtime_error(
"All values in *surface_rv_rh* must be inside [0,1].");
1468 surface_los(0,
joker) = specular_los;
1470 surface_emission.
resize(nf, stokes_dim);
1471 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1473 surface_emission = 0;
1474 surface_rmatrix = 0;
1477 planck(
b, f_grid, surface_skin_t);
1479 Numeric rmean = 0.0, rdiff = 0.0;
1481 for (
Index iv = 0; iv < nf; iv++) {
1482 if (iv == 0 || surface_rv_rh.
nrows() > 1) {
1483 rmean = 0.5 * (surface_rv_rh(iv, 0) + surface_rv_rh(iv, 1));
1484 rdiff = 0.5 * (surface_rv_rh(iv, 0) - surface_rv_rh(iv, 1));
1487 surface_emission(iv, 0) = (1.0 - rmean) *
b[iv];
1488 surface_rmatrix(0, iv, 0, 0) = rmean;
1490 if (stokes_dim > 1) {
1491 surface_emission(iv, 1) = -rdiff *
b[iv];
1493 surface_rmatrix(0, iv, 0, 1) = rdiff;
1494 surface_rmatrix(0, iv, 1, 0) = rdiff;
1495 surface_rmatrix(0, iv, 1, 1) = rmean;
1497 for (
Index i = 2; i < stokes_dim; i++) {
1498 surface_rmatrix(0, iv, i, i) = rmean;
1507 Matrix& surface_emission,
1509 const Index& stokes_dim,
1510 const Index& atmosphere_dim,
1513 const Vector& specular_los,
1514 const Numeric& surface_skin_t,
1515 const Vector& surface_scalar_reflectivity,
1526 if (surface_scalar_reflectivity.
nelem() != nf &&
1527 surface_scalar_reflectivity.
nelem() != 1) {
1529 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
1530 <<
"match length of *f_grid* or be 1."
1531 <<
"\n length of *f_grid* : " << nf
1532 <<
"\n length of *surface_scalar_reflectivity* : "
1533 << surface_scalar_reflectivity.
nelem() <<
"\n";
1534 throw runtime_error(os.str());
1537 if (
min(surface_scalar_reflectivity) < 0 ||
1538 max(surface_scalar_reflectivity) > 1) {
1539 throw runtime_error(
1540 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1544 surface_los(0,
joker) = specular_los;
1546 surface_emission.
resize(nf, stokes_dim);
1547 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1549 surface_emission = 0;
1550 surface_rmatrix = 0;
1553 planck(
b, f_grid, surface_skin_t);
1557 for (
Index iv = 0; iv < nf; iv++) {
1558 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1559 r = surface_scalar_reflectivity[iv];
1562 surface_emission(iv, 0) = (1.0 - r) *
b[iv];
1563 surface_rmatrix(0, iv, 0, 0) = r;
1564 for (
Index i = 1; i < stokes_dim; i++) {
1565 surface_rmatrix(0, iv, i, i) = r;
1573 Matrix& surface_emission,
1575 const Index& stokes_dim,
1576 const Index& atmosphere_dim,
1579 const Vector& surface_normal,
1580 const Numeric& surface_skin_t,
1581 const Vector& surface_scalar_reflectivity,
1582 const Index& lambertian_nza,
1594 if (surface_scalar_reflectivity.
nelem() != nf &&
1595 surface_scalar_reflectivity.
nelem() != 1) {
1597 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
1598 <<
"match length of *f_grid* or be 1."
1599 <<
"\n length of *f_grid* : " << nf
1600 <<
"\n length of *surface_scalar_reflectivity* : "
1601 << surface_scalar_reflectivity.
nelem() <<
"\n";
1602 throw runtime_error(os.str());
1605 if (
min(surface_scalar_reflectivity) < 0 ||
1606 max(surface_scalar_reflectivity) > 1) {
1607 throw runtime_error(
1608 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1613 surface_los.
resize(lambertian_nza, rtp_los.
nelem());
1614 surface_rmatrix.
resize(lambertian_nza, nf, stokes_dim, stokes_dim);
1615 surface_emission.
resize(nf, stokes_dim);
1618 surface_rmatrix = 0.0;
1619 surface_emission = 0.0;
1624 const Vector za_lims(0.0, lambertian_nza + 1, dza);
1627 for (
Index ip = 0; ip < lambertian_nza; ip++) {
1628 surface_los(ip, 0) = za_lims[ip] + za_pos * dza;
1629 if (atmosphere_dim == 2) {
1630 if (rtp_los[0] < 0) {
1631 surface_los(ip, 0) *= -1.0;
1634 }
else if (atmosphere_dim == 3) {
1635 surface_los(ip, 1) = rtp_los[1];
1640 planck(
b, f_grid, surface_skin_t);
1646 for (
Index iv = 0; iv < nf; iv++) {
1648 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1649 r = surface_scalar_reflectivity[iv];
1660 for (
Index ip = 0; ip < lambertian_nza; ip++) {
1663 (cos(2 *
DEG2RAD * za_lims[ip]) - cos(2 *
DEG2RAD * za_lims[ip + 1]));
1664 surface_rmatrix(ip, iv, 0, 0) =
w;
1668 surface_emission(iv, 0) = (1 - r) *
b[iv];
1677 Matrix& surface_emission,
1678 const Index& atmosphere_dim,
1682 const Agenda& surface_rtprop_sub_agenda,
1683 const Numeric& specular_factor,
1690 if (specular_factor > 1 || specular_factor < 1.0 / 3.0)
1691 throw runtime_error(
"The valid range for *specular_factor* is [1/3,1].");
1692 if (dza > 45 || dza <= 0)
1693 throw runtime_error(
"The valid range for *dza* is ]0,45].");
1708 surface_rtprop_sub_agenda);
1709 if (los1.
nrows() != 1)
1710 throw runtime_error(
1711 "*surface_rtprop_sub_agenda* must return data "
1712 "describing a specular surface.");
1726 while (failed && dza_try > 0) {
1728 Vector los_new = rtp_los;
1730 sign(rtp_los[0]) * dza_try;
1740 surface_rtprop_sub_agenda);
1742 }
catch (
const runtime_error& e) {
1753 surface_emission = 0;
1762 w = specular_factor;
1764 w = specular_factor + (1.0 - specular_factor) / 2.0;
1769 for (
Index r = 0; r < rmatrix1.
nrows(); r++) {
1770 surface_emission(p, r) +=
w * emission1(p, r);
1772 surface_rmatrix(1, p, r,
c) =
w * rmatrix1(0, p, r,
c);
1779 w = (1.0 - specular_factor) / 2.0;
1784 for (
Index r = 0; r < rmatrix2.
nrows(); r++) {
1785 surface_emission(p, r) +=
w * emission2(p, r);
1787 surface_rmatrix(2, p, r,
c) =
w * rmatrix2(0, p, r,
c);
1795 Vector los_new = rtp_los;
1796 los_new[0] +=
sign(rtp_los[0]) * dza;
1806 surface_rtprop_sub_agenda);
1810 for (
Index r = 0; r < rmatrix2.
nrows(); r++) {
1811 surface_emission(p, r) +=
w * emission2(p, r);
1813 surface_rmatrix(0, p, r,
c) =
w * rmatrix2(0, p, r,
c);
1822 const Index& atmosphere_dim,
1825 const Numeric& specular_factor,
1832 if (surface_los.
nrows() != 1)
1833 throw runtime_error(
1834 "Input surface data must be of specular type. That is, "
1835 "*surface_los* must contain a single direction.");
1836 if (surface_rmatrix.
nbooks() != 1)
1837 throw runtime_error(
1838 "*surface_rmatrix* describes a different number of "
1839 "directions than *surface_los*.");
1842 if (specular_factor > 1 || specular_factor < 1.0 / 3.0)
1843 throw runtime_error(
"The valid range for *specular_factor* is [1/3,1].");
1844 if (dza > 45 || dza <= 0)
1845 throw runtime_error(
"The valid range for *dza* is ]0,45].");
1848 const Matrix los1 = surface_los;
1849 const Tensor4 rmatrix1 = surface_rmatrix;
1856 const Numeric za_max = 89 + (180 -
abs(los1(0, 0)) -
abs(rtp_los[0])) / 2.0;
1860 if (
abs(los1(0, 0)) > za_max) {
1868 for (
Index r = 0; r < nbeams; r++) {
1869 surface_los(r, 0) = ((
Numeric)r - 1.0) * dza +
abs(los1(0, 0));
1870 if (r == 2 && surface_los(r, 0) > za_max) {
1871 surface_los(r, 0) = za_max;
1874 surface_los(r,
c) = los1(0,
c);
1883 for (
Index b = 0;
b < nbeams;
b++) {
1885 if (
b == 1 && nbeams == 3)
1887 w = specular_factor;
1890 w = specular_factor + (1.0 - specular_factor) / 2.0;
1893 w = (1.0 - specular_factor) / 2.0;
1897 for (
Index r = 0; r < rmatrix1.
nrows(); r++) {
1899 surface_rmatrix(
b, p, r,
c) =
w * rmatrix1(0, p, r,
c);
1906 if (atmosphere_dim == 1) {
1908 surface_los(0, 0) =
abs(surface_los(0, 0));
1909 }
else if (atmosphere_dim == 2) {
1911 if (los1(0, 0) < 0) {
1912 for (
Index r = 0; r < rmatrix1.
nrows(); r++) {
1913 surface_los(r, 0) = -surface_los(r, 0);
1916 }
else if (atmosphere_dim == 1) {
1918 if (surface_los(0, 0) < 0) {
1919 surface_los(0, 0) = -surface_los(0, 0);
1920 surface_los(0, 1) += 180;
1921 if (surface_los(0, 1) > 180) {
1922 surface_los(0, 1) -= 360;
1931 const Index& atmosphere_dim,
1939 Index gfield_fID = 0;
1940 Index gfield_tID = 1;
1941 Index gfield_compID = 2;
1942 Index gfield_latID = 3;
1943 Index gfield_lonID = 4;
1963 if (nlat < 2 || nlon < 2) {
1965 os <<
"The data in *complex_refr_index_field* must span a geographical "
1966 <<
"region. That is,\nthe latitude and longitude grids must have a "
1968 throw runtime_error(os.str());
1973 os <<
"The data in *complex_refr_index_field* must have exactly two "
1974 <<
"pages. One page each\nfor the real and imaginary part of the "
1975 <<
"complex refractive index.";
1976 throw runtime_error(os.str());
1985 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
1993 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
1996 surface_complex_refr_index.
resize(nf, nt, 2);
1998 surface_complex_refr_index.
set_grid(
2001 surface_complex_refr_index.
set_grid(
2004 surface_complex_refr_index.
set_grid(2, {
"real",
"imaginary"});
2009 gridpos(gp_lat, GFlat, lat[0]);
2010 gridpos(gp_lon, lon_shifted, lon[0]);
2014 for (
Index iv = 0; iv < nf; iv++) {
2015 for (
Index it = 0; it < nt; it++) {
2016 surface_complex_refr_index.
data(iv, it, 0) =
interp(
2017 itw, complex_n_field.
data(iv, it, 0,
joker,
joker), gp_lat, gp_lon);
2018 surface_complex_refr_index.
data(iv, it, 1) =
interp(
2019 itw, complex_n_field.
data(iv, it, 1,
joker,
joker), gp_lat, gp_lon);
2026 const Index& stokes_dim,
2028 const Index& atmosphere_dim,
2057 if (nlat < 2 || nlon < 2) {
2059 os <<
"The data in *r_field* must span a geographical region. That is,\n"
2060 <<
"the latitude and longitude grids must have a length >= 2.";
2061 throw runtime_error(os.str());
2066 os <<
"The data in *r_field* must span a range of zenith angles. That\n"
2067 <<
"is the zenith angle grid must have a length >= 2.";
2068 throw runtime_error(os.str());
2070 if (ns1 < stokes_dim || ns2 < stokes_dim || ns1 > 4 || ns2 > 4) {
2072 os <<
"The \"Stokes dimensions\" must have a size that is >= "
2073 <<
"*stokes_dim* (but not exceeding 4).";
2074 throw runtime_error(os.str());
2080 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2087 Tensor4 r_f_za(nf_in, stokes_dim, stokes_dim, nza);
2094 gridpos(gp_lon, lon_shifted, lon[0]);
2097 for (
Index iv = 0; iv < nf_in; iv++) {
2098 for (
Index iz = 0; iz < nza; iz++) {
2099 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2100 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2101 r_f_za(iv, is1, is2, iz) =
2113 Tensor3 r_f(nf_in, stokes_dim, stokes_dim);
2120 "Incidence angle interpolation", r_field.
get_numeric_grid(3), 180 - rtp_los[0]);
2124 for (
Index i = 0; i < nf_in; i++) {
2125 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2126 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2127 r_f(i, is1, is2) =
interp(r_f_za(i, is1, is2,
joker), itw, lag);
2136 surface_reflectivity = r_f;
2141 surface_reflectivity.
resize(nf_out, stokes_dim, stokes_dim);
2147 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2148 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2151 r_f(
joker, is1, is2),
2160 Vector& surface_scalar_reflectivity,
2161 const Index& stokes_dim,
2163 const Index& atmosphere_dim,
2188 if (nlat < 2 || nlon < 2) {
2190 os <<
"The data in *r_field* must span a geographical region. That is,\n"
2191 <<
"the latitude and longitude grids must have a length >= 2.";
2192 throw runtime_error(os.str());
2197 os <<
"The data in *r_field* must span a range of zenith angles. That\n"
2198 <<
"is the zenith angle grid must have a length >= 2.";
2199 throw runtime_error(os.str());
2205 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2212 Matrix r_f_za(nf_in, nza);
2219 gridpos(gp_lon, lon_shifted, lon[0]);
2222 for (
Index iv = 0; iv < nf_in; iv++) {
2223 for (
Index iz = 0; iz < nza; iz++) {
2238 "Incidence angle interpolation", r_field.
get_numeric_grid(1), 180 - rtp_los[0]);
2241 for (
Index i = 0; i < nf_in; i++) {
2249 surface_scalar_reflectivity.
resize(1);
2250 surface_scalar_reflectivity[0] = r_f[0];
2255 surface_scalar_reflectivity.
resize(nf_out);
2261 interp(surface_scalar_reflectivity, itw, r_f, gp);
2267 Vector& surface_scalar_reflectivity,
2268 const Tensor4& surface_rmatrix,
2273 surface_scalar_reflectivity.
resize(nf);
2274 surface_scalar_reflectivity = 0;
2276 for (
Index i = 0; i < nf; i++) {
2278 surface_scalar_reflectivity[i] += surface_rmatrix(
l, i, 0, 0);
2285 Vector& surface_types_aux,
2286 Vector& surface_types_weights,
2287 const Index& atmosphere_dim,
2296 Index gfield_latID = 0;
2297 Index gfield_lonID = 1;
2311 if (nlat < 2 || nlon < 2) {
2313 os <<
"The data in *surface_type_mask* must span a geographical "
2314 <<
"region. Accordingly,\nthe latitude and longitude grids must "
2315 <<
"both have a length >= 2.";
2316 throw runtime_error(os.str());
2325 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2333 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
2337 gridpos(gp_lat, GFlat, lat[0]);
2338 gridpos(gp_lon, lon_shifted, lon[0]);
2340 if (method ==
"nearest" ) {
2343 if (gp_lat.
fd[0] < 0.5) {
2346 ilat = gp_lat.
idx + 1;
2348 if (gp_lon.
fd[0] < 0.5) {
2351 ilon = gp_lon.
idx + 1;
2354 surface_types.resize(1);
2355 surface_types_aux.
resize(1);
2356 surface_types_weights.
resize(1);
2357 surface_types[0] = (
Index)floor(surface_type_mask.
data(ilat, ilon));
2358 surface_types_aux[0] = surface_type_mask.
data(ilat, ilon) -
2360 surface_types_weights[0] = 1.0;
2363 else if (method ==
"linear" ) {
2368 types0[0] = (
Index)floor(surface_type_mask.
data(gp_lat.
idx,gp_lon.
idx));
2369 types0[1] = (
Index)floor(surface_type_mask.
data(gp_lat.
idx,gp_lon.
idx+1));
2370 types0[2] = (
Index)floor(surface_type_mask.
data(gp_lat.
idx+1,gp_lon.
idx));
2371 types0[3] = (
Index)floor(surface_type_mask.
data(gp_lat.
idx+1,gp_lon.
idx+1));
2373 types[0] = types0[0];
2374 for (
Index t=1; t<4; t++) {
2376 for (
Index n=0; n<ntypes && unique; n++)
2377 if (types0[t] == types[n] ) { unique =
false; }
2379 types[ntypes] = types0[t];
2384 surface_types.resize(ntypes);
2385 surface_types_aux.
resize(ntypes);
2386 surface_types_weights.
resize(ntypes);
2393 for (
Index t=0; t<ntypes; t++ ) {
2396 if (types[t] == types0[0]) { wtot += itw[0];
2397 auxtot += itw[0]*(surface_type_mask.
data(gp_lat.
idx,gp_lon.
idx)-ntype);
2399 if (types[t] == types0[1]) { wtot += itw[1];
2400 auxtot += itw[1]*(surface_type_mask.
data(gp_lat.
idx,gp_lon.
idx+1)-ntype);
2402 if (types[t] == types0[2]) { wtot += itw[2];
2403 auxtot += itw[2]*(surface_type_mask.
data(gp_lat.
idx+1,gp_lon.
idx)-ntype);
2405 if (types[t] == types0[3]) { wtot += itw[3];
2406 auxtot += itw[3]*(surface_type_mask.
data(gp_lat.
idx+1,gp_lon.
idx+1)-ntype);
2409 surface_types[t] = types[t];
2410 surface_types_aux[t] = auxtot / wtot;
2411 surface_types_weights[t] = wtot;
2417 os <<
"The allowed options for *method are: \"nearest\" and \"linear\",\n"
2418 <<
"but you have selected: " << method;
2419 throw runtime_error(os.str());
2428 Matrix& surface_emission,
2434 const Vector& surface_types_aux,
2435 const Vector& surface_types_weights,
2437 if (surface_types.
nelem() != 1) {
2439 os <<
"This method requires that *surface_types* have length 1.\n"
2440 <<
"If you are trying to apply a mixture model, you have to use\n"
2441 <<
"a setup based on *iySurfaceCallAgendaX* instead.";
2442 throw runtime_error(os.str());
2444 if (surface_types[0] < 0)
2445 throw runtime_error(
"*surface_type* is not allowed to be negative.");
2446 if (surface_types[0] >= surface_rtprop_agenda_array.
nelem()) {
2448 os <<
"*surface_rtprop_agenda_array* has only "
2449 << surface_rtprop_agenda_array.
nelem()
2450 <<
" elements,\n while you have selected element " << surface_types[0];
2451 throw runtime_error(os.str());
2453 if (
abs(surface_types_weights[0]-1)>1e-4)
2454 throw runtime_error(
"Sum of *surface_types_weights* deviates from 1.");
2465 surface_types_aux[0],
2466 surface_rtprop_agenda_array);
2473 Matrix& surface_emission,
2475 const Index& stokes_dim,
2476 const Index& atmosphere_dim,
2482 const Tensor3& surface_props_data,
2485 const Index& jacobian_do,
2492 surface_props_names);
2498 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2510 surface_props_names);
2523 surface_rmatrix.
resize(1, f_grid.
nelem(), stokes_dim, stokes_dim);
2524 surface_rmatrix = 0.0;
2530 dsurface_rmatrix_dx,
2531 dsurface_emission_dx);
2540 dsurface_emission_dx[irq] = dbdt;
2541 dsurface_rmatrix_dx[irq].resize(surface_rmatrix.
nbooks(),
2542 surface_rmatrix.
npages(),
2543 surface_rmatrix.
nrows(),
2544 surface_rmatrix.
ncols());
2545 dsurface_rmatrix_dx[irq] = 0;
2553 const Index& atmosphere_dim,
2556 const Tensor3& surface_props_data,
2559 const Index& jacobian_do,
2561 if (surface_props_names.
nelem())
2562 throw runtime_error(
2563 "When calling this method, *surface_props_names* should be empty.");
2569 surface_props_names);
2574 dsurface_rmatrix_dx,
2575 dsurface_emission_dx);
2583 Matrix& surface_emission,
2585 const Index& stokes_dim,
2586 const Index& atmosphere_dim,
2592 const Tensor3& surface_props_data,
2595 const Index& jacobian_do,
2596 const Vector& transmittance,
2597 const Index& fastem_version,
2604 surface_props_names);
2610 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2616 "Water skin temperature",
2622 surface_props_names);
2633 surface_props_names);
2636 Vector wind_direction(1);
2644 surface_props_names);
2655 surface_props_names);
2678 dsurface_rmatrix_dx,
2679 dsurface_emission_dx);
2689 dsurface_rmatrix_dx[irq],
2690 dsurface_emission_dx[irq],
2704 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2705 dsurface_rmatrix_dx[irq] /= dd;
2706 dsurface_emission_dx[irq] -= surface_emission;
2707 dsurface_emission_dx[irq] /= dd;
2716 dsurface_rmatrix_dx[irq],
2717 dsurface_emission_dx[irq],
2731 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2732 dsurface_rmatrix_dx[irq] /= dd;
2733 dsurface_emission_dx[irq] -= surface_emission;
2734 dsurface_emission_dx[irq] /= dd;
2743 dsurface_rmatrix_dx[irq],
2744 dsurface_emission_dx[irq],
2753 wind_direction[0] + dd,
2758 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2759 dsurface_rmatrix_dx[irq] /= dd;
2760 dsurface_emission_dx[irq] -= surface_emission;
2761 dsurface_emission_dx[irq] /= dd;
2770 dsurface_rmatrix_dx[irq],
2771 dsurface_emission_dx[irq],
2785 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2786 dsurface_rmatrix_dx[irq] /= dd;
2787 dsurface_emission_dx[irq] -= surface_emission;
2788 dsurface_emission_dx[irq] /= dd;
2798 Matrix& surface_emission,
2800 const Index& stokes_dim,
2801 const Index& atmosphere_dim,
2807 const Vector& specular_los,
2808 const Tensor3& surface_props_data,
2811 const Index& jacobian_do,
2812 const Vector& f_reflectivities,
2819 surface_props_names);
2832 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2836 Vector surface_skin_t(1);
2844 surface_props_names);
2847 Vector reflectivities(nr);
2849 for (
Index i=0; i<nr; i++) {
2852 sstr <<
"Scalar reflectivity " << i;
2860 surface_props_names);
2861 reflectivities[i] = rv[0];
2865 Vector surface_scalar_reflectivity(nf);
2870 gridpos(gp, f_reflectivities, f_grid, 1e99);
2875 interp( surface_scalar_reflectivity, itw2, reflectivities, gp);
2888 surface_scalar_reflectivity,
2895 dsurface_rmatrix_dx,
2896 dsurface_emission_dx);
2906 dsurface_rmatrix_dx[irq],
2907 dsurface_emission_dx[irq],
2914 surface_skin_t[0]+dd,
2915 surface_scalar_reflectivity,
2917 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2918 dsurface_rmatrix_dx[irq] /= dd;
2919 dsurface_emission_dx[irq] -= surface_emission;
2920 dsurface_emission_dx[irq] /= dd;
2924 for (
Index i=0; i<nr; i++) {
2926 sstr <<
"Scalar reflectivity " << i;
2930 Vector rpert = reflectivities;
2932 interp( surface_scalar_reflectivity, itw2, rpert, gp);
2936 dsurface_rmatrix_dx[irq],
2937 dsurface_emission_dx[irq],
2945 surface_scalar_reflectivity,
2947 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2948 dsurface_rmatrix_dx[irq] /= dd;
2949 dsurface_emission_dx[irq] -= surface_emission;
2950 dsurface_emission_dx[irq] /= dd;
2960 Matrix& surface_emission,
2962 const Index& stokes_dim,
2963 const Index& atmosphere_dim,
2971 const Tensor3& surface_props_data,
2974 const Index& jacobian_do,
2981 surface_props_names);
2987 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2993 "Water skin temperature",
2999 surface_props_names);
3010 surface_props_names);
3021 surface_props_names);
3043 dsurface_rmatrix_dx,
3044 dsurface_emission_dx);
3054 dsurface_rmatrix_dx[irq],
3055 dsurface_emission_dx[irq],
3068 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3069 dsurface_rmatrix_dx[irq] /= dd;
3070 dsurface_emission_dx[irq] -= surface_emission;
3071 dsurface_emission_dx[irq] /= dd;
3080 dsurface_rmatrix_dx[irq],
3081 dsurface_emission_dx[irq],
3094 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3095 dsurface_rmatrix_dx[irq] /= dd;
3096 dsurface_emission_dx[irq] -= surface_emission;
3097 dsurface_emission_dx[irq] /= dd;
3106 dsurface_rmatrix_dx[irq],
3107 dsurface_emission_dx[irq],
3120 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
3121 dsurface_rmatrix_dx[irq] /= dd;
3122 dsurface_emission_dx[irq] -= surface_emission;
3123 dsurface_emission_dx[irq] /= dd;
3135 for (
Index i = 0; i < iy_aux_vars.
nelem(); i++) {
3136 if (iy_aux_vars[i] ==
"Optical depth") {
3143 throw runtime_error(
"No element in *iy_aux* holds optical depths.");
3145 const Index n = iy_aux[ihit].nrows();
3149 for (
Index i = 0; i < n; i++) {
3150 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.
The global header file for ARTS.
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 Numeric surface_type_aux, const ArrayOfAgenda &input_agenda_array)
void surface_rtprop_sub_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)
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, 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 iy_surface_agenda_arrayExecute(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Index agenda_array_index, const String &iy_unit, const Tensor3 &iy_transmittance, const Index iy_id, const Index cloudbox_on, const Index jacobian_do, const Agenda &iy_main_agenda, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const Numeric surface_type_aux, 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
Number of elements.
Index nrows() const noexcept
Index ncols() const noexcept
Index npages() const
Returns the number of pages.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
Index 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
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...
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 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 surfaceSplitSpecularTo3beams(Matrix &surface_los, Tensor4 &surface_rmatrix, const Index &atmosphere_dim, const Vector &rtp_pos, const Vector &rtp_los, const Numeric &specular_factor, const Numeric &dza, const Verbosity &)
WORKSPACE METHOD: surfaceSplitSpecularTo3beams.
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.
void surface_rtpropCallAgendaX(Workspace &ws, 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 ArrayOfIndex &surface_types, const Vector &surface_types_aux, const Vector &surface_types_weights, const Verbosity &)
WORKSPACE METHOD: surface_rtpropCallAgendaX.
void surfaceSemiSpecularBy3beams(Workspace &ws, Numeric &surface_skin_t, Matrix &surface_los, Tensor4 &surface_rmatrix, Matrix &surface_emission, const Index &atmosphere_dim, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &surface_rtprop_sub_agenda, const Numeric &specular_factor, const Numeric &dza, const Verbosity &)
WORKSPACE METHOD: surfaceSemiSpecularBy3beams.
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.
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 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 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 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 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 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 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 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_typeInterpTypeMask(ArrayOfIndex &surface_types, Vector &surface_types_aux, Vector &surface_types_weights, 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 String &method, const Verbosity &)
WORKSPACE METHOD: surface_typeInterpTypeMask.
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 iySurfaceCallAgendaX(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const String &iy_unit, const Tensor3 &iy_transmittance, const Index &iy_id, const Index &cloudbox_on, const Index &jacobian_do, const Vector &f_grid, const Agenda &iy_main_agenda, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const ArrayOfAgenda &iy_surface_agenda_array, const ArrayOfIndex &surface_types, const Vector &surface_types_aux, const Vector &surface_types_weights, const Verbosity &)
WORKSPACE METHOD: iySurfaceCallAgendaX.
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 &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 transmittanceFromIy_aux(Vector &transmittance, const ArrayOfString &iy_aux_vars, const ArrayOfMatrix &iy_aux, const Verbosity &)
WORKSPACE METHOD: transmittanceFromIy_aux.
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 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 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 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 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.
Array< String > ArrayOfString
An array of Strings.
my_basic_string< char > String
The String type for ARTS.
constexpr Numeric l(const Index p0, const Index n, const Numeric x, const SortedVectorType &xi, const Index j, const std::pair< Numeric, Numeric > cycle={ -180, 180}) noexcept
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
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 adjust_los(VectorView los, const Index &atmosphere_dim)
Ensures that the zenith and azimuth angles of a line-of-sight vector are inside defined ranges.
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
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 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...