71 const Index& atmosphere_dim,
80 const Index& cloudbox_on,
82 const Index& stokes_dim,
84 const Agenda& ppath_step_agenda,
85 const Agenda& emission_agenda,
86 const Agenda& abs_scalar_gas_agenda,
87 const Agenda& iy_clearsky_agenda,
91 const Agenda& opt_prop_gas_agenda,
92 const Agenda& fos_y_agenda,
94 const Index& use_mean_scat_data,
103 const Index jacobian_do = 0;
110 if( fos_i == fos_n-1 )
112 if( atmosphere_dim == 1 )
114 for(
Index ia=0; ia<nfosa; ia++ )
120 for(
Index it=ia-1; it>=0 && ihit<0; it-- )
122 if( fabs( fos_angles(ia,0) - fos_angles(it,0) ) < dza )
135 rte_pos, fos_angles(ia,
Range(0,1)),
136 0, jacobian_do, p_grid,
137 lat_grid, lon_grid, t_field,
139 iy_clearsky_agenda );
145 else if( atmosphere_dim == 2 )
149 for(
Index ia=0; ia<nfosa; ia++ )
156 for(
Index it=ia-1; it>=0 && ihit<0; it-- )
158 if( fabs( fos_angles(ia,0) - fos_angles(it,0) ) < dza )
160 if( fabs( fos_angles(ia,1) + fos_angles(it,1) ) < daa )
172 if( fabs(fos_angles(ia,1)) <= 90 )
173 { rte_los[0] = fos_angles(ia,0); }
175 { rte_los[0] = -fos_angles(ia,0); }
182 if( fos_angles(ia,0) > 0 && fabs(fos_angles(ia,0)) < 180 &&
183 fos_angles(ia,1) != 0 && fabs(fos_angles(ia,1)) < 180 )
187 1.0/fabs(cos(
DEG2RAD*fos_angles(ia,1))) );
188 const Numeric lat0 = rte_pos[1];
191 lat_stretched[i] = lat0 + stretch*(lat_grid[i]-lat0);
195 { lat_stretched = lat_grid; }
201 0, jacobian_do, p_grid,
202 lat_stretched, lon_grid, t_field,
204 iy_clearsky_agenda );
210 else if( atmosphere_dim == 3 )
212 for(
Index ia=0; ia<nfosa; ia++ )
217 rte_pos, fos_angles(ia,
Range(0,2)),
218 0, jacobian_do, p_grid,
219 lat_grid, lon_grid, t_field,
221 iy_clearsky_agenda );
231 if( atmosphere_dim == 2 )
233 "For atmosphere_dim = 2, only single scattering can be used." );
235 Index nlos = 1 + (atmosphere_dim==3);
237 for(
Index ia=0; ia<nfosa; ia++ )
239 iyFOS( ws, tmp, iy_error, iy_error_type, iy_aux, diy_dx,
240 iy_transmission, rte_pos, fos_angles(ia,
Range(0,nlos)),
241 jacobian_do, atmosphere_dim, p_grid, lat_grid, lon_grid,
242 z_field, t_field, vmr_field, r_geoid, z_surface,
243 cloudbox_on, cloudbox_limits, stokes_dim, f_grid,
244 ppath_step_agenda, emission_agenda,
245 abs_scalar_gas_agenda, iy_clearsky_agenda,
246 pnd_field, scat_data_raw, opt_prop_gas_agenda, fos_y_agenda,
247 fos_angles, use_mean_scat_data, fos_n, fos_i+1, verbosity);
260 Index& iy_error_type,
263 const Tensor3& iy_transmission,
266 const Index& jacobian_do,
267 const Index& atmosphere_dim,
276 const Index& cloudbox_on,
278 const Index& stokes_dim,
280 const Agenda& ppath_step_agenda,
281 const Agenda& emission_agenda,
282 const Agenda& abs_scalar_gas_agenda,
283 const Agenda& iy_clearsky_agenda,
286 const Agenda& opt_prop_gas_agenda,
287 const Agenda& fos_y_agenda,
289 const Index& use_mean_scat_data,
297 "This method does not yet provide any jacobians (jacobian_do must be 0)" );
299 throw runtime_error(
"The cloudbox must be defined to use this method." );
300 if( fos_angles.
ncols() != 3 )
301 throw runtime_error(
"The WSV *fos_angles* must have three columns." );
302 if(
max(fos_angles) <=
PI )
304 "The WSV *fos_angles* shall be in degrees (not radians)." );
307 "The zenith angles in *fos_angles* shall be inside [0,180]." );
310 "The azimuth angles in *fos_angles* shall be inside [-180,180]." );
311 if( fos_angles(
joker,2).sum() < 6 || fos_angles(
joker,2).sum() > 20 )
313 "The sum of integration weights in *fos_angles* shall be inside [2,20]." );
315 throw runtime_error(
"The WSV *fos_n* must be >= 0." );
317 throw runtime_error(
"The WSV *fos_i* must be >= 0." );
323 ppath_calc( ws, ppath, ppath_step_agenda, atmosphere_dim, p_grid,
324 lat_grid, lon_grid, z_field, r_geoid, z_surface,
325 cloudbox_on, cloudbox_limits, rte_pos, rte_los, 0,
331 throw runtime_error(
"Observations where (unscattered) propagation path "
332 "hits the surface inside the cloudbox are not yet "
333 "handled by this method." );
341 Vector ppath_p, ppath_t, ppath_wind_u, ppath_wind_v, ppath_wind_w;
342 Matrix ppath_vmr, ppath_pnd;
344 Matrix ppath_emission, ppath_tau;
345 Tensor3 wind_field_dummy(0,0,0), iy_trans_new;
346 Tensor3 ppath_asp_abs_vec, ppath_pnd_abs_vec, total_transmission;
347 Tensor4 ppath_asp_ext_mat, ppath_pnd_ext_mat, ppath_transmission;
356 ppath_wind_u, ppath_wind_v, ppath_wind_w,
357 ppath, atmosphere_dim, p_grid, t_field, vmr_field,
358 wind_field_dummy, wind_field_dummy, wind_field_dummy );
362 ppath, atmosphere_dim, cloudbox_limits, pnd_field );
366 ppath_pnd_abs_vec, ppath_pnd_ext_mat, ppath_transmission,
367 total_transmission, ppath_emission, scat_data,
368 abs_scalar_gas_agenda, emission_agenda, opt_prop_gas_agenda,
369 ppath, ppath_p, ppath_t, ppath_vmr, ppath_wind_u,
370 ppath_wind_v, ppath_wind_w, ppath_pnd, use_mean_scat_data,
371 scat_data_raw, stokes_dim, f_grid, atmosphere_dim, 1,
390 rte_pos2 = ppath.
pos(ppath.
np-1,
Range(0,atmosphere_dim));
394 iy_aux, diy_dx, 0, iy_trans_new,
395 rte_pos2, rte_los2, 0, jacobian_do,
396 p_grid, lat_grid, lon_grid, t_field,
397 z_field, vmr_field, iy_clearsky_agenda );
408 Matrix s2(nf,stokes_dim,0.0);
413 if( use_mean_scat_data )
414 { nfs = 1; ivf = 0; }
416 { nfs = nf; ivf = 1; }
419 for(
Index ip=np-1; ip>=0; ip-- )
425 if(
max(ppath_pnd(
joker,ip)) < 1e-3 )
433 fos_y_agendaExecute( ws, Y, rte_pos2, fos_angles, fos_n, fos_i,
444 Tensor4 P( nfosa, nfs, stokes_dim, stokes_dim );
445 Matrix P1( stokes_dim, stokes_dim );
447 for(
Index ia=0; ia<nfosa; ia++ )
449 for(
Index iv=0; iv<nfs; iv++ )
452 fos_angles(ia,0), fos_angles(ia,1),
453 scat_data[iv], stokes_dim,
454 ppath_pnd(
joker,ip), ppath_t[ip],
462 for(
Index iv=0; iv<nf; iv++ )
465 for(
Index ia=0; ia<nfosa; ia++ )
468 sp *= fos_angles(ia,2);
478 for(
Index iv=0; iv<nf; iv++ )
481 Matrix ext_mat( stokes_dim, stokes_dim,0 );
482 Vector abs_vec(stokes_dim,0.0);
484 Numeric b = 0.5 * ( ppath_emission(iv,ip) +
485 ppath_emission(iv,ip+1) );
486 for(
Index is1=0; is1<stokes_dim; is1++ )
488 s[is1] = 0.5 * ( s1(iv,is1) + s2(iv,is1) );
489 abs_vec[is1] = 0.5 * (
490 ppath_asp_abs_vec(iv,is1,ip+1) +
491 ppath_asp_abs_vec(iv,is1,ip) +
492 ppath_pnd_abs_vec(iv,is1,ip+1) +
493 ppath_pnd_abs_vec(iv,is1,ip) );
494 for(
Index is2=0; is2<stokes_dim; is2++ )
496 ext_mat(is1,is2) = 0.5 * (
497 ppath_asp_ext_mat(iv,is1,is2,ip+1) +
498 ppath_asp_ext_mat(iv,is1,is2,ip) +
499 ppath_pnd_ext_mat(iv,is1,is2,ip+1) +
500 ppath_pnd_ext_mat(iv,is1,is2,ip) );
505 Matrix trans_mat(stokes_dim,stokes_dim);