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 );
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() );
2324 for(
Index iv=0; iv<nf; iv++ )
2351 const Index& atmosphere_dim )
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 );