73 const Vector& transmittance,
74 const Index& fastem_version,
84 if (fastem_version < 3 || fastem_version > 6)
85 throw std::runtime_error(
86 "Invalid fastem version: 3 <= fastem_version <= 6");
89 reflectivity.
resize(nf, 4);
94 if (f_grid[
i] > 250e9)
95 throw std::runtime_error(
"Only frequency <= 250 GHz are allowed");
111 emissivity(i,
joker) = e;
112 reflectivity(i,
joker) =
r;
118 for (
Index s = 0; s < 2; s++) {
119 if (emissivity(
i, s) > 1) {
120 emissivity(
i, s) = 1;
121 reflectivity(
i, s) = 0;
123 if (emissivity(
i, s) < 0) {
124 emissivity(
i, s) = 0;
125 reflectivity(
i, s) = 1;
127 if (reflectivity(
i, s) > 1) {
128 emissivity(
i, s) = 0;
129 reflectivity(
i, s) = 1;
131 if (reflectivity(
i, s) < 0) {
132 emissivity(
i, s) = 1;
133 reflectivity(
i, s) = 0;
141 const Index& atmosphere_dim,
149 Index gfield_latID = 0;
150 Index gfield_lonID = 1;
164 if (nlat < 2 || nlon < 2) {
166 os <<
"The data in *gfield2* must span a geographical region. That is,\n" 167 <<
"the latitude and longitude grids must have a length >= 2.";
176 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
184 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
189 gridpos(gp_lat, GFlat, lat[0]);
190 gridpos(gp_lon, lon_shifted, lon[0]);
193 outvalue =
interp(itw, gfield2.
data, gp_lat, gp_lon);
198 const Index& atmosphere_dim,
208 "input argument *field*", field, atmosphere_dim, lat_grid, lon_grid);
214 if (rtp_pos[0] < zmin - dzok || rtp_pos[0] > zmax + dzok) {
216 os <<
"The given position does not match *z_surface*.\nThe altitude in " 217 <<
"*rtp_pos* is " << rtp_pos[0] / 1e3 <<
" km.\n" 218 <<
"The altitude range covered by *z_surface* is [" << zmin / 1e3 <<
"," 219 << zmax / 1e3 <<
"] km.\n" 220 <<
"One possible mistake is to mix up *rtp_pos* and *rte_los*.";
221 throw runtime_error(os.
str());
224 if (atmosphere_dim == 1) {
225 outvalue = field(0, 0);
229 gridpos(gp_lat, lat_grid, rtp_pos[1]);
230 if (atmosphere_dim == 3) {
232 gridpos(gp_lon, lon_grid, rtp_pos[2]);
240 out3 <<
" Result = " << outvalue <<
"\n";
248 const Tensor3& iy_transmission,
250 const Index& cloudbox_on,
251 const Index& jacobian_do,
253 const Agenda& iy_main_agenda,
258 const Index& surface_type,
259 const Numeric& surface_type_aux,
261 if (surface_type < 0)
262 throw runtime_error(
"*surface_type* is not allowed to be negative.");
263 if (surface_type >= iy_surface_agenda_array.
nelem()) {
265 os <<
"*iy_surface_agenda_array* has only " 266 << iy_surface_agenda_array.
nelem()
267 <<
" elements,\n while you have selected element " << surface_type;
268 throw runtime_error(os.
str());
286 iy_surface_agenda_array);
293 const Tensor3& iy_transmission,
295 const Index& jacobian_do,
296 const Index& atmosphere_dim,
298 const Index& cloudbox_on,
299 const Index& stokes_dim,
305 const Agenda& iy_main_agenda,
310 const Index& fastem_version,
317 Vector specular_los, surface_normal;
327 iy_aux_vars[0] =
"Optical depth";
358 transmittance[
i] = exp(-iy_aux[0](
i, 0));
387 Matrix sensor_los_dummy(1, 1, 0);
389 surface_calc(iy, I, sensor_los_dummy, surface_rmatrix, surface_emission);
394 if (iy_transmission.
npages()) {
396 for (
Index p = 0; p < diy_dx[
q].npages(); p++) {
410 const Tensor3& iy_transmission,
412 const Index& jacobian_do,
413 const Index& atmosphere_dim,
415 const Index& cloudbox_on,
416 const Index& stokes_dim,
422 const Agenda& iy_main_agenda,
423 const Agenda& surface_rtprop_agenda,
444 surface_rtprop_agenda);
453 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
454 if (nlos != surface_rmatrix.
nbooks())
456 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
457 if (surface_rmatrix.
npages() != nf)
459 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
460 if (surface_rmatrix.
nrows() != stokes_dim ||
461 surface_rmatrix.
ncols() != stokes_dim)
463 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
465 if (surface_emission.
ncols() != stokes_dim)
467 "Mismatch between size of *surface_emission* and *stokes_dim*.");
468 if (surface_emission.
nrows() != nf)
469 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
472 Tensor3 I(nlos, nf, stokes_dim);
476 for (
Index ilos = 0; ilos < nlos; ilos++) {
485 if (iy_transmission.
npages()) {
496 Index iy_id_new = iy_id + ilos + 1;
517 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
519 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
522 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n" 523 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
524 throw runtime_error(os.
str());
532 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
539 const Matrix& surface_los,
540 const Tensor4& surface_rmatrix,
541 const Matrix& surface_emission,
545 const Tensor3& iy_transmission,
547 const Index& jacobian_do,
549 const Index& atmosphere_dim,
551 const Index& cloudbox_on,
552 const Index& stokes_dim,
558 const Agenda& iy_main_agenda,
572 throw runtime_error(
"Number of columns in *surface_los* is not correct.");
573 if (nlos != surface_rmatrix.
nbooks())
575 "Mismatch in size of *surface_los* and *surface_rmatrix*.");
576 if (surface_rmatrix.
npages() != nf)
578 "Mismatch in size of *surface_rmatrix* and *f_grid*.");
579 if (surface_rmatrix.
nrows() != stokes_dim ||
580 surface_rmatrix.
ncols() != stokes_dim)
582 "Mismatch between size of *surface_rmatrix* and *stokes_dim*.");
584 if (surface_emission.
ncols() != stokes_dim)
586 "Mismatch between size of *surface_emission* and *stokes_dim*.");
587 if (surface_emission.
nrows() != nf)
588 throw runtime_error(
"Mismatch in size of *surface_emission* and f_grid*.");
591 Tensor3 I(nlos, nf, stokes_dim);
595 for (
Index ilos = 0; ilos < nlos; ilos++) {
604 if (iy_transmission.
npages()) {
635 if (iy.
ncols() != stokes_dim || iy.
nrows() != nf) {
637 os <<
"The size of *iy* returned from *" << iy_main_agenda.
name()
640 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n" 641 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols() <<
"]\n";
642 throw runtime_error(os.
str());
650 surface_calc(iy, I, surface_los, surface_rmatrix, surface_emission);
653 if (jacobian_do && dsurface_names.
nelem()) {
658 if (dsurface_emission_dx[
i].empty() || dsurface_rmatrix_dx[
i].empty()) {
660 os <<
"The derivatives for surface quantity: " << dsurface_names[
i]
661 <<
"\nwere not calculated by *iy_surface_agenda*.\n" 662 <<
"That is, *dsurface_emission_dx* and/or *dsurface_rmatrix_dx*\n" 664 throw runtime_error(os.
str());
668 for (
Index j = 0; j < jacobian_quantities.
nelem() && ihit < 0; j++) {
669 if (dsurface_names[
i] == jacobian_quantities[j].Subtag()) {
675 Matrix diy_dpos0, diy_dpos;
679 dsurface_rmatrix_dx[
i],
680 dsurface_emission_dx[i]);
685 jacobian_quantities[ihit],
699 const Index& atmosphere_dim,
708 if (atmosphere_dim == 1) {
709 surface_normal[0] = 0;
710 if (rtp_los[0] < 90) {
712 "Invalid zenith angle. The zenith angle corresponds " 713 "to observe the surface from below.");
715 specular_los[0] = 180 - rtp_los[0];
718 else if (atmosphere_dim == 2) {
719 specular_los[0] =
sign(rtp_los[0]) * 180 - rtp_los[0];
720 surface_normal[0] = 0;
723 else if (atmosphere_dim == 3) {
724 specular_los[0] = 180 - rtp_los[0];
725 specular_los[1] = rtp_los[1];
726 surface_normal[0] = 0;
727 surface_normal[1] = 0;
736 const Index& atmosphere_dim,
739 const Vector& refellipsoid,
741 const Index& ignore_surface_slope,
749 if (atmosphere_dim == 1 || ignore_surface_slope) {
762 if (atmosphere_dim == 2) {
765 gridpos(gp_lat, lat_grid, rtp_pos[1]);
768 c1, lat_grid, refellipsoid, z_surface(
joker, 0), gp_lat, rtp_los[0]);
774 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
776 "Invalid zenith angle. The zenith angle corresponds " 777 "to observe the surface from below.");
780 sign(rtp_los[0]) * 180 - rtp_los[0] + 2 * surface_normal[0];
788 gridpos(gp_lat, lat_grid, rtp_pos[1]);
789 gridpos(gp_lon, lon_grid, rtp_pos[2]);
792 c1, c2, lat_grid, lon_grid, refellipsoid, z_surface, gp_lat, gp_lon, 0);
796 interp(itw, z_surface, gp_lat, gp_lon);
810 Vector tangentSN(3), tangentEW(3), normal(3);
811 zaaa2cart(tangentSN[0], tangentSN[1], tangentSN[2], zaSN, 0);
812 zaaa2cart(tangentEW[0], tangentEW[1], tangentEW[2], zaEW, 90);
813 cross3(normal, tangentSN, tangentEW);
816 zaaa2cart(di[0], di[1], di[2], rtp_los[0], rtp_los[1]);
820 surface_normal[0], surface_normal[1], normal[0], normal[1], normal[2]);
821 if (
abs(rtp_los[0] - surface_normal[0]) < 90) {
823 "Invalid zenith angle. The zenith angle corresponds " 824 "to observe the surface from below.");
830 speccart[
i] = fac * normal[
i] - di[
i];
844 const Index& atmosphere_dim,
846 const Index& stokes_dim,
857 out2 <<
" Sets variables to model a blackbody surface with a temperature " 858 <<
" of " << surface_skin_t <<
" K.\n";
861 surface_rmatrix.
resize(0, 0, 0, 0);
866 planck(b, f_grid, surface_skin_t);
868 surface_emission.
resize(nf, stokes_dim);
869 surface_emission = 0.0;
871 for (
Index iv = 0; iv < nf; iv++) {
872 surface_emission(iv, 0) = b[iv];
873 for (
Index is = 1; is < stokes_dim; is++) {
874 surface_emission(iv, is) = 0;
883 const Index& atmosphere_dim,
884 const Index& stokes_dim,
892 const Vector& transmittance,
893 const Index& fastem_version,
904 Vector specular_los, surface_normal;
920 Numeric rel_azimuth = wind_direction;
921 if (atmosphere_dim == 2 && rtp_los[0] < 0) {
924 }
else if (atmosphere_dim == 3) {
925 rel_azimuth -= rtp_los[1];
930 Matrix emissivity, reflectivity;
945 surface_los(0,
joker) = specular_los;
950 planck(b, f_grid, surface_skin_t);
952 surface_emission.
resize(nf, stokes_dim);
955 surface_emission(
i, 0) = b[
i] * 0.5 * (emissivity(
i, 0) + emissivity(
i, 1));
957 if (stokes_dim >= 2) {
958 surface_emission(
i, 1) =
959 b[
i] * 0.5 * (emissivity(
i, 0) - emissivity(
i, 1));
962 for (
Index j = 2; j < stokes_dim; j++) {
963 surface_emission(
i, j) = b[
i] * emissivity(
i, j);
969 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
970 surface_rmatrix = 0.0;
971 for (
Index iv = 0; iv < nf; iv++) {
972 surface_rmatrix(0, iv, 0, 0) =
973 0.5 * (reflectivity(iv, 0) + reflectivity(iv, 1));
974 if (stokes_dim >= 2) {
975 surface_rmatrix(0, iv, 0, 1) =
976 0.5 * (reflectivity(iv, 0) - reflectivity(iv, 1));
978 surface_rmatrix(0, iv, 1, 0) = surface_rmatrix(0, iv, 0, 1);
979 surface_rmatrix(0, iv, 1, 1) = surface_rmatrix(0, iv, 0, 0);
981 for (
Index i = 2;
i < stokes_dim;
i++) {
982 surface_rmatrix(0, iv,
i,
i) = surface_rmatrix(0, iv, 0, 0);
992 const Index& atmosphere_dim,
993 const Index& stokes_dim,
1000 const Numeric& surface_skin_t,
1011 "surface skin temperature", surface_skin_t, 190.0, 373.0);
1014 Vector specular_los, surface_normal;
1023 Matrix surface_rv_rh(nf, 2);
1029 lat, lon, atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
1032 lon = fmod(lon, 360.0);
1042 throw std::runtime_error(
1043 "Given coordinates are not contained in " 1044 " TELSEM atlas. To enable nearest neighbor" 1045 "interpolation set *d_max* to a positive " 1054 out <<
"Distance of nearest neighbor exceeds provided limit (";
1055 out << d <<
" > " << d_max <<
").";
1056 throw std::runtime_error(out.str());
1067 theta = 180.0 -
abs(rtp_los[0]);
1070 if (f_grid[
i] < 5e9)
1071 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
1072 if (f_grid[
i] > 900e9)
1073 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
1078 std::tie(e_v, e_h) =
1079 atlas.
emis_interp(theta, f, class1, class2, emis_v, emis_h);
1081 surface_rv_rh(i, 0) =
min(
max(1.0 - e_v, r_min), r_max);
1082 surface_rv_rh(i, 1) =
min(
max(1.0 - e_h, r_min), r_max);
1102 Matrix& surface_emission,
1103 const Index& atmosphere_dim,
1104 const Index& stokes_dim,
1108 const Numeric& surface_skin_t,
1119 "surface skin temperature", surface_skin_t, 260.0, 373.0);
1124 Vector specular_los, surface_normal;
1139 in[1] = 180.0 -
abs(rtp_los[0]);
1141 in[3] = surface_skin_t;
1147 Matrix surface_rv_rh(nf, 2);
1150 if (f_grid[
i] < 5e9)
1151 throw std::runtime_error(
"Only frequency >= 5 GHz are allowed");
1152 if (f_grid[
i] > 900e9)
1153 throw std::runtime_error(
"Only frequency <= 900 GHz are allowed");
1181 Matrix& surface_emission,
1183 const Index& stokes_dim,
1184 const Index& atmosphere_dim,
1187 const Vector& specular_los,
1188 const Numeric& surface_skin_t,
1205 Matrix n_real(nf, 1), n_imag(nf, 1);
1209 surface_complex_refr_index,
1210 "surface_complex_refr_index",
1212 Vector(1, surface_skin_t));
1214 out2 <<
" Sets variables to model a flat surface\n";
1215 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
1218 surface_los(0,
joker) = specular_los;
1220 surface_emission.
resize(nf, stokes_dim);
1221 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1225 assert(incang <= 90);
1230 for (
Index iv = 0; iv < nf; iv++) {
1232 Complex n2(n_real(iv, 0), n_imag(iv, 0));
1239 surface_emission(iv,
joker),
1251 Matrix& surface_emission,
1253 const Index& stokes_dim,
1254 const Index& atmosphere_dim,
1257 const Vector& specular_los,
1258 const Numeric& surface_skin_t,
1259 const Tensor3& surface_reflectivity,
1272 if (surface_reflectivity.
nrows() != stokes_dim &&
1273 surface_reflectivity.
ncols() != stokes_dim) {
1275 os <<
"The number of rows and columnss in *surface_reflectivity* must\n" 1276 <<
"match *stokes_dim*." 1277 <<
"\n stokes_dim : " << stokes_dim
1278 <<
"\n number of rows in *surface_reflectivity* : " 1279 << surface_reflectivity.
nrows()
1280 <<
"\n number of columns in *surface_reflectivity* : " 1281 << surface_reflectivity.
ncols() <<
"\n";
1282 throw runtime_error(os.
str());
1285 if (surface_reflectivity.
npages() != nf &&
1286 surface_reflectivity.
npages() != 1) {
1288 os <<
"The number of pages in *surface_reflectivity* should\n" 1289 <<
"match length of *f_grid* or be 1." 1290 <<
"\n length of *f_grid* : " << nf
1291 <<
"\n dimension of *surface_reflectivity* : " 1292 << surface_reflectivity.
npages() <<
"\n";
1293 throw runtime_error(os.
str());
1296 out2 <<
" Sets variables to model a flat surface\n";
1299 surface_los(0,
joker) = specular_los;
1301 surface_emission.
resize(nf, stokes_dim);
1302 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1304 Matrix R, IR(stokes_dim, stokes_dim);
1307 planck(b, f_grid, surface_skin_t);
1311 for (
Index iv = 0; iv < nf; iv++) {
1312 if (iv == 0 || surface_reflectivity.
npages() > 1) {
1314 for (
Index i = 0;
i < stokes_dim;
i++) {
1315 for (
Index j = 0; j < stokes_dim; j++) {
1317 IR(
i, j) = 1 - R(
i, j);
1319 IR(
i, j) = -R(
i, j);
1328 mult(surface_emission(iv,
joker), IR, B);
1335 Matrix& surface_emission,
1337 const Index& stokes_dim,
1338 const Index& atmosphere_dim,
1341 const Vector& specular_los,
1342 const Numeric& surface_skin_t,
1343 const Matrix& surface_rv_rh,
1354 if (surface_rv_rh.
ncols() != 2) {
1356 os <<
"The number of columns in *surface_rv_rh* must be two,\n" 1357 <<
"but the actual number of columns is " << surface_rv_rh.
ncols()
1359 throw runtime_error(os.
str());
1362 if (surface_rv_rh.
nrows() != nf && surface_rv_rh.
nrows() != 1) {
1364 os <<
"The number of rows in *surface_rv_rh* should\n" 1365 <<
"match length of *f_grid* or be 1." 1366 <<
"\n length of *f_grid* : " << nf
1367 <<
"\n rows in *surface_rv_rh* : " << surface_rv_rh.
nrows() <<
"\n";
1368 throw runtime_error(os.
str());
1371 if (
min(surface_rv_rh) < 0 ||
max(surface_rv_rh) > 1) {
1372 throw runtime_error(
"All values in *surface_rv_rh* must be inside [0,1].");
1376 surface_los(0,
joker) = specular_los;
1378 surface_emission.
resize(nf, stokes_dim);
1379 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1381 surface_emission = 0;
1382 surface_rmatrix = 0;
1385 planck(b, f_grid, surface_skin_t);
1387 Numeric rmean = 0.0, rdiff = 0.0;
1389 for (
Index iv = 0; iv < nf; iv++) {
1390 if (iv == 0 || surface_rv_rh.
nrows() > 1) {
1391 rmean = 0.5 * (surface_rv_rh(iv, 0) + surface_rv_rh(iv, 1));
1392 rdiff = 0.5 * (surface_rv_rh(iv, 0) - surface_rv_rh(iv, 1));
1395 surface_emission(iv, 0) = (1.0 - rmean) * b[iv];
1396 surface_rmatrix(0, iv, 0, 0) = rmean;
1398 if (stokes_dim > 1) {
1399 surface_emission(iv, 1) = -rdiff * b[iv];
1401 surface_rmatrix(0, iv, 0, 1) = rdiff;
1402 surface_rmatrix(0, iv, 1, 0) = rdiff;
1403 surface_rmatrix(0, iv, 1, 1) = rmean;
1405 for (
Index i = 2;
i < stokes_dim;
i++) {
1406 surface_rmatrix(0, iv,
i,
i) = rmean;
1415 Matrix& surface_emission,
1417 const Index& stokes_dim,
1418 const Index& atmosphere_dim,
1421 const Vector& specular_los,
1422 const Numeric& surface_skin_t,
1423 const Vector& surface_scalar_reflectivity,
1434 if (surface_scalar_reflectivity.
nelem() != nf &&
1435 surface_scalar_reflectivity.
nelem() != 1) {
1437 os <<
"The number of elements in *surface_scalar_reflectivity* should\n" 1438 <<
"match length of *f_grid* or be 1." 1439 <<
"\n length of *f_grid* : " << nf
1440 <<
"\n length of *surface_scalar_reflectivity* : " 1441 << surface_scalar_reflectivity.
nelem() <<
"\n";
1442 throw runtime_error(os.
str());
1445 if (
min(surface_scalar_reflectivity) < 0 ||
1446 max(surface_scalar_reflectivity) > 1) {
1447 throw runtime_error(
1448 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1452 surface_los(0,
joker) = specular_los;
1454 surface_emission.
resize(nf, stokes_dim);
1455 surface_rmatrix.
resize(1, nf, stokes_dim, stokes_dim);
1457 surface_emission = 0;
1458 surface_rmatrix = 0;
1461 planck(b, f_grid, surface_skin_t);
1465 for (
Index iv = 0; iv < nf; iv++) {
1466 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1467 r = surface_scalar_reflectivity[iv];
1470 surface_emission(iv, 0) = (1.0 -
r) * b[iv];
1471 surface_rmatrix(0, iv, 0, 0) =
r;
1472 for (
Index i = 1;
i < stokes_dim;
i++) {
1473 surface_rmatrix(0, iv,
i,
i) =
r;
1481 Matrix& surface_emission,
1483 const Index& stokes_dim,
1484 const Index& atmosphere_dim,
1487 const Vector& surface_normal,
1488 const Numeric& surface_skin_t,
1489 const Vector& surface_scalar_reflectivity,
1490 const Index& lambertian_nza,
1502 if (surface_scalar_reflectivity.
nelem() != nf &&
1503 surface_scalar_reflectivity.
nelem() != 1) {
1505 os <<
"The number of elements in *surface_scalar_reflectivity* should\n" 1506 <<
"match length of *f_grid* or be 1." 1507 <<
"\n length of *f_grid* : " << nf
1508 <<
"\n length of *surface_scalar_reflectivity* : " 1509 << surface_scalar_reflectivity.
nelem() <<
"\n";
1510 throw runtime_error(os.
str());
1513 if (
min(surface_scalar_reflectivity) < 0 ||
1514 max(surface_scalar_reflectivity) > 1) {
1515 throw runtime_error(
1516 "All values in *surface_scalar_reflectivity* must be inside [0,1].");
1521 surface_los.
resize(lambertian_nza, rtp_los.
nelem());
1522 surface_rmatrix.
resize(lambertian_nza, nf, stokes_dim, stokes_dim);
1523 surface_emission.
resize(nf, stokes_dim);
1526 surface_rmatrix = 0.0;
1527 surface_emission = 0.0;
1532 const Vector za_lims(0.0, lambertian_nza + 1, dza);
1535 for (
Index ip = 0; ip < lambertian_nza; ip++) {
1536 surface_los(ip, 0) = za_lims[ip] + za_pos * dza;
1537 if (atmosphere_dim == 2) {
1538 if (rtp_los[0] < 0) {
1539 surface_los(ip, 0) *= -1.0;
1542 }
else if (atmosphere_dim == 3) {
1543 surface_los(ip, 1) = rtp_los[1];
1548 planck(b, f_grid, surface_skin_t);
1554 for (
Index iv = 0; iv < nf; iv++) {
1556 if (iv == 0 || surface_scalar_reflectivity.
nelem() > 1) {
1557 r = surface_scalar_reflectivity[iv];
1568 for (
Index ip = 0; ip < lambertian_nza; ip++) {
1571 (cos(2 *
DEG2RAD * za_lims[ip]) - cos(2 *
DEG2RAD * za_lims[ip + 1]));
1572 surface_rmatrix(ip, iv, 0, 0) =
w;
1576 surface_emission(iv, 0) = (1 -
r) * b[iv];
1585 Matrix& surface_emission,
1586 const Index& atmosphere_dim,
1590 const Agenda& surface_rtprop_sub_agenda,
1591 const Numeric& specular_factor,
1598 if (specular_factor > 1 || specular_factor < 1.0 / 3.0)
1599 throw runtime_error(
"The valid range for *specular_factor* is [1/3,1].");
1600 if (dza > 45 || dza <= 0)
1601 throw runtime_error(
"The valid range for *dza* is ]0,45].");
1616 surface_rtprop_sub_agenda);
1617 if (los1.
nrows() != 1)
1618 throw runtime_error(
1619 "*surface_rtprop_sub_agenda* must return data " 1620 "describing a specular surface.");
1634 while (failed && dza_try > 0) {
1636 Vector los_new = rtp_los;
1638 sign(rtp_los[0]) * dza_try;
1648 surface_rtprop_sub_agenda);
1650 }
catch (
const runtime_error& e) {
1661 surface_emission = 0;
1670 w = specular_factor;
1672 w = specular_factor + (1.0 - specular_factor) / 2.0;
1678 surface_emission(p,
r) += w * emission1(p,
r);
1679 for (
Index c = 0; c < rmatrix1.
ncols(); c++) {
1680 surface_rmatrix(1, p,
r, c) = w * rmatrix1(0, p,
r, c);
1687 w = (1.0 - specular_factor) / 2.0;
1693 surface_emission(p,
r) += w * emission2(p,
r);
1694 for (
Index c = 0; c < rmatrix1.
ncols(); c++) {
1695 surface_rmatrix(2, p,
r, c) = w * rmatrix2(0, p,
r, c);
1703 Vector los_new = rtp_los;
1704 los_new[0] +=
sign(rtp_los[0]) * dza;
1714 surface_rtprop_sub_agenda);
1719 surface_emission(p,
r) += w * emission2(p,
r);
1720 for (
Index c = 0; c < rmatrix1.
ncols(); c++) {
1721 surface_rmatrix(0, p,
r, c) = w * rmatrix2(0, p,
r, c);
1730 const Index& atmosphere_dim,
1733 const Numeric& specular_factor,
1740 if (surface_los.
nrows() != 1)
1741 throw runtime_error(
1742 "Input surface data must be of specular type. That is, " 1743 "*surface_los* must contain a single direction.");
1744 if (surface_rmatrix.
nbooks() != 1)
1745 throw runtime_error(
1746 "*surface_rmatrix* describes a different number of " 1747 "directions than *surface_los*.");
1750 if (specular_factor > 1 || specular_factor < 1.0 / 3.0)
1751 throw runtime_error(
"The valid range for *specular_factor* is [1/3,1].");
1752 if (dza > 45 || dza <= 0)
1753 throw runtime_error(
"The valid range for *dza* is ]0,45].");
1756 const Matrix los1 = surface_los;
1757 const Tensor4 rmatrix1 = surface_rmatrix;
1764 const Numeric za_max = 89 + (180 -
abs(los1(0, 0)) -
abs(rtp_los[0])) / 2.0;
1768 if (
abs(los1(0, 0)) > za_max) {
1776 for (
Index r = 0;
r < nbeams;
r++) {
1777 surface_los(
r, 0) = ((
Numeric)
r - 1.0) * dza +
abs(los1(0, 0));
1778 if (
r == 2 && surface_los(
r, 0) > za_max) {
1779 surface_los(
r, 0) = za_max;
1782 surface_los(
r, c) = los1(0, c);
1791 for (
Index b = 0; b < nbeams; b++) {
1793 if (b == 1 && nbeams == 3)
1795 w = specular_factor;
1798 w = specular_factor + (1.0 - specular_factor) / 2.0;
1801 w = (1.0 - specular_factor) / 2.0;
1806 for (
Index c = 0; c < rmatrix1.
ncols(); c++) {
1807 surface_rmatrix(b, p,
r, c) = w * rmatrix1(0, p,
r, c);
1814 if (atmosphere_dim == 1) {
1816 surface_los(0, 0) =
abs(surface_los(0, 0));
1817 }
else if (atmosphere_dim == 2) {
1819 if (los1(0, 0) < 0) {
1821 surface_los(
r, 0) = -surface_los(
r, 0);
1824 }
else if (atmosphere_dim == 1) {
1826 if (surface_los(0, 0) < 0) {
1827 surface_los(0, 0) = -surface_los(0, 0);
1828 surface_los(0, 1) += 180;
1829 if (surface_los(0, 1) > 180) {
1830 surface_los(0, 1) -= 360;
1839 const Index& atmosphere_dim,
1847 Index gfield_fID = 0;
1848 Index gfield_tID = 1;
1849 Index gfield_compID = 2;
1850 Index gfield_latID = 3;
1851 Index gfield_lonID = 4;
1871 if (nlat < 2 || nlon < 2) {
1873 os <<
"The data in *complex_refr_index_field* must span a geographical " 1874 <<
"region. That is,\nthe latitude and longitude grids must have a " 1880 os <<
"The data in *complex_refr_index_field* must have exactly two " 1881 <<
"pages. One page each\nfor the real and imaginary part of the " 1882 <<
"complex refractive index.";
1891 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
1899 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
1902 surface_complex_refr_index.
resize(nf, nt, 2);
1904 surface_complex_refr_index.
set_grid(
1907 surface_complex_refr_index.
set_grid(
1910 surface_complex_refr_index.
set_grid(2, {
"real",
"imaginary"});
1915 gridpos(gp_lat, GFlat, lat[0]);
1916 gridpos(gp_lon, lon_shifted, lon[0]);
1920 for (
Index iv = 0; iv < nf; iv++) {
1921 for (
Index it = 0; it < nt; it++) {
1922 surface_complex_refr_index.
data(iv, it, 0) =
interp(
1923 itw, complex_n_field.
data(iv, it, 0,
joker,
joker), gp_lat, gp_lon);
1924 surface_complex_refr_index.
data(iv, it, 1) =
interp(
1925 itw, complex_n_field.
data(iv, it, 1,
joker,
joker), gp_lat, gp_lon);
1932 const Index& stokes_dim,
1934 const Index& atmosphere_dim,
1963 if (nlat < 2 || nlon < 2) {
1965 os <<
"The data in *r_field* must span a geographical region. That is,\n" 1966 <<
"the latitude and longitude grids must have a length >= 2.";
1967 throw runtime_error(os.
str());
1972 os <<
"The data in *r_field* must span a range of zenith angles. That\n" 1973 <<
"is the zenith angle grid must have a length >= 2.";
1974 throw runtime_error(os.
str());
1976 if (ns1 < stokes_dim || ns2 < stokes_dim || ns1 > 4 || ns2 > 4) {
1978 os <<
"The \"Stokes dimensions\" must have a size that is >= " 1979 <<
"*stokes_dim* (but not exceeding 4).";
1980 throw runtime_error(os.
str());
1986 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
1993 Tensor4 r_f_za(nf_in, stokes_dim, stokes_dim, nza);
2000 gridpos(gp_lon, lon_shifted, lon[0]);
2003 for (
Index iv = 0; iv < nf_in; iv++) {
2004 for (
Index iz = 0; iz < nza; iz++) {
2005 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2006 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2007 r_f_za(iv, is1, is2, iz) =
2019 Tensor3 r_f(nf_in, stokes_dim, stokes_dim);
2025 Vector incang(1, 180 - rtp_los[0]);
2029 Matrix itw(1, order + 1);
2034 for (
Index i = 0;
i < nf_in;
i++) {
2035 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2036 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2038 r_f(
i, is1, is2) = tmp[0];
2047 surface_reflectivity = r_f;
2052 surface_reflectivity.
resize(nf_out, stokes_dim, stokes_dim);
2058 for (
Index is1 = 0; is1 < stokes_dim; is1++) {
2059 for (
Index is2 = 0; is2 < stokes_dim; is2++) {
2062 r_f(
joker, is1, is2),
2071 Vector& surface_scalar_reflectivity,
2072 const Index& stokes_dim,
2074 const Index& atmosphere_dim,
2099 if (nlat < 2 || nlon < 2) {
2101 os <<
"The data in *r_field* must span a geographical region. That is,\n" 2102 <<
"the latitude and longitude grids must have a length >= 2.";
2103 throw runtime_error(os.
str());
2108 os <<
"The data in *r_field* must span a range of zenith angles. That\n" 2109 <<
"is the zenith angle grid must have a length >= 2.";
2110 throw runtime_error(os.
str());
2116 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2123 Matrix r_f_za(nf_in, nza);
2130 gridpos(gp_lon, lon_shifted, lon[0]);
2133 for (
Index iv = 0; iv < nf_in; iv++) {
2134 for (
Index iz = 0; iz < nza; iz++) {
2148 Vector incang(1, 180 - rtp_los[0]);
2152 Matrix itw(1, order + 1);
2157 for (
Index i = 0;
i < nf_in;
i++) {
2166 surface_scalar_reflectivity.
resize(1);
2167 surface_scalar_reflectivity[0] = r_f[0];
2172 surface_scalar_reflectivity.
resize(nf_out);
2178 interp(surface_scalar_reflectivity, itw, r_f, gp);
2184 Vector& surface_scalar_reflectivity,
2185 const Tensor4& surface_rmatrix,
2190 surface_scalar_reflectivity.
resize(nf);
2191 surface_scalar_reflectivity = 0;
2194 for (
Index l = 0; l < nlos; l++) {
2195 surface_scalar_reflectivity[
i] += surface_rmatrix(l,
i, 0, 0);
2227 const Index& atmosphere_dim,
2235 Index gfield_latID = 0;
2236 Index gfield_lonID = 1;
2250 if (nlat < 2 || nlon < 2) {
2252 os <<
"The data in *surface_type_mask* must span a geographical " 2253 <<
"region. That is,\nthe latitude and longitude grids must have a " 2263 lat[0], lon[0], atmosphere_dim, lat_grid, lat_true, lon_true, rtp_pos);
2271 chk_if_in_range(
"rtp_pos.lon", lon[0], lon_shifted[0], lon_shifted[nlon - 1]);
2275 gridpos(gp_lat, GFlat, lat[0]);
2276 gridpos(gp_lon, lon_shifted, lon[0]);
2280 if (gp_lat.
fd[0] < 0.5) {
2283 ilat = gp_lat.
idx + 1;
2285 if (gp_lon.
fd[0] < 0.5) {
2288 ilon = gp_lon.
idx + 1;
2291 surface_type = (
Index)floor(surface_type_mask.
data(ilat, ilon));
2292 surface_type_aux = surface_type_mask.
data(ilat, ilon) -
Numeric(surface_type);
2300 Matrix& surface_emission,
2305 const Index& surface_type,
2306 const Numeric& surface_type_aux,
2308 if (surface_type < 0)
2309 throw runtime_error(
"*surface_type* is not allowed to be negative.");
2310 if (surface_type >= surface_rtprop_agenda_array.
nelem()) {
2312 os <<
"*surface_rtprop_agenda_array* has only " 2313 << surface_rtprop_agenda_array.
nelem()
2314 <<
" elements,\n while you have selected element " << surface_type;
2315 throw runtime_error(os.
str());
2328 surface_rtprop_agenda_array);
2334 const Index& atmosphere_dim,
2337 const Tensor3& surface_props_data,
2340 const Index& jacobian_do,
2342 if (surface_props_names.
nelem())
2343 throw runtime_error(
2344 "When calling this method, *surface_props_names* should be empty.");
2350 surface_props_names);
2355 dsurface_rmatrix_dx,
2356 dsurface_emission_dx);
2364 Matrix& surface_emission,
2366 const Index& stokes_dim,
2367 const Index& atmosphere_dim,
2375 const Tensor3& surface_props_data,
2378 const Index& jacobian_do,
2385 surface_props_names);
2391 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2397 "Water skin temperature",
2403 surface_props_names);
2414 surface_props_names);
2425 surface_props_names);
2447 dsurface_rmatrix_dx,
2448 dsurface_emission_dx);
2458 dsurface_rmatrix_dx[irq],
2459 dsurface_emission_dx[irq],
2472 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2473 dsurface_rmatrix_dx[irq] /= dd;
2474 dsurface_emission_dx[irq] -= surface_emission;
2475 dsurface_emission_dx[irq] /= dd;
2484 dsurface_rmatrix_dx[irq],
2485 dsurface_emission_dx[irq],
2498 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2499 dsurface_rmatrix_dx[irq] /= dd;
2500 dsurface_emission_dx[irq] -= surface_emission;
2501 dsurface_emission_dx[irq] /= dd;
2510 dsurface_rmatrix_dx[irq],
2511 dsurface_emission_dx[irq],
2524 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2525 dsurface_rmatrix_dx[irq] /= dd;
2526 dsurface_emission_dx[irq] -= surface_emission;
2527 dsurface_emission_dx[irq] /= dd;
2536 Matrix& surface_emission,
2538 const Index& stokes_dim,
2539 const Index& atmosphere_dim,
2545 const Tensor3& surface_props_data,
2548 const Index& jacobian_do,
2549 const Vector& transmittance,
2550 const Index& fastem_version,
2557 surface_props_names);
2563 gp_lat[0], gp_lon[0], atmosphere_dim, lat_grid, lon_grid, rtp_pos);
2569 "Water skin temperature",
2575 surface_props_names);
2586 surface_props_names);
2589 Vector wind_direction(1);
2597 surface_props_names);
2608 surface_props_names);
2631 dsurface_rmatrix_dx,
2632 dsurface_emission_dx);
2642 dsurface_rmatrix_dx[irq],
2643 dsurface_emission_dx[irq],
2657 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2658 dsurface_rmatrix_dx[irq] /= dd;
2659 dsurface_emission_dx[irq] -= surface_emission;
2660 dsurface_emission_dx[irq] /= dd;
2669 dsurface_rmatrix_dx[irq],
2670 dsurface_emission_dx[irq],
2684 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2685 dsurface_rmatrix_dx[irq] /= dd;
2686 dsurface_emission_dx[irq] -= surface_emission;
2687 dsurface_emission_dx[irq] /= dd;
2696 dsurface_rmatrix_dx[irq],
2697 dsurface_emission_dx[irq],
2706 wind_direction[0] + dd,
2711 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2712 dsurface_rmatrix_dx[irq] /= dd;
2713 dsurface_emission_dx[irq] -= surface_emission;
2714 dsurface_emission_dx[irq] /= dd;
2723 dsurface_rmatrix_dx[irq],
2724 dsurface_emission_dx[irq],
2738 dsurface_rmatrix_dx[irq] -= surface_rmatrix;
2739 dsurface_rmatrix_dx[irq] /= dd;
2740 dsurface_emission_dx[irq] -= surface_emission;
2741 dsurface_emission_dx[irq] /= dd;
2754 if (iy_aux_vars[
i] ==
"Optical depth") {
2761 throw runtime_error(
"No element in *iy_aux* holds optical depths.");
2763 const Index n = iy_aux[ihit].nrows();
2768 transmittance[
i] = exp(-iy_aux[ihit](
i, 0));
Index npages() const
Returns the number of pages.
INDEX Index
The type to use for all integer numbers and indices.
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 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 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)
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
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.
std::pair< Numeric, Numeric > get_coordinates(Index cellnum) const
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.
Index nrows() const
Returns the number of rows.
Vector get_emis_h(Index cellnum) const
Index calc_cellnum(Numeric lat, Numeric lon) const
A class implementing complex numbers for ARTS.
void cross3(VectorView c, const ConstVectorView &a, const ConstVectorView &b)
cross3
void checksize_strict() const final
Strict consistency check.
String name() const
Agenda name.
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 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 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 iy_transmission_mult(Tensor3 &iy_trans_total, ConstTensor3View iy_trans_old, ConstTensor3View iy_trans_new)
Multiplicates iy_transmission with transmissions.
Index nelem() const
Number of elements.
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 surface_typeInterpTypeMask(Index &surface_type, Numeric &surface_type_aux, 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: surface_typeInterpTypeMask.
Declarations having to do with the four output streams.
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 zaaa2cart(Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
Converts zenith and azimuth angles to a cartesian unit vector.
Index nvitrines() const
Returns the number of vitrines.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
Numeric fac(const Index n)
fac
Numeric calc_incang(ConstVectorView rte_los, ConstVectorView specular_los)
Calculates the incidence angle for a flat surface, based on rte_los and specular_los.
bool contains(Index cellnumber) const
void iySurfaceCallAgendaX(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const String &iy_unit, const Tensor3 &iy_transmission, 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 Index &surface_type, const Numeric &surface_type_aux, const Verbosity &)
WORKSPACE METHOD: iySurfaceCallAgendaX.
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 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.
Index npages() const
Returns the number of pages.
void cart2zaaa(Numeric &za, Numeric &aa, const Numeric &dx, const Numeric &dy, const Numeric &dz)
Converts a cartesian directional vector to zenith and azimuth.
invlib::Vector< ArtsVector > Vector
invlib wrapper type for ARTS vectors.
cmplx FADDEEVA() w(cmplx z, double relerr)
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 checksize_strict() const final
Strict consistency check.
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 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.
Header file for interpolation.cc.
Index nbooks() const
Returns the number of books.
Numeric refell2d(ConstVectorView refellipsoid, ConstVectorView lat_grid, const GridPos gp)
refell2d
void surface_scalar_reflectivityFromSurface_rmatrix(Vector &surface_scalar_reflectivity, const Tensor4 &surface_rmatrix, const Verbosity &)
WORKSPACE METHOD: surface_scalar_reflectivityFromSurface_rmatrix.
Index nrows() const
Returns the number of rows.
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 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.
Index nrows() const
Returns the number of rows.
void fresnel(Complex &Rv, Complex &Rh, const Complex &n1, const Complex &n2, const Numeric &theta)
fresnel
void resolve_lon(Numeric &lon, const Numeric &lon5, const Numeric &lon6)
Resolves which longitude angle that shall be used.
Index nelem() const
Returns the number of elements.
void iy_surface_agenda_arrayExecute(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Index agenda_array_index, const String &iy_unit, const Tensor3 &iy_transmission, 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)
Structure to store a grid position.
Numeric sign(const Numeric &x)
sign
Index get_class2(Index cellnumber) const
This file contains the definition of Array.
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.
Index ncols() const
Returns the number of columns.
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 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.
Index get_class1(Index cellnumber) const
The global header file for ARTS.
Index nshelves() const
Returns the number of shelves.
Vector get_emis_v(Index i) const
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 checksize_strict() const final
Strict consistency check.
This file contains functions that are adapted from FASTEM code which is used to calculate surface emi...
void pos2true_latlon(Numeric &lat, Numeric &lon, const Index &atmosphere_dim, ConstVectorView lat_grid, ConstVectorView lat_true, ConstVectorView lon_true, ConstVectorView pos)
Determines the true alt and lon for an "ARTS position".
_CS_string_type str() const
std::complex< Numeric > Complex
Index calc_cellnum_nearest_neighbor(Numeric lat, Numeric lon) const
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 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.
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.
Index ncols() const
Returns the number of columns.
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 sphdist(const Numeric &lat1, const Numeric &lon1, const Numeric &lat2, const Numeric &lon2)
sphdist
void set_grid(Index i, const Vector &g)
Set a numeric grid.
void transmittanceFromIy_aux(Vector &transmittance, const ArrayOfString &iy_aux_vars, const ArrayOfMatrix &iy_aux, const Verbosity &)
WORKSPACE METHOD: transmittanceFromIy_aux.
This file contains functions that are adapted from TESSEM code which is used to calculate surface emi...
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const Tensor3 &iy_transmission, 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)
Index nrows() const
Returns the number of rows.
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
NUMERIC Numeric
The type to use for all floating point numbers.
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 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.
Numeric plevel_angletilt(const Numeric &r, const Numeric &c1)
Calculates the angular tilt of the surface or a pressure level.
void gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac)
The maximum difference from 1 that we allow for a sum check.
Array< String > ArrayOfString
An array of Strings.
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.
std::pair< Numeric, Numeric > emis_interp(Numeric theta, Numeric freq, Index class1, Index class2, const ConstVectorView &ev, const ConstVectorView &eh) const
Header file for special_interp.cc.
Propagation path structure and functions.
void resize(Index p, Index r, Index c)
Resize function.
void mult(ComplexVectorView y, const ConstComplexMatrixView &M, const ConstComplexVectorView &x)
Matrix-Vector Multiplication.
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.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
Index npages() const
Returns the number of pages.
This can be used to make arrays out of anything.
Index nshelves() const
Returns the number of shelves.
Index ncols() const
Returns the number of columns.
void lon_shiftgrid(Vector &longrid_out, ConstVectorView longrid_in, const Numeric lon)
lon_shiftgrid
void iySurfaceFastem(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Tensor3 &iy_transmission, 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 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 surface_calc(Matrix &iy, ConstTensor3View I, ConstMatrixView surface_los, ConstTensor4View surface_rmatrix, ConstMatrixView surface_emission)
Weights together downwelling radiation and surface emission.
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 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 resize(Index n)
Resize function.
void checksize_strict() const final
Strict consistency check.
Index npages() const
Returns the number of pages.
void tessem_prop_nn(VectorView &ny, const TessemNN &net, ConstVectorView nx)
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_transmission, 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.
Numeric planck(const Numeric &f, const Numeric &t)
planck
Index nbooks() const
Returns the number of books.
void set_grid_name(Index i, const String &s)
Set grid name.
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 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...
Index ncols() const
Returns the number of columns.
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 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.
The structure to describe a propagation path and releated quantities.
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.
Index ncols() const
Returns the number of columns.
void resize(const GriddedField3 &gf)
Make this GriddedField3 the same size as the given one.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
void iySurfaceRtpropAgenda(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Tensor3 &iy_transmission, 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 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.
This file contains declerations of functions of physical character.
Index nrows() const
Returns the number of rows.
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 Index &surface_type, const Numeric &surface_type_aux, const Verbosity &)
WORKSPACE METHOD: surface_rtpropCallAgendaX.
void resize(Index b, Index p, Index r, Index c)
Resize function.
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)
my_basic_string< char > String
The String type for ARTS.
Declaration of functions in rte.cc.
void resize(Index r, Index c)
Resize function.
Index nbooks() const
Returns the number of books.