56 #define F11 pha_mat_int[0]
57 #define F12 pha_mat_int[1]
58 #define F22 pha_mat_int[2]
59 #define F33 pha_mat_int[3]
60 #define F34 pha_mat_int[4]
61 #define F44 pha_mat_int[5]
98 if (stokes_dim > 4 || stokes_dim < 1){
99 throw runtime_error(
"The dimension of the stokes vector \n"
100 "must be 1,2,3 or 4");
108 out0 <<
"Case PARTICLE_TYPE_GENERAL not yet implemented. \n";
118 abs_vec_lab[0] = abs_vec_data(0,0,0);
124 assert (abs_vec_data.
ncols() == 2);
143 gridpos(gp,this_za_datagrid,180-za_sca);
147 gridpos(gp,this_za_datagrid,za_sca);
153 if( stokes_dim == 1 ){
162 out0 <<
"Not all particle type cases are implemented\n";
203 if (stokes_dim > 4 || stokes_dim < 1){
204 throw runtime_error(
"The dimension of the stokes vector \n"
205 "must be 1,2,3 or 4");
213 out0 <<
"Case PARTICLE_TYPE_GENERAL not yet implemented. \n";
218 assert (ext_mat_data.
ncols() == 1);
226 ext_mat_lab(0,0) = ext_mat_data(0,0,0);
229 if( stokes_dim == 1 ){
233 ext_mat_lab(1,1) = ext_mat_data(0,0,0);
235 if( stokes_dim == 2 ){
239 ext_mat_lab(2,2) = ext_mat_data(0,0,0);
241 if( stokes_dim == 3 ){
245 ext_mat_lab(3,3) = ext_mat_data(0,0,0);
251 assert (ext_mat_data.
ncols() == 3);
273 gridpos(gp,this_za_datagrid,180-za_sca);
277 gridpos(gp,this_za_datagrid,za_sca);
284 ext_mat_lab(0,0)=Kjj;
286 if( stokes_dim == 1 ){
291 ext_mat_lab(1,1)=Kjj;
292 ext_mat_lab(0,1)=K12;
293 ext_mat_lab(1,0)=K12;
295 if( stokes_dim == 2 ){
299 ext_mat_lab(2,2)=Kjj;
301 if( stokes_dim == 3 ){
306 ext_mat_lab(2,3)=K34;
307 ext_mat_lab(3,2)=-K34;
308 ext_mat_lab(3,3)=Kjj;
315 out0 <<
"Not all particle type cases are implemented\n";
352 const Index& za_sca_idx,
353 const Index& aa_sca_idx,
354 const Index& za_inc_idx,
355 const Index& aa_inc_idx,
362 Numeric za_sca = scat_za_grid[za_sca_idx];
363 Numeric aa_sca = scat_aa_grid[aa_sca_idx];
364 Numeric za_inc = scat_za_grid[za_inc_idx];
365 Numeric aa_inc = scat_aa_grid[aa_inc_idx];
367 if (stokes_dim > 4 || stokes_dim < 1){
368 throw runtime_error(
"The dimension of the stokes vector \n"
369 "must be 1,2,3 or 4");
377 out0 <<
"Case PARTICLE_TYPE_GENERAL not yet implemented. \n";
390 za_datagrid, za_sca, aa_sca,
410 assert (pha_mat_data.
ncols()==16);
411 Numeric delta_aa=aa_sca-aa_inc+(aa_sca-aa_inc<-180)*360-
412 (aa_sca-aa_inc>180)*360;
419 gridpos(delta_aa_gp,aa_datagrid,
abs(delta_aa));
422 gridpos(za_inc_gp,this_za_datagrid,180-za_inc);
423 gridpos(za_sca_gp,za_datagrid,180-za_sca);
427 gridpos(za_inc_gp,this_za_datagrid,za_inc);
428 gridpos(za_sca_gp,za_datagrid,za_sca);
435 za_sca_gp,delta_aa_gp,za_inc_gp);
436 if( stokes_dim == 1 ){
441 za_sca_gp,delta_aa_gp,za_inc_gp);
444 za_sca_gp,delta_aa_gp,za_inc_gp);
447 za_sca_gp,delta_aa_gp,za_inc_gp);
448 if( stokes_dim == 2 ){
451 if ((za_inc<=90 && delta_aa>=0)||(za_inc>90 && delta_aa<0))
455 za_sca_gp,delta_aa_gp,za_inc_gp);
458 za_sca_gp,delta_aa_gp,za_inc_gp);
461 za_sca_gp,delta_aa_gp,za_inc_gp);
464 za_sca_gp,delta_aa_gp,za_inc_gp);
470 za_sca_gp,delta_aa_gp,za_inc_gp);
473 za_sca_gp,delta_aa_gp,za_inc_gp);
476 za_sca_gp,delta_aa_gp,za_inc_gp);
479 za_sca_gp,delta_aa_gp,za_inc_gp);
483 za_sca_gp,delta_aa_gp,za_inc_gp);
484 if( stokes_dim == 3 ){
487 if ((za_inc<=90 && delta_aa>=0)||(za_inc>90 && delta_aa<0))
491 za_sca_gp,delta_aa_gp,za_inc_gp);
494 za_sca_gp,delta_aa_gp,za_inc_gp);
497 za_sca_gp,delta_aa_gp,za_inc_gp);
500 za_sca_gp,delta_aa_gp,za_inc_gp);
506 za_sca_gp,delta_aa_gp,za_inc_gp);
509 za_sca_gp,delta_aa_gp,za_inc_gp);
512 za_sca_gp,delta_aa_gp,za_inc_gp);
515 za_sca_gp,delta_aa_gp,za_inc_gp);
519 za_sca_gp,delta_aa_gp,za_inc_gp);
522 za_sca_gp,delta_aa_gp,za_inc_gp);
525 za_sca_gp,delta_aa_gp,za_inc_gp);
532 out0 <<
"Not all particle type cases are implemented\n";
569 const Index& za_sca_idx,
570 const Index& aa_sca_idx,
571 const Index& za_inc_idx,
572 const Index& aa_inc_idx,
581 for (
Index i = 0; i < 6; i++)
583 pha_mat_int[i] =
interp(itw, pha_mat_data(
joker, 0, 0, 0, i),
584 scat_theta_gps[za_sca_idx][aa_sca_idx][za_inc_idx][aa_inc_idx]);
636 if( (
abs(aa_sca-aa_inc)<ANG_TOL) || (
abs(
abs(aa_sca-aa_inc)-360) < ANG_TOL) )
640 else if (
abs(
abs(aa_sca-aa_inc)-180)<ANG_TOL)
642 theta_rad=
DEG2RAD*(za_sca+za_inc);
643 if (theta_rad>
PI){theta_rad=2*
PI-theta_rad;}
653 assert (pha_mat_data.
ncols() == 6);
655 theta_rad = acos(cos(za_sca_rad) * cos(za_inc_rad) +
656 sin(za_sca_rad) * sin(za_inc_rad) *
657 cos(aa_sca_rad - aa_inc_rad));
664 gridpos(thet_gp, za_datagrid, theta);
669 for (
Index i = 0; i < 6; i++)
671 pha_mat_int[i] =
interp(itw, pha_mat_data(
joker, 0, 0, 0, i),
728 pha_mat_lab(0,0) =
F11;
730 if( stokes_dim > 1 ){
740 ((theta > -.01) && (theta < .01) ) ||
742 ((theta > 179.99) && (theta < 180.01)) ||
744 ((aa_sca == aa_inc) || (aa_sca == 360-aa_inc) || (aa_inc == 360-aa_sca) ||
745 (aa_sca == 180-aa_inc) || (aa_inc == 180-aa_sca) )
748 pha_mat_lab(0,1) =
F12;
749 pha_mat_lab(1,0) =
F12;
750 pha_mat_lab(1,1) =
F22;
752 if( stokes_dim > 2 ){
753 pha_mat_lab(0,2) = 0;
754 pha_mat_lab(1,2) = 0;
755 pha_mat_lab(2,0) = 0;
756 pha_mat_lab(2,1) = 0;
757 pha_mat_lab(2,2) =
F33;
759 if( stokes_dim > 3 ){
760 pha_mat_lab(0,3) = 0;
761 pha_mat_lab(1,3) = 0;
762 pha_mat_lab(2,3) =
F34;
763 pha_mat_lab(3,0) = 0;
764 pha_mat_lab(3,1) = 0;
765 pha_mat_lab(3,2) = -
F34;
766 pha_mat_lab(3,3) =
F44;
782 sigma1 =
PI + aa_sca_rad - aa_inc_rad;
787 sigma1 = aa_sca_rad - aa_inc_rad;
790 else if (za_sca_rad <
ANGTOL)
793 sigma2 =
PI + aa_sca_rad - aa_inc_rad;
798 sigma2 = aa_sca_rad - aa_inc_rad;
802 s1 = (cos(za_sca_rad) - cos(za_inc_rad) * cos(theta_rad))
803 /(sin(za_inc_rad)*sin(theta_rad));
804 s2 = (cos(za_inc_rad) - cos(za_sca_rad) * cos (theta_rad))/
805 (sin(za_sca_rad)*sin(theta_rad));
812 if ( isnan(sigma1) || isnan(sigma2) )
825 const Numeric C1 = cos(2*sigma1);
826 const Numeric C2 = cos(2*sigma2);
828 const Numeric S1 = sin(2*sigma1);
829 const Numeric S2 = sin(2*sigma2);
831 pha_mat_lab(0,1) = C1 *
F12;
832 pha_mat_lab(1,0) = C2 *
F12;
833 pha_mat_lab(1,1) = C1 * C2 *
F22 - S1 * S2 *
F33;
835 assert(!isnan(pha_mat_lab(0,1)));
836 assert(!isnan(pha_mat_lab(1,0)));
837 assert(!isnan(pha_mat_lab(1,1)));
839 if( stokes_dim > 2 ){
849 Numeric delta_aa=aa_sca-aa_inc+(aa_sca-aa_inc<-180)*360-
850 (aa_sca-aa_inc>180)*360;
853 pha_mat_lab(0,2) = S1 *
F12;
854 pha_mat_lab(1,2) = S1 * C2 *
F22 + C1 * S2 *
F33;
855 pha_mat_lab(2,0) = -S2 *
F12;
856 pha_mat_lab(2,1) = -C1 * S2 *
F22 - S1 * C2 *
F33;
860 pha_mat_lab(0,2) = -S1 *
F12;
861 pha_mat_lab(1,2) = -S1 * C2 *
F22 - C1 * S2 *
F33;
862 pha_mat_lab(2,0) = S2 *
F12;
863 pha_mat_lab(2,1) = C1 * S2 *
F22 + S1 * C2 *
F33;
865 pha_mat_lab(2,2) = -S1 * S2 *
F22 + C1 * C2 *
F33;
867 if( stokes_dim > 3 ){
870 pha_mat_lab(1,3) = S2 *
F34;
871 pha_mat_lab(3,1) = S1 *
F34;
875 pha_mat_lab(1,3) = -S2 *
F34;
876 pha_mat_lab(3,1) = -S1 *
F34;
878 pha_mat_lab(0,3) = 0;
879 pha_mat_lab(2,3) = C2 *
F34;
880 pha_mat_lab(3,0) = 0;
881 pha_mat_lab(3,2) = -C1 *
F34;
882 pha_mat_lab(3,3) =
F44;
892 os <<
"SingleScatteringData: Output operator not implemented";
899 os <<
"ArrayOfSingleScatteringData: Output operator not implemented";
905 os <<
"ScatteringMetaData: Output operator not implemented";
912 os <<
"ArrayOfScatteringMetaData: Output operator not implemented";