83 const Index & atmosphere_dim )
85 if( atmosphere_dim == 1 )
87 if( los[0] < 0 ) { los[0] = -los[0]; }
88 else if( los[0] > 180 ) { los[0] = 360-los[0]; }
90 else if( atmosphere_dim == 2 )
92 if( los[0] < -180 ) { los[0] = los[0] + 360; }
93 else if( los[0] > 180 ) { los[0] = los[0] - 360; }
98 if(
abs(los[0]-90) > 90 ||
abs(los[1]) > 180 )
140 assert( f_grid.
nelem() == nf );
149 else if( y_unit ==
"RJBT" )
151 for(
Index iv=0; iv<nf; iv++ )
157 { iy(iv,is) *= scfac; }
159 { iy(iv,is) *= 2*scfac; }
164 else if( y_unit ==
"PlanckBT" )
166 for(
Index iv=0; iv<nf; iv++ )
168 for(
Index is=ns-1; is>=0; is-- )
171 { iy(iv,is) =
invplanck( iy(iv,is), f_grid[iv] ); }
172 else if( i_pol[is] < 5 )
174 assert( i_pol[0] == 1 );
176 invplanck( 0.5*(iy(iv,0)+iy(iv,is)), f_grid[iv] ) -
177 invplanck( 0.5*(iy(iv,0)-iy(iv,is)), f_grid[iv] );
180 { iy(iv,is) =
invplanck( 2*iy(iv,is), f_grid[iv] ); }
185 else if ( y_unit ==
"W/(m^2 m sr)" )
187 for(
Index iv=0; iv<nf; iv++ )
191 { iy(iv,is) *= scfac; }
195 else if ( y_unit ==
"W/(m^2 m-1 sr)" )
203 os <<
"Unknown option: y_unit = \"" << y_unit <<
"\"\n" 204 <<
"Recognised choices are: \"1\", \"RJBT\", \"PlanckBT\"" 205 <<
"\"W/(m^2 m sr)\" and \"W/(m^2 m-1 sr)\"";
207 throw runtime_error( os.str() );
247 assert( J.
nrows() == nf );
249 assert( f_grid.
nelem() == nf );
258 else if( y_unit ==
"RJBT" )
260 for(
Index iv=0; iv<nf; iv++ )
267 for(
Index ip=0; ip<np; ip++ )
268 { J(ip,iv,is) *= scfac; }
272 for(
Index ip=0; ip<np; ip++ )
273 { J(ip,iv,is) *= 2*scfac; }
279 else if( y_unit ==
"PlanckBT" )
283 for(
Index is=ns-1; is>=0; is-- )
288 else if( i_pol[is] < 5 )
290 assert( i_pol[0] == 1 );
298 for(
Index ip=0; ip<np; ip++ )
299 { J(ip,iv,is) *= scfac; }
304 else if ( y_unit ==
"W/(m^2 m sr)" )
306 for(
Index iv=0; iv<nf; iv++ )
309 for(
Index ip=0; ip<np; ip++ )
312 { J(ip,iv,is) *= scfac; }
317 else if ( y_unit ==
"W/(m^2 m-1 sr)" )
325 os <<
"Unknown option: y_unit = \"" << y_unit <<
"\"\n" 326 <<
"Recognised choices are: \"1\", \"RJBT\", \"PlanckBT\"" 327 <<
"\"W/(m^2 m sr)\" and \"W/(m^2 m-1 sr)\"";
329 throw runtime_error( os.str() );
411 const Agenda& ppath_step_agenda,
412 const Numeric& ppath_lraytrace,
413 const Index& atmosphere_dim,
427 bool invert_lat =
false;
428 if( atmosphere_dim == 1 && ( rte_los[0] < 0 || rte_los[0] > 180 ) )
429 { invert_lat =
true; }
437 ppath_calc( ws, ppx, ppath_step_agenda, atmosphere_dim, p_grid, lat_grid,
438 lon_grid, t_field, z_field, vmr_field,
440 rte_pos, rte_los, ppath_lraytrace, 0, verbosity );
448 for(
Index i=1; i<=ilast; i++ )
449 { lox[i] = lox[i-1] + ppx.
lstep[i-1] * ( ppx.
nreal[i-1] +
450 ppx.
nreal[i] ) / 2.0; }
455 if( lox[ilast] < lo0 )
457 const Numeric dl = lo0 - lox[ilast];
458 if( atmosphere_dim < 3 )
463 cart2pol( pos[0], pos[1], x+dl*dx, z+dl*dz, ppx.
pos(ilast,1),
470 ppx.
pos(ilast,2), ppx.
los(ilast,0), ppx.
los(ilast,1) );
471 cart2sph( pos[0], pos[1], pos[2], x+dl*dx, y+dl*dy, z+dl*dz,
472 ppx.
pos(ilast,1), ppx.
pos(ilast,2),
473 ppx.
los(ilast,0), ppx.
los(ilast,1) );
485 pos[0] =
interp( itw, ppx.
r, gp );
487 if( atmosphere_dim == 3 )
492 { pos[1] = -pos[1]; }
533 const Agenda& ppath_step_agenda,
534 const Index& atmosphere_dim,
545 const Numeric& ppath_lraytrace,
552 for(
Index i=0; i<=ppath.
np-2; i++ )
553 { lp += ppath.
lstep[i];
572 ppath_step_agenda, ppath_lraytrace, atmosphere_dim,
573 p_grid, lat_grid, lon_grid, t_field, z_field,
574 vmr_field, f_grid, refellipsoid,
575 z_surface, verbosity );
585 ppath_step_agenda, ppath_lraytrace, atmosphere_dim,
586 p_grid, lat_grid, lon_grid, t_field, z_field,
587 vmr_field, f_grid, refellipsoid,
588 z_surface, verbosity );
592 if( backg1 == backg2 )
595 if( atmosphere_dim < 3 )
596 {
distance2D( l12, pos1[0], pos1[1], pos2[0], pos2[1] ); }
599 pos2[0], pos2[1], pos2[2] ); }
607 if( atmosphere_dim == 1 )
609 const Numeric r = refellipsoid[0];
612 else if( atmosphere_dim == 2 )
622 ppath.
end_pos[2], pos2[0], pos2[1], pos2[2] );
666 const Agenda& ppath_step_agenda,
667 const Index& atmosphere_dim,
678 const Numeric& ppath_lraytrace,
683 throw runtime_error(
"The function *defocusing_sat2sat* can only be used " 684 "for limb sounding geometry." );
693 for(
Index i=it; i<=ppath.
np-2; i++ )
694 { lt += ppath.
lstep[i]; }
695 for(
Index i=0; i<it; i++ )
696 { lr += ppath.
lstep[i]; }
705 const Numeric lf = lr*lt / (lr+lt);
706 const Numeric alt = 1 / ( 1 - alpha0*lf / refellipsoid[0] );
709 Numeric alpha1, a1, alpha2, a2, dada;
716 ppath_calc( ws, ppt, ppath_step_agenda, atmosphere_dim, p_grid, lat_grid,
717 lon_grid, t_field, z_field, vmr_field,
719 rte_pos, rte_los, ppath_lraytrace, 0, verbosity );
726 ppath_calc( ws, ppt, ppath_step_agenda, atmosphere_dim, p_grid, lat_grid,
727 lon_grid, t_field, z_field, vmr_field,
729 rte_pos, rte_los, ppath_lraytrace, 0, verbosity );
739 dada = (alpha2-alpha1) / (a2-a1);
743 dada = (alpha2-alpha0) / (a2-a0);
747 const Numeric zlt = 1 / ( 1 - dada*lf );
781 const Index& atmosphere_dim )
784 const Numeric f = sqrt( u*u + v*v + w*w );
787 const Numeric za_f = acos( w/f );
788 const Numeric aa_f = atan2( u, v );
796 return f * ( cos(za_f) * cos(za_p) +
797 sin(za_f) * sin(za_p) * cos(aa_f-aa_p) );
824 const Index& stokes_dim,
831 assert( t.
ncols() == stokes_dim && t.
nrows() == stokes_dim );
832 assert( t.
npages() == nf );
833 assert( extmat_case.
nelem() == nf );
836 if( stokes_dim == 1 )
838 for(
Index iv=0; iv<nf; iv++ )
839 { iy(iv,0) = iy(iv,0) * t(iv,0,0) + bbar[iv] * ( 1 - t(iv,0,0) ); }
844 #pragma omp parallel for \ 845 if (!arts_omp_in_parallel() \ 846 && nf >= arts_omp_get_max_threads()) 847 for(
Index iv=0; iv<nf; iv++ )
849 assert( extmat_case[iv]>=1 && extmat_case[iv]<=3 );
851 if( extmat_case[iv] == 1 )
853 iy(iv,0) = iy(iv,0) * t(iv,0,0) + bbar[iv] * ( 1 - t(iv,0,0) );
854 for(
Index is=1; is<stokes_dim; is++ )
855 { iy(iv,is) = iy(iv,is) * t(iv,is,is); }
864 iy(iv,0) = tt[0] + bbar[iv] * ( 1 - t(iv,0,0) );
866 for(
Index i=1; i<stokes_dim; i++ )
867 { iy(iv,i) = tt[i] - bbar[iv] * t(iv,i,0); }
911 assert( ext_mat.
nrows()==stokes_dim );
912 assert( trans_mat.
nrows()==stokes_dim && trans_mat.
ncols()==stokes_dim );
919 assert( icase>=0 && icase<=3 );
921 assert( lstep >= 0 );
929 if( stokes_dim == 1 )
936 assert( ext_mat(1,1) == ext_mat(0,0) );
937 assert( ext_mat(1,0) == ext_mat(0,1) );
939 if( ext_mat(1,0) != 0 )
942 if( stokes_dim >= 3 )
944 assert( ext_mat(2,2) == ext_mat(0,0) );
945 assert( ext_mat(2,1) == -ext_mat(1,2) );
946 assert( ext_mat(2,0) == ext_mat(0,2) );
948 if( ext_mat(2,0) != 0 || ext_mat(2,1) != 0 )
953 assert( ext_mat(3,3) == ext_mat(0,0) );
954 assert( ext_mat(3,2) == -ext_mat(2,3) );
955 assert( ext_mat(3,1) == -ext_mat(1,3) );
956 assert( ext_mat(3,0) == ext_mat(0,3) );
960 if( ext_mat(3,0) != 0 || ext_mat(3,1) != 0 )
962 else if( ext_mat(3,2) != 0 )
975 trans_mat(0,0) = exp( -ext_mat(0,0) * lstep );
976 for(
Index i=1; i<stokes_dim; i++ )
977 { trans_mat(i,i) = trans_mat(0,0); }
980 else if( icase == 2 )
984 const Numeric tI = exp( -ext_mat(0,0) * lstep );
985 const Numeric HQ = ext_mat(0,1) * lstep;
986 trans_mat(0,0) = tI * cosh( HQ );
987 trans_mat(1,1) = trans_mat(0,0);
988 trans_mat(1,0) = -tI * sinh( HQ );
989 trans_mat(0,1) = trans_mat(1,0);
990 if( stokes_dim >= 3 )
996 const Numeric RQ = ext_mat(2,3) * lstep;
997 trans_mat(2,2) = tI * cos( RQ );
1004 trans_mat(3,3) = trans_mat(2,2);
1005 trans_mat(3,2) = tI * sin( RQ );
1006 trans_mat(2,3) = -trans_mat(3,2);
1012 Matrix ext_mat_ds = ext_mat;
1013 ext_mat_ds *= -lstep;
1052 const Index& cloudbox_on,
1057 const Agenda& iy_main_agenda )
1062 Tensor3 iy_transmission(0,0,0);
1066 vmr_field, f_grid, rte_pos, rte_los, rte_pos2,
1111 const Index& jacobian_do,
1114 const Index& atmosphere_dim,
1118 const Index& cloudbox_on,
1119 const Index& stokes_dim,
1121 const Agenda& iy_main_agenda,
1122 const Agenda& iy_space_agenda,
1123 const Agenda& iy_surface_agenda,
1124 const Agenda& iy_cloudbox_agenda,
1140 rtp_pos.
resize( atmosphere_dim );
1141 rtp_pos = ppath.
pos(np-1,
Range(0,atmosphere_dim));
1145 out3 <<
"Radiative background: " << ppath.
background <<
"\n";
1157 agenda_name =
"iy_space_agenda";
1166 agenda_name =
"iy_surface_agenda";
1169 jacobian_do, t_field, z_field, vmr_field,
1170 f_grid, iy_main_agenda, rtp_pos, rtp_los,
1171 rte_pos2, iy_surface_agenda );
1178 agenda_name =
"iy_cloudbox_agenda";
1181 iy_cloudbox_agenda );
1190 if( iy.
ncols() != stokes_dim || iy.
nrows() != nf )
1193 os <<
"The size of *iy* returned from *" << agenda_name <<
"* is\n" 1195 <<
" expected size = [" << nf <<
"," << stokes_dim <<
"]\n" 1196 <<
" size of iy = [" << iy.
nrows() <<
"," << iy.
ncols()<<
"]\n";
1197 throw runtime_error( os.str() );
1240 const Index& atmosphere_dim,
1256 itw2p( ppath_p, p_grid, ppath.
gp_p, itw_p );
1269 for(
Index is=0; is<
ns; is++ )
1281 if( wind_u_field.
npages() > 0 )
1286 if( wind_v_field.
npages() > 0 )
1291 if( wind_w_field.
npages() > 0 )
1301 if( mag_u_field.
npages() > 0 )
1306 if( mag_v_field.
npages() > 0 )
1311 if( mag_w_field.
npages() > 0 )
1355 const Agenda& propmat_clearsky_agenda,
1363 const Index& stokes_dim,
1373 for(
Index i=0; i<nisp; i++ )
1375 assert( ispecies[i] >= 0 );
1376 assert( ispecies[i] < nabs );
1383 ppath_abs.
resize( nf, stokes_dim, stokes_dim, np );
1384 abs_per_species.
resize( nisp, nf, stokes_dim, stokes_dim, np );
1386 catch (std::bad_alloc x)
1389 os <<
"Run-time error in function: get_ppath_abs" << endl
1390 <<
"Memory allocation failed for ppath_abs(" 1391 << nabs <<
", " << nf <<
", " << stokes_dim <<
", " 1392 << stokes_dim <<
", " << np <<
")" << endl;
1393 throw runtime_error(os.str());
1397 bool failed =
false;
1402 Agenda l_propmat_clearsky_agenda (propmat_clearsky_agenda);
1405 #pragma omp parallel for \ 1406 if (!arts_omp_in_parallel() \ 1407 && np >= arts_omp_get_max_threads()) \ 1408 firstprivate(l_ws, l_propmat_clearsky_agenda) 1409 for(
Index ip=0; ip<np; ip++ )
1411 if (failed)
continue;
1423 ppath_p[ip], ppath_t[ip], ppath_vmr(
joker,ip),
1424 l_propmat_clearsky_agenda );
1430 ppath_p[ip], ppath_t[ip],
Vector(0), l_propmat_clearsky_agenda );
1432 }
catch (runtime_error e) {
1433 #pragma omp critical (get_ppath_abs_fail) 1434 { failed =
true; fail_msg = e.what();}
1440 assert( propmat_clearsky.
ncols() == stokes_dim );
1441 assert( propmat_clearsky.
nrows() == stokes_dim );
1442 assert( propmat_clearsky.
npages() == nf );
1445 for(
Index i1=0; i1<nf; i1++ )
1447 for(
Index i2=0; i2<stokes_dim; i2++ )
1449 for(
Index i3=0; i3<stokes_dim; i3++ )
1451 ppath_abs(i1,i2,i3,ip) = propmat_clearsky(
joker,i1,i2,i3).sum();
1453 for(
Index ia=0; ia<nisp; ia++ )
1455 abs_per_species(ia,i1,i2,i3,ip) =
1456 propmat_clearsky(ispecies[ia],i1,i2,i3);
1466 throw runtime_error(fail_msg);
1490 const Agenda& blackbody_radiation_agenda,
1501 ppath_blackrad.
resize( nf, np );
1503 for(
Index ip=0; ip<np; ip++ )
1509 blackbody_radiation_agenda );
1510 ppath_blackrad(
joker,ip) = bvector;
1554 const Index& stokes_dim,
1556 const Index& atmosphere_dim,
1559 const Index& use_mean_scat_data,
1573 clear2cloudbox.resize( np );
1577 for(
Index ip=0; ip<np; ip++ )
1586 cloudbox_limits,
true, atmosphere_dim ) )
1589 gpc_p[0], gpc_lat[0], gpc_lon[0],
1590 ppath.
gp_p[ip], gp_lat, gp_lon,
1591 atmosphere_dim, cloudbox_limits );
1596 gpc_p, gpc_lat, gpc_lon, itw );
1599 { clear2cloudbox[ip] = nin; nin++; }
1601 { clear2cloudbox[ip] = -1; }
1604 { clear2cloudbox[ip] = -1; }
1609 if( use_mean_scat_data )
1612 scat_data.resize( 1 );
1618 scat_data.resize( nf );
1619 for(
Index iv=0; iv<nf; iv++ )
1628 pnd_abs_vec.
resize( nf, stokes_dim, nin );
1629 pnd_ext_mat.
resize( nf, stokes_dim, stokes_dim, nin );
1633 for(
Index ip=0; ip<np; ip++ )
1635 const Index i = clear2cloudbox[ip];
1645 if( use_mean_scat_data )
1647 Vector abs_vec( stokes_dim );
1648 Matrix ext_mat( stokes_dim, stokes_dim );
1649 opt_propCalc( ext_mat, abs_vec, rtp_los2[0], rtp_los2[1],
1650 scat_data[0], stokes_dim, ppath_pnd(
joker,ip),
1651 ppath_t[ip], verbosity);
1652 for(
Index iv=0; iv<nf; iv++ )
1655 pnd_abs_vec(iv,
joker,i) = abs_vec;
1660 for(
Index iv=0; iv<nf; iv++ )
1663 pnd_abs_vec(iv,
joker,i), rtp_los2[0],
1664 rtp_los2[1], scat_data[iv], stokes_dim,
1665 ppath_pnd(
joker,ip), ppath_t[ip], verbosity );
1694 const Index& atmosphere_dim,
1695 const Numeric& rte_alonglos_v,
1706 for(
Index ip=0; ip<np; ip++ )
1709 Numeric v_doppler = rte_alonglos_v;
1712 if( ppath_wind(1,ip) != 0 || ppath_wind(0,ip) != 0 ||
1713 ppath_wind(2,ip) != 0 )
1718 ppath_wind(1,ip), ppath_wind(2,ip), atmosphere_dim );
1722 if( v_doppler == 0 )
1723 { ppath_f(
joker,ip) = f_grid; }
1729 for(
Index iv=0; iv<nf; iv++ )
1730 { ppath_f(iv,ip) = a * f_grid[iv]; }
1778 const Index& stokes_dim )
1786 trans_partial.
resize( nf, stokes_dim, stokes_dim, np-1 );
1787 trans_cumulat.
resize( nf, stokes_dim, stokes_dim, np );
1789 extmat_case.resize(np-1);
1790 for(
Index i=0; i<np-1; i++ )
1791 { extmat_case[i].resize(nf); }
1798 for(
Index ip=0; ip<np; ip++ )
1804 for(
Index iv=0; iv<nf; iv++ )
1810 for(
Index iv=0; iv<nf; iv++ )
1813 Matrix ext_mat(stokes_dim,stokes_dim);
1814 for(
Index is1=0; is1<stokes_dim; is1++ ) {
1815 for(
Index is2=0; is2<stokes_dim; is2++ ) {
1816 ext_mat(is1,is2) = 0.5 * ( ppath_abs(iv,is1,is2,ip-1) +
1817 ppath_abs(iv,is1,is2,ip ) );
1819 scalar_tau[iv] += ppath.
lstep[ip-1] * ext_mat(0,0);
1820 extmat_case[ip-1][iv] = 0;
1822 extmat_case[ip-1][iv], ext_mat, ppath.
lstep[ip-1] );
1864 const Index& stokes_dim,
1874 trans_partial.
resize( nf, stokes_dim, stokes_dim, np-1 );
1875 trans_cumulat.
resize( nf, stokes_dim, stokes_dim, np );
1877 extmat_case.resize(np-1);
1878 for(
Index i=0; i<np-1; i++ )
1879 { extmat_case[i].resize(nf); }
1886 Tensor3 extsum_old, extsum_this( nf, stokes_dim, stokes_dim );
1888 for(
Index ip=0; ip<np; ip++ )
1894 for(
Index iv=0; iv<nf; iv++ )
1896 for(
Index is1=0; is1<stokes_dim; is1++ ) {
1897 for(
Index is2=0; is2<stokes_dim; is2++ ) {
1898 extsum_this(iv,is1,is2) = ppath_abs(iv,is1,is2,ip);
1903 if( clear2cloudbox[ip] >= 0 )
1905 const Index ic = clear2cloudbox[ip];
1906 for(
Index iv=0; iv<nf; iv++ ) {
1907 for(
Index is1=0; is1<stokes_dim; is1++ ) {
1908 for(
Index is2=0; is2<stokes_dim; is2++ ) {
1909 extsum_this(iv,is1,is2) += pnd_ext_mat(iv,is1,is2,ic);
1916 const Index ic = clear2cloudbox[ip];
1918 for(
Index iv=0; iv<nf; iv++ )
1921 Matrix ext_mat(stokes_dim,stokes_dim);
1922 for(
Index is1=0; is1<stokes_dim; is1++ ) {
1923 for(
Index is2=0; is2<stokes_dim; is2++ ) {
1924 extsum_this(iv,is1,is2) = ppath_abs(iv,is1,is2,ip);
1926 { extsum_this(iv,is1,is2) += pnd_ext_mat(iv,is1,is2,ic); }
1928 ext_mat(is1,is2) = 0.5 * ( extsum_old(iv,is1,is2) +
1929 extsum_this(iv,is1,is2) );
1931 scalar_tau[iv] += ppath.
lstep[ip-1] * ext_mat(0,0);
1932 extmat_case[ip-1][iv] = 0;
1934 extmat_case[ip-1][iv], ext_mat, ppath.
lstep[ip-1] );
1943 extsum_old = extsum_this;
1961 const Sparse& sensor_response,
1962 const Index& mblock_index )
1965 return Range( n1y*mblock_index, n1y );
1976 const Index& mblock_index,
1977 const Index& atmosphere_dim,
1981 const Index& cloudbox_on,
1982 const Index& stokes_dim,
1989 const Index& antenna_dim,
1990 const Agenda& iy_main_agenda,
1991 const Index& j_analytical_do,
2003 for(
Index iaa=0; iaa<naa; iaa++ )
2009 los = sensor_los( mblock_index,
joker );
2010 los[0] += mblock_za_grid[iza];
2012 if( antenna_dim == 2 )
2013 {
map_daa( los[0], los[1], los[0], los[1],
2014 mblock_aa_grid[iaa] ); }
2020 Vector rtp_pos, rtp_pos2(0);
2022 rtp_pos = sensor_pos( mblock_index,
joker );
2023 if( transmitter_pos.
nrows() )
2024 { rtp_pos2 = transmitter_pos( mblock_index,
joker ); }
2031 Tensor3 iy_transmission(0,0,0);
2032 Index iang = iza*naa + iaa;
2035 diy_dx, 1, iy_transmission, iy_aux_vars,
2036 cloudbox_on, j_analytical_do, t_field,
2037 z_field, vmr_field, f_grid, rtp_pos, los,
2038 rtp_pos2, iy_main_agenda );
2043 if( iy_aux_array[iang][
q].ncols() != 1 ||
2044 iy_aux_array[iang][
q].nrows() != 1 )
2046 throw runtime_error(
"For calculations using yCalc, " 2047 "*iy_aux_vars* can not include\nvariables of " 2048 "along-the-path or extinction matrix type.");
2050 assert( iy_aux_array[iang][
q].npages() == 1 ||
2051 iy_aux_array[iang][
q].npages() == stokes_dim );
2052 assert( iy_aux_array[iang][
q].nbooks() == 1 ||
2053 iy_aux_array[iang][
q].nbooks() == nf );
2058 const Index row0 = iang * nf * stokes_dim;
2062 if( j_analytical_do )
2065 for(
Index ip=0; ip<jacobian_indices[iq][1] -
2066 jacobian_indices[iq][0]+1; ip++ )
2068 for(
Index is=0; is<stokes_dim; is++ )
2070 diyb_dx[iq](
Range(row0+is,nf,stokes_dim),ip)=
2071 diy_dx[iq](ip,
joker,is);
2078 for(
Index is=0; is<stokes_dim; is++ )
2079 { iyb[
Range(row0+is,nf,stokes_dim)] = iy(
joker,is); }
2084 catch (runtime_error e)
2086 #pragma omp critical (iyb_calc_fail) 2087 { fail_msg = e.what(); failed =
true; }
2106 const Index& mblock_index,
2107 const Index& atmosphere_dim,
2111 const Index& cloudbox_on,
2112 const Index& stokes_dim,
2119 const Index& antenna_dim,
2120 const Agenda& iy_main_agenda,
2121 const Index& j_analytical_do,
2133 if( antenna_dim == 1 )
2135 const Index niyb = nf * nza * naa * stokes_dim;
2140 if( j_analytical_do )
2142 diyb_dx.resize( jacobian_indices.
nelem() );
2144 diyb_dx[iq].resize( niyb, jacobian_indices[iq][1] -
2145 jacobian_indices[iq][0] + 1 );
2149 { diyb_dx.resize( 0 ); }
2158 Agenda l_iy_main_agenda (iy_main_agenda);
2161 bool failed =
false;
2164 out3 <<
" Parallelizing za loop (" << nza <<
" iterations, " 2165 << nf <<
" frequencies)\n";
2168 #pragma omp parallel for \ 2169 if (!arts_omp_in_parallel()) \ 2170 firstprivate(l_ws, l_iy_main_agenda) 2171 for(
Index iza=0; iza<nza; iza++ )
2174 if (failed)
continue;
2198 jacobian_quantities,
2209 out3 <<
" Not parallelizing za loop (" << nza <<
" iterations, " 2210 << nf <<
" frequencies)\n";
2212 for(
Index iza=0; iza<nza; iza++ )
2215 if (failed)
continue;
2239 jacobian_quantities,
2250 throw runtime_error(
"Run-time error in function: iyb_calc\n" + fail_msg);
2255 iyb_aux.resize( nq );
2259 iyb_aux[
q].resize( niyb );
2261 for(
Index iza=0; iza<nza; iza++ )
2263 for(
Index iaa=0; iaa<naa; iaa++ )
2265 const Index iang = iza*naa + iaa;
2266 const Index row0 = iang * nf * stokes_dim;
2267 for(
Index iv=0; iv<nf; iv++ )
2269 const Index row1 = row0 + iv*stokes_dim;
2270 const Index i1 =
min( iv, iy_aux_array[iang][
q].nbooks()-1 );
2271 for(
Index is=0; is<stokes_dim; is++ )
2273 Index i2 =
min( is, iy_aux_array[iang][
q].npages()-1 );
2274 iyb_aux[
q][row1+is] = iy_aux_array[iang][
q](i1,i2,0,0);
2317 assert( ns == iy_trans_old.
nrows() );
2318 assert( nf == iy_trans_new.
npages() );
2319 assert( ns == iy_trans_new.
nrows() );
2320 assert( ns == iy_trans_new.
ncols() );
2322 iy_trans_total.
resize( nf, ns, ns );
2324 for(
Index iv=0; iv<nf; iv++ )
2351 const Index& atmosphere_dim )
2355 los3d[0] =
abs( los[0] );
2357 if( atmosphere_dim == 1 )
2359 else if( atmosphere_dim == 2 )
2366 else if( atmosphere_dim == 3 )
2367 { los3d[1] = los[1]; }
2392 const Index& atmosphere_dim )
2396 if( atmosphere_dim == 1 )
2398 los_mirrored[0] = 180 - los[0];
2399 los_mirrored[1] = 180;
2401 else if( atmosphere_dim == 2 )
2403 los_mirrored[0] = 180 - fabs( los[0] );
2405 { los_mirrored[1] = 180; }
2407 { los_mirrored[1] = 0; }
2409 else if( atmosphere_dim == 3 )
2411 los_mirrored[0] = 180 - los[0];
2412 los_mirrored[1] = los[1] + 180;
2413 if( los_mirrored[1] > 180 )
2414 { los_mirrored[1] -= 360; }
2441 const Index& atmosphere_dim,
2447 assert( pos.
nelem() == atmosphere_dim );
2449 if( atmosphere_dim == 1 )
2451 assert( lat_true.
nelem() == 1 );
2452 assert( lon_true.
nelem() == 1 );
2458 else if( atmosphere_dim == 2 )
2460 assert( lat_true.
nelem() == lat_grid.
nelem() );
2461 assert( lon_true.
nelem() == lat_grid.
nelem() );
2464 gridpos( gp, lat_grid, pos[1] );
2466 lat =
interp( itw, lat_true, gp );
2467 lon =
interp( itw, lon_true, gp );
2508 iy = surface_emission;
2513 for(
Index ilos=0; ilos<nlos; ilos++ )
2517 for(
Index iv=0; iv<nf; iv++ )
2520 iy(iv,
joker) += rtmp;
2549 l= sqrt( u*u + v*v + w*w );
2553 los[0] = acos( w / l );
2554 los[1] = atan2( u, v );
Numeric dotprod_with_los(ConstVectorView los, const Numeric &u, const Numeric &v, const Numeric &w, const Index &atmosphere_dim)
dotprod_with_los
INDEX Index
The type to use for all integer numbers and indices.
void distance2D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &r2, const Numeric &lat2)
distance2D
void get_ppath_f(Matrix &ppath_f, const Ppath &ppath, ConstVectorView f_grid, const Index &atmosphere_dim, const Numeric &rte_alonglos_v, ConstMatrixView ppath_wind)
get_ppath_f
void matrix_exp(MatrixView F, ConstMatrixView A, const Index &q)
General exponential of a Matrix.
void iy_transmission_mult(Tensor3 &iy_trans_total, ConstTensor3View iy_trans_old, ConstTensor3View iy_trans_new)
iy_transmission_mult
Index nelem() const
Number of elements.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
void surface_calc(Matrix &iy, ConstTensor3View I, ConstMatrixView surface_los, ConstTensor4View surface_rmatrix, ConstMatrixView surface_emission)
surface_calc
Numeric invrayjean(const Numeric &i, const Numeric &f)
invrayjean
void iyb_calc(Workspace &ws, Vector &iyb, ArrayOfVector &iyb_aux, ArrayOfMatrix &diyb_dx, const Index &mblock_index, const Index &atmosphere_dim, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, const Index &cloudbox_on, const Index &stokes_dim, ConstVectorView f_grid, ConstMatrixView sensor_pos, ConstMatrixView sensor_los, ConstMatrixView transmitter_pos, ConstVectorView mblock_za_grid, ConstVectorView mblock_aa_grid, const Index &antenna_dim, const Agenda &iy_main_agenda, const Index &j_analytical_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfIndex &jacobian_indices, const ArrayOfString &iy_aux_vars, const Verbosity &verbosity)
iyb_calc
void zaaa2cart(Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
zaaa2cart
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
void apply_iy_unit(MatrixView iy, const String &y_unit, ConstVectorView f_grid, const Numeric &n, const ArrayOfIndex &i_pol)
apply_iy_unit
void iyb_calc_za_loop_body(bool &failed, String &fail_msg, ArrayOfArrayOfTensor4 &iy_aux_array, Workspace &ws, Vector &iyb, ArrayOfMatrix &diyb_dx, const Index &mblock_index, const Index &atmosphere_dim, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, const Index &cloudbox_on, const Index &stokes_dim, ConstVectorView f_grid, ConstMatrixView sensor_pos, ConstMatrixView sensor_los, ConstMatrixView transmitter_pos, ConstVectorView mblock_za_grid, ConstVectorView mblock_aa_grid, const Index &antenna_dim, const Agenda &iy_main_agenda, const Index &j_analytical_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfIndex &jacobian_indices, const ArrayOfString &iy_aux_vars, const Index &naa, const Index &iza, const Index &nf)
Linear algebra functions.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
Index npages() const
Returns the number of pages.
void get_ppath_blackrad(Workspace &ws, Matrix &ppath_blackrad, const Agenda &blackbody_radiation_agenda, const Ppath &ppath, ConstVectorView ppath_t, ConstMatrixView ppath_f)
get_ppath_blackrad
void cart2zaaa(Numeric &za, Numeric &aa, const Numeric &dx, const Numeric &dy, const Numeric &dz)
cart2zaaa
cmplx FADDEEVA() w(cmplx z, double relerr)
void defocusing_general(Workspace &ws, Numeric &dlf, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Ppath &ppath, const Numeric &ppath_lraytrace, const Numeric &dza, const Verbosity &verbosity)
defocusing_general
void get_ppath_abs(Workspace &ws, Tensor4 &ppath_abs, Tensor5 &abs_per_species, const Agenda &propmat_clearsky_agenda, const Ppath &ppath, ConstVectorView ppath_p, ConstVectorView ppath_t, ConstMatrixView ppath_vmr, ConstMatrixView ppath_f, ConstMatrixView ppath_mag, ConstVectorView f_grid, const Index &stokes_dim, const ArrayOfIndex &ispecies)
get_ppath_abs
Numeric dinvplanckdI(const Numeric &i, const Numeric &f)
dinvplanckdI
void defocusing_general_sub(Workspace &ws, Vector &pos, Vector &rte_los, Index &background, ConstVectorView rte_pos, const Numeric &lo0, const Agenda &ppath_step_agenda, const Numeric &ppath_lraytrace, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Verbosity &verbosity)
defocusing_general_sub
Index nrows() const
Returns the number of rows.
void bending_angle1d(Numeric &alpha, const Ppath &ppath)
bending_angle1d
Index nrows() const
Returns the number of rows.
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Index nelem() const
Returns the number of elements.
const Numeric SPEED_OF_LIGHT
Structure to store a grid position.
A constant view of a Tensor4.
Array< Index > ArrayOfIndex
An array of Index.
Index ppath_what_background(const Ppath &ppath)
ppath_what_background
void iy_main_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfTensor4 &iy_aux, Ppath &ppath, ArrayOfTensor3 &diy_dx, const Index iy_agenda_call1, const Tensor3 &iy_transmission, const ArrayOfString &iy_aux_vars, const Index cloudbox_on, const Index jacobian_do, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &f_grid, const Vector &rte_pos, const Vector &rte_los, const Vector &rte_pos2, const Agenda &input_agenda)
void get_ppath_atmvars(Vector &ppath_p, Vector &ppath_t, Matrix &ppath_vmr, Matrix &ppath_wind, Matrix &ppath_mag, const Ppath &ppath, const Index &atmosphere_dim, ConstVectorView p_grid, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstTensor3View wind_u_field, ConstTensor3View wind_v_field, ConstTensor3View wind_w_field, ConstTensor3View mag_u_field, ConstTensor3View mag_v_field, ConstTensor3View mag_w_field)
get_ppath_atmvars
void los3d(Vector &los3d, ConstVectorView los, const Index &atmosphere_dim)
iy_transmission_mult_scalar_tau los3d
void mult(VectorView y, const ConstMatrixView &M, const ConstVectorView &x)
Matrix Vector multiplication.
void map_daa(Numeric &za, Numeric &aa, const Numeric &za0, const Numeric &aa0, const Numeric &aa_grid)
The implementation for String, the ARTS string class.
Index ncols() const
Returns the number of columns.
void pos2true_latlon(Numeric &lat, Numeric &lon, const Index &atmosphere_dim, ConstVectorView lat_grid, ConstVectorView lat_true, ConstVectorView lon_true, ConstVectorView pos)
pos2true_latlon
void scat_data_array_monoCalc(ArrayOfSingleScatteringData &scat_data_array_mono, const ArrayOfSingleScatteringData &scat_data_array, const Vector &f_grid, const Index &f_index, const Verbosity &)
WORKSPACE METHOD: scat_data_array_monoCalc.
Index ncols() const
Returns the number of columns.
Numeric sphdist(const Numeric &lat1, const Numeric &lon1, const Numeric &lat2, const Numeric &lon2)
sphdist
void interp_cloudfield_gp2itw(VectorView itw, GridPos &gp_p_out, GridPos &gp_lat_out, GridPos &gp_lon_out, const GridPos &gp_p_in, const GridPos &gp_lat_in, const GridPos &gp_lon_in, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
interp_cloudfield_gp2itw
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.
void propmat_clearsky_agendaExecute(Workspace &ws, Tensor4 &propmat_clearsky, const Vector &f_grid, const Vector &rtp_mag, const Vector &rtp_los, const Numeric rtp_pressure, const Numeric rtp_temperature, const Vector &rtp_vmr, const Agenda &input_agenda)
void iy_space_agendaExecute(Workspace &ws, Matrix &iy, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
void find_tanpoint(Index &it, const Ppath ppath)
find_tanpoint
NUMERIC Numeric
The type to use for all floating point numbers.
void blackbody_radiation_agendaExecute(Workspace &ws, Vector &blackbody_radiation, const Numeric rtp_temperature, const Vector &f_grid, const Agenda &input_agenda)
void opt_propCalc(MatrixView ext_mat_mono, VectorView abs_vec_mono, const Numeric za, const Numeric aa, const ArrayOfSingleScatteringData &scat_data_array_mono, const Index stokes_dim, ConstVectorView pnd_vec, const Numeric rtp_temperature, const Verbosity &verbosity)
opt_propCalc
void distance3D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
distance3D
Array< String > ArrayOfString
An array of Strings.
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
void gridpos_copy(GridPos &gp_new, const GridPos &gp_old)
gridpos_copy
void interp_atmfield_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
interp_atmfield_gp2itw
Header file for special_interp.cc.
Propagation path structure and functions.
void resize(Index p, Index r, Index c)
Resize function.
const Numeric DEG2RAD
Global constant, conversion from degrees to radians.
Header file for logic.cc.
void emission_rtstep(Matrix &iy, const Index &stokes_dim, ConstVectorView bbar, ArrayOfIndex &extmat_case, ConstTensor3View t)
emission_rtstep
Index npages() const
Returns the number of pages.
This can be used to make arrays out of anything.
bool is_singular(ConstMatrixView A)
Checks if a square matrix is singular.
void adjust_los(VectorView los, const Index &atmosphere_dim)
adjust_los
void vectorfield2los(Numeric &l, Vector &los, const Numeric &u, const Numeric &v, const Numeric &w)
vectorfield2los
void cart2pol(Numeric &r, Numeric &lat, const Numeric &x, const Numeric &z, const Numeric &lat0, const Numeric &za0)
cart2pol
void resize(Index n)
Assignment operator from VectorView.
A constant view of a Tensor3.
A constant view of a Vector.
void apply_iy_unit2(Tensor3View J, ConstMatrixView iy, const String &y_unit, ConstVectorView f_grid, const Numeric &n, const ArrayOfIndex &i_pol)
apply_iy_unit2
Range get_rowindex_for_mblock(const Sparse &sensor_response, const Index &mblock_index)
get_rowindex_for_mblock
Numeric mean(const ConstVectorView &x)
Mean function, vector version.
A constant view of a Matrix.
Numeric invplanck(const Numeric &i, const Numeric &f)
invplanck
void cart2sph(Numeric &r, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &lat0, const Numeric &lon0, const Numeric &za0, const Numeric &aa0)
cart2sph
Index nbooks() const
Returns the number of books.
void iy_cloudbox_agendaExecute(Workspace &ws, Matrix &iy, const Vector &f_grid, const Vector &rtp_pos, const Vector &rtp_los, const Agenda &input_agenda)
void iy_surface_agendaExecute(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, const Tensor3 &iy_transmission, const Index cloudbox_on, const Index jacobian_do, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &f_grid, const Agenda &iy_main_agenda, const Vector &rtp_pos, const Vector &rtp_los, const Vector &rte_pos2, const Agenda &input_agenda)
void get_ppath_ext(ArrayOfIndex &clear2cloudbox, Tensor3 &pnd_abs_vec, Tensor4 &pnd_ext_mat, Array< ArrayOfSingleScatteringData > &scat_data, Matrix &ppath_pnd, const Ppath &ppath, ConstVectorView ppath_t, const Index &stokes_dim, ConstMatrixView ppath_f, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits, const Tensor4 &pnd_field, const Index &use_mean_scat_data, const ArrayOfSingleScatteringData &scat_data_array, const Verbosity &verbosity)
get_ppath_ext
void mirror_los(Vector &los_mirrored, ConstVectorView los, const Index &atmosphere_dim)
mirror_los
void get_ppath_trans2(Tensor4 &trans_partial, ArrayOfArrayOfIndex &extmat_case, Tensor4 &trans_cumulat, Vector &scalar_tau, const Ppath &ppath, ConstTensor4View &ppath_abs, ConstVectorView f_grid, const Index &stokes_dim, const ArrayOfIndex &clear2cloudbox, ConstTensor4View pnd_ext_mat)
get_ppath_trans2
void get_iy_of_background(Workspace &ws, Matrix &iy, ArrayOfTensor3 &diy_dx, ConstTensor3View iy_transmission, const Index &jacobian_do, const Ppath &ppath, ConstVectorView rte_pos2, const Index &atmosphere_dim, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, const Index &cloudbox_on, const Index &stokes_dim, ConstVectorView f_grid, const Agenda &iy_main_agenda, const Agenda &iy_space_agenda, const Agenda &iy_surface_agenda, const Agenda &iy_cloudbox_agenda, const Verbosity &verbosity)
get_iy_of_background
void ppath_calc(Workspace &ws, Ppath &ppath, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lraytrace, const bool &ppath_inside_cloudbox_do, const Verbosity &verbosity)
ppath_calc
void id_mat(MatrixView I)
Identity Matrix.
The structure to describe a propagation path and releated quantities.
bool is_gp_inside_cloudbox(const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, const bool &include_boundaries, const Index &atmosphere_dim)
Index ncols() const
Returns the number of columns.
void get_iy(Workspace &ws, Matrix &iy, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, const Index &cloudbox_on, ConstVectorView f_grid, ConstVectorView rte_pos, ConstVectorView rte_los, ConstVectorView rte_pos2, const Agenda &iy_main_agenda)
get_iy
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
void get_ppath_trans(Tensor4 &trans_partial, ArrayOfArrayOfIndex &extmat_case, Tensor4 &trans_cumulat, Vector &scalar_tau, const Ppath &ppath, ConstTensor4View &ppath_abs, ConstVectorView f_grid, const Index &stokes_dim)
get_ppath_trans
void poslos2cart(Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
poslos2cart
Index nrows() const
Returns the number of rows.
void interp_atmfield_by_itw(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
interp_atmfield_by_itw
void defocusing_sat2sat(Workspace &ws, Numeric &dlf, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View t_field, ConstTensor3View z_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Ppath &ppath, const Numeric &ppath_lraytrace, const Numeric &dza, const Verbosity &verbosity)
defocusing_sat2sat
void resize(Index b, Index p, Index r, Index c)
Resize function.
void ext2trans(MatrixView trans_mat, Index &icase, ConstMatrixView ext_mat, const Numeric &lstep)
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
itw2p
Declaration of functions in rte.cc.
void resize(Index r, Index c)
Resize function.