59 #define PART_TYPE scat_data_array[i_pt].particle_type
60 #define F_DATAGRID scat_data_array[i_pt].f_grid
61 #define T_DATAGRID scat_data_array[i_pt].T_grid
62 #define ZA_DATAGRID scat_data_array[i_pt].za_grid
63 #define AA_DATAGRID scat_data_array[i_pt].aa_grid
64 #define PHA_MAT_DATA_RAW scat_data_array[i_pt].pha_mat_data //CPD: changed from pha_mat_data
65 #define EXT_MAT_DATA_RAW scat_data_array[i_pt].ext_mat_data //which wouldn't let me play with
66 #define ABS_VEC_DATA_RAW scat_data_array[i_pt].abs_vec_data //scat_data_array_mono.
67 #define PND_LIMIT 1e-12 // If particle number density is below this value,
76 const Vector& scat_za_grid,
77 const Vector& scat_aa_grid,
78 const Index& scat_za_index,
79 const Index& scat_aa_index,
84 const Index& scat_p_index,
85 const Index& scat_lat_index,
86 const Index& scat_lon_index,
92 out3 <<
"Calculate *pha_mat_spt* from database\n";
97 if (stokes_dim > 4 || stokes_dim < 1){
98 throw runtime_error(
"The dimension of the stokes vector \n"
99 "must be 1,2,3 or 4");
102 assert( pha_mat_spt.
nshelves() == N_pt );
110 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
114 if (pnd_field(i_pt, scat_p_index, scat_lat_index, scat_lon_index) >
PND_LIMIT)
152 pha_mat_data_int(i_za_sca,
167 for (
Index za_inc_idx = 0; za_inc_idx < scat_za_grid.
nelem();
170 for (
Index aa_inc_idx = 0; aa_inc_idx < scat_aa_grid.
nelem();
179 aa_inc_idx, scat_za_grid, scat_aa_grid,
194 const Index& doit_za_grid_size,
195 const Vector& scat_aa_grid,
196 const Index& scat_za_index,
197 const Index& scat_aa_index,
198 const Numeric& rtp_temperature,
200 const Index& scat_p_index,
201 const Index& scat_lat_index,
202 const Index& scat_lon_index,
206 if (pnd_field.
ncols() > 1)
208 assert(pha_mat_sptDOITOpt.
nelem() == scat_data_array_mono.
nelem());
211 assert(pha_mat_sptDOITOpt[0].nlibraries() == scat_data_array_mono[0].T_grid.
nelem());
212 assert(pha_mat_sptDOITOpt[0].nvitrines() == doit_za_grid_size);
213 assert(pha_mat_sptDOITOpt[0].nshelves() == scat_aa_grid.
nelem() );
214 assert(pha_mat_sptDOITOpt[0].nbooks() == doit_za_grid_size);
215 assert(pha_mat_sptDOITOpt[0].npages() == scat_aa_grid.
nelem());
219 else if ( pnd_field.
ncols() == 1 )
224 assert(pha_mat_sptDOITOpt.
nelem() == scat_data_array_mono.
nelem());
227 assert(pha_mat_sptDOITOpt[0].nlibraries() == scat_data_array_mono[0].T_grid.
nelem());
228 assert(pha_mat_sptDOITOpt[0].nvitrines() == doit_za_grid_size);
229 assert(pha_mat_sptDOITOpt[0].nshelves() == 1);
230 assert(pha_mat_sptDOITOpt[0].nbooks() == doit_za_grid_size);
231 assert(pha_mat_sptDOITOpt[0].npages() == scat_aa_grid.
nelem());
234 assert(doit_za_grid_size > 0);
238 nlinspace(za_grid, 0, 180, doit_za_grid_size);
240 const Index N_pt = scat_data_array_mono.
nelem();
243 if (stokes_dim > 4 || stokes_dim < 1){
244 throw runtime_error(
"The dimension of the stokes vector \n"
245 "must be 1,2,3 or 4");
248 assert( pha_mat_spt.
nshelves() == N_pt );
257 for (
Index i_pt = 0; i_pt < N_pt; i_pt ++)
262 if (pnd_field(i_pt, scat_p_index, scat_lat_index, scat_lon_index) >
PND_LIMIT)
264 if( scat_data_array_mono[i_pt].T_grid.
nelem() > 1)
267 os <<
"The temperature grid of the scattering data does not cover the \n"
268 "atmospheric temperature at cloud location. The data should \n"
269 "include the value T="<< rtp_temperature <<
" K. \n";
273 gridpos(T_gp, scat_data_array_mono[i_pt].T_grid, rtp_temperature);
280 for (
Index za_inc_idx = 0; za_inc_idx < doit_za_grid_size;
283 for (
Index aa_inc_idx = 0; aa_inc_idx < scat_aa_grid.
nelem();
286 if( scat_data_array_mono[i_pt].T_grid.
nelem() == 1)
288 pha_mat_spt(i_pt, za_inc_idx, aa_inc_idx,
joker,
joker) =
289 pha_mat_sptDOITOpt[i_pt](0, scat_za_index,
290 scat_aa_index, za_inc_idx,
297 for (
Index i = 0; i< stokes_dim; i++)
299 for (
Index j = 0; j< stokes_dim; j++)
301 pha_mat_spt(i_pt, za_inc_idx, aa_inc_idx, i, j)=
302 interp(itw,pha_mat_sptDOITOpt[i_pt]
303 (
joker, scat_za_index,
304 scat_aa_index, za_inc_idx,
305 aa_inc_idx, i, j) , T_gp);
322 const Vector& scat_za_grid,
323 const Vector& scat_aa_grid,
324 const Index& scat_za_index,
325 const Index& scat_aa_index,
326 const Index& f_index,
328 const Numeric& rtp_temperature,
330 const Index& scat_p_index,
331 const Index& scat_lat_index,
332 const Index& scat_lon_index,
338 const Numeric za_sca = scat_za_grid[scat_za_index];
339 const Numeric aa_sca = scat_aa_grid[scat_aa_index];
341 if (stokes_dim > 4 || stokes_dim < 1){
342 throw runtime_error(
"The dimension of the stokes vector \n"
343 "must be 1,2,3 or 4");
346 assert( ext_mat_spt.
npages() == N_pt );
347 assert( abs_vec_spt.
nrows() == N_pt );
360 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
365 if (pnd_field(i_pt, scat_p_index, scat_lat_index, scat_lon_index) >
PND_LIMIT)
395 os <<
"The temperature grid of the scattering data does not cover the \n"
396 "atmospheric temperature at cloud location. The data should \n"
397 "include the value T="<< rtp_temperature <<
" K. \n";
417 ext_mat_data_int(i_za_sca, i_aa_sca, i) =
419 i_za_sca, i_aa_sca, i),
436 abs_vec_data_int(i_za_sca, i_aa_sca, i) =
461 ext_mat_data_int(i_za_sca, i_aa_sca, i) =
463 i_za_sca, i_aa_sca, i),
480 abs_vec_data_int(i_za_sca, i_aa_sca, i) =
508 za_sca, aa_sca, verbosity);
519 const Index& atmosphere_dim,
520 const Index& scat_p_index,
521 const Index& scat_lat_index,
522 const Index& scat_lon_index,
529 Matrix ext_mat_part(stokes_dim, stokes_dim, 0.0);
532 if (stokes_dim > 4 || stokes_dim < 1){
534 "The dimension of stokes vector can be "
537 if ( ext_mat_spt.
ncols() != stokes_dim){
539 throw runtime_error(
" The columns of ext_mat_spt should "
540 "agree to stokes_dim");
543 if (atmosphere_dim == 1)
546 for (
Index l = 0; l < N_pt; l++)
550 for (
Index m = 0; m < stokes_dim; m++)
552 for (
Index n = 0; n < stokes_dim; n++)
555 ext_mat_part(m, n) +=
556 (ext_mat_spt(l, m, n) * pnd_field(l, scat_p_index, 0, 0));
564 if (atmosphere_dim == 3)
568 for (
Index l = 0; l < N_pt; l++)
572 for (
Index m = 0; m < stokes_dim; m++)
574 for (
Index n = 0; n < stokes_dim; n++)
577 ext_mat_part(m, n) += (ext_mat_spt(l, m, n) *
578 pnd_field(l, scat_p_index,
595 const Matrix& abs_vec_spt,
597 const Index& atmosphere_dim,
598 const Index& scat_p_index,
599 const Index& scat_lat_index,
600 const Index& scat_lon_index,
607 Vector abs_vec_part(stokes_dim, 0.0);
609 if ((stokes_dim > 4) || (stokes_dim <1)){
610 throw runtime_error(
"The dimension of stokes vector "
611 "can be only 1,2,3, or 4");
614 if (atmosphere_dim == 1)
617 for (
Index l = 0; l < N_pt ; ++l)
621 for (
Index m = 0; m < stokes_dim; ++m)
625 (abs_vec_spt(l, m) * pnd_field(l, scat_p_index, 0, 0));
632 if (atmosphere_dim == 3)
635 for (
Index l = 0; l < N_pt ; ++l)
639 for (
Index m = 0; m < stokes_dim; ++m)
642 abs_vec_part[m] += (abs_vec_spt(l, m) *
643 pnd_field(l, scat_p_index,
657 const Index& stokes_dim,
658 const Index& f_index,
666 freq_dim = f_grid.
nelem();
675 out2 <<
"Set dimensions of ext_mat as ["
678 << stokes_dim <<
"] and initialized to 0.\n";
684 const Tensor4& propmat_clearsky,
692 if ( stokes_dim != ext_mat.
nrows() )
693 throw runtime_error(
"Row dimension of ext_mat inconsistent with "
694 "column dimension.");
695 if ( stokes_dim != propmat_clearsky.
ncols() )
696 throw runtime_error(
"Col dimension of propmat_clearsky "
697 "inconsistent with col dimension in ext_mat.");
704 if ( f_dim != propmat_clearsky.
npages() )
705 throw runtime_error(
"Frequency dimension of ext_mat and propmat_clearsky\n"
706 "are inconsistent in ext_matAddGas.");
711 Tensor3 abs_total(f_dim,stokes_dim,stokes_dim);
716 for (
Index iv=0; iv<f_dim; ++iv )
717 for (
Index is1=0; is1<stokes_dim; ++is1 )
718 for (
Index is2=0; is2<stokes_dim; ++is2 )
719 abs_total(iv,is1,is2) += propmat_clearsky(
joker,iv,is1,is2).sum();
722 ext_mat += abs_total;
730 const Index& stokes_dim,
731 const Index& f_index,
739 freq_dim = f_grid.
nelem();
747 out2 <<
"Set dimensions of abs_vec as ["
749 << stokes_dim <<
"] and initialized to 0.\n";
755 const Tensor4& propmat_clearsky,
764 if ( f_dim != propmat_clearsky.
npages() )
765 throw runtime_error(
"Frequency dimension of abs_vec and propmat_clearsky\n"
766 "are inconsistent in abs_vecAddGas.");
767 if ( stokes_dim != propmat_clearsky.
ncols() )
768 throw runtime_error(
"Stokes dimension of abs_vec and propmat_clearsky\n"
769 "are inconsistent in abs_vecAddGas.");
773 for (
Index i=0; i<f_dim; ++i )
777 for(
Index is = 0; is < stokes_dim;is++)
778 abs_vec(i,is) += propmat_clearsky(
joker,i,is,0).sum();
835 const Index& atmosphere_dim,
836 const Index& scat_p_index,
837 const Index& scat_lat_index,
838 const Index& scat_lon_index,
847 pha_mat.
resize(Nza, Naa, stokes_dim, stokes_dim);
852 if (atmosphere_dim == 1)
855 for (
Index pt_index = 0; pt_index < N_pt; ++ pt_index)
858 for (
Index za_index = 0; za_index < Nza; ++ za_index)
860 for (
Index aa_index = 0; aa_index < Naa; ++ aa_index)
864 for (
Index stokes_index_1 = 0; stokes_index_1 < stokes_dim;
867 for (
Index stokes_index_2 = 0; stokes_index_2 < stokes_dim;
871 pha_mat(za_index, aa_index,
872 stokes_index_1, stokes_index_2) +=
874 (pha_mat_spt(pt_index, za_index, aa_index,
875 stokes_index_1, stokes_index_2) *
876 pnd_field(pt_index,scat_p_index, 0, 0));
883 if (atmosphere_dim == 3)
886 for (
Index pt_index = 0; pt_index < N_pt; ++ pt_index)
890 for (
Index za_index = 0; za_index < Nza; ++ za_index)
892 for (
Index aa_index = 0; aa_index < Naa; ++ aa_index)
896 for (
Index i = 0; i < stokes_dim; ++ i)
898 for (
Index j = 0; j < stokes_dim; ++ j)
902 pha_mat(za_index, aa_index, i,j ) +=
903 (pha_mat_spt(pt_index, za_index, aa_index, i, j) *
904 pnd_field(pt_index, scat_p_index,
905 scat_lat_index, scat_lon_index));
935 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
937 out2 <<
" particle " << i_pt <<
"\n";
945 out2 <<
"frequency " <<
F_DATAGRID[f] <<
"Hz\n";
948 out2 <<
"Temperature " <<
T_DATAGRID[t] <<
"K\n";
955 Numeric Cabs = Cext_data - Csca;
959 Numeric Csca_data = Cext_data - Cabs_data;
962 out2 <<
" Coefficients in database: "
963 <<
"Cext: " << Cext_data <<
" Cabs: " << Cabs_data
964 <<
" Csca: " << Csca_data <<
"\n"
965 <<
" Calculated coefficients: "
966 <<
"Cabs calc: " << Cabs
967 <<
" Csca calc: " << Csca <<
"\n"
969 <<
"Cabs: " << 1e2*Cabs/Cabs_data-1e2
970 <<
"% Csca: " << 1e2*Csca/Csca_data-1e2
971 <<
"% Alb: " << (Csca-Csca_data)/Cext_data <<
"\n";
977 if (
abs(Csca-Csca_data)/Cext_data > threshold)
980 os <<
" Deviations in scat_data_array too large:\n"
981 <<
" scat dev [%] " << 1e2*Csca/Csca_data-1e2
982 <<
" at albedo of " << Csca_data/Cext_data <<
"\n"
983 <<
" Check entry for particle " << i_pt <<
" at "
984 << f <<
".frequency and " << t <<
".temperature!\n";
985 throw runtime_error( os.str() );
995 out0 <<
" WARNING:\n"
996 <<
" scat_data_array consistency check not implemented (yet?!) for\n"
997 <<
" particle type " <<
PART_TYPE <<
"!\n";
1010 const Index& doit_za_grid_size,
1011 const Vector& scat_aa_grid,
1015 const Index& f_index,
1016 const Index& atmosphere_dim,
1017 const Index& stokes_dim,
1026 if(atmosphere_dim == 1)
1029 N_aa_sca = scat_aa_grid.
nelem();
1032 nlinspace(za_grid, 0, 180, doit_za_grid_size);
1034 assert( scat_data_array.
nelem() == scat_data_array_mono.
nelem() );
1038 pha_mat_sptDOITOpt.resize(N_pt);
1040 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
1042 Index N_T = scat_data_array_mono[i_pt].T_grid.
nelem();
1043 pha_mat_sptDOITOpt[i_pt].resize(N_T, doit_za_grid_size, N_aa_sca,
1044 doit_za_grid_size, scat_aa_grid.
nelem(),
1045 stokes_dim, stokes_dim);
1048 pha_mat_sptDOITOpt[i_pt]= 0.;
1052 for (
Index t_idx = 0; t_idx < N_T; t_idx ++)
1055 for (
Index za_sca_idx = 0; za_sca_idx < doit_za_grid_size; za_sca_idx ++)
1057 for (
Index aa_sca_idx = 0; aa_sca_idx < N_aa_sca; aa_sca_idx ++)
1060 for (
Index za_inc_idx = 0; za_inc_idx < doit_za_grid_size;
1063 for (
Index aa_inc_idx = 0; aa_inc_idx <
1064 scat_aa_grid.
nelem();
1069 aa_sca_idx, za_inc_idx, aa_inc_idx,
1071 scat_data_array_mono[i_pt].
1075 scat_data_array_mono[i_pt].za_grid,
1076 scat_data_array_mono[i_pt].aa_grid,
1077 scat_data_array_mono[i_pt].particle_type,
1098 const Index& f_index,
1107 for (
Index i = 0; i<scat_data_array.
nelem(); i++)
1111 scat_data_array[i].f_grid,
1132 scat_data_array_mono.resize(N_pt);
1135 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
1146 scat_data_array_mono[i_pt].particle_type=
PART_TYPE;
1147 scat_data_array_mono[i_pt].f_grid.resize(1);
1148 scat_data_array_mono[i_pt].f_grid=f_grid[f_index];
1149 scat_data_array_mono[i_pt].T_grid=scat_data_array[i_pt].T_grid;
1154 scat_data_array_mono[i_pt].pha_mat_data.resize(1,
1170 for (
Index i_za_inc = 0; i_za_inc <
1174 for (
Index i_aa_inc = 0;
1180 scat_data_array_mono[i_pt].pha_mat_data(0, t_index,
1197 scat_data_array_mono[i_pt].ext_mat_data.resize(1,
T_DATAGRID.nelem(),
1212 scat_data_array_mono[i_pt].ext_mat_data(0, t_index,
1213 i_za_sca, i_aa_sca, i)
1221 scat_data_array_mono[i_pt].abs_vec_data.resize(1,
T_DATAGRID.nelem(),
1236 scat_data_array_mono[i_pt].abs_vec_data(0, t_index, i_za_sca,
1255 const Vector& scat_za_grid,
1256 const Vector& scat_aa_grid,
1257 const Index& scat_za_index,
1258 const Index& scat_aa_index,
1259 const Numeric& rtp_temperature,
1261 const Index& scat_p_index,
1262 const Index& scat_lat_index,
1263 const Index& scat_lon_index,
1266 const Index N_pt = scat_data_array_mono.
nelem();
1267 const Index stokes_dim = ext_mat_spt.
ncols();
1268 const Numeric za_sca = scat_za_grid[scat_za_index];
1269 const Numeric aa_sca = scat_aa_grid[scat_aa_index];
1271 if (stokes_dim > 4 || stokes_dim < 1){
1272 throw runtime_error(
"The dimension of the stokes vector \n"
1273 "must be 1,2,3 or 4");
1276 assert( ext_mat_spt.
npages() == N_pt );
1277 assert( abs_vec_spt.
nrows() == N_pt );
1288 for (
Index i_pt = 0; i_pt < N_pt; i_pt++)
1292 if (pnd_field(i_pt, scat_p_index, scat_lat_index, scat_lon_index) >
PND_LIMIT)
1304 Index ext_npages = scat_data_array_mono[i_pt].ext_mat_data.npages();
1305 Index ext_nrows = scat_data_array_mono[i_pt].ext_mat_data.nrows();
1306 Index ext_ncols = scat_data_array_mono[i_pt].ext_mat_data.ncols();
1307 Index abs_npages = scat_data_array_mono[i_pt].abs_vec_data.npages();
1308 Index abs_nrows = scat_data_array_mono[i_pt].abs_vec_data.nrows();
1309 Index abs_ncols = scat_data_array_mono[i_pt].abs_vec_data.ncols();
1310 Tensor3 ext_mat_data1temp(ext_npages,ext_nrows,ext_ncols,0.0);
1311 Tensor3 abs_vec_data1temp(abs_npages,abs_nrows,abs_ncols,0.0);
1316 if (t_grid.
nelem() > 1)
1324 gridpos(t_gp, scat_data_array_mono[i_pt].T_grid, rtp_temperature);
1326 for (
Index i_p = 0; i_p < ext_npages ; i_p++)
1328 for (
Index i_r = 0; i_r < ext_nrows ; i_r++)
1330 for (
Index i_c = 0; i_c < ext_ncols ; i_c++)
1332 ext_mat_data1temp(i_p,i_r,i_c)=
interp(itw,
1333 scat_data_array_mono[i_pt].ext_mat_data(0,
joker,i_p,i_r,i_c),t_gp);
1346 scat_data_array_mono[i_pt].za_grid,
1347 scat_data_array_mono[i_pt].aa_grid,
1348 scat_data_array_mono[i_pt].particle_type,
1355 if (t_grid.
nelem() > 1)
1358 for (
Index i_p = 0; i_p < abs_npages ; i_p++)
1360 for (
Index i_r = 0; i_r < abs_nrows ; i_r++)
1362 for (
Index i_c = 0; i_c < abs_ncols ; i_c++)
1364 abs_vec_data1temp(i_p,i_r,i_c)=
interp(itw,
1365 scat_data_array_mono[i_pt].abs_vec_data(0,
joker,i_p,i_r,i_c),t_gp);
1378 scat_data_array_mono[i_pt].za_grid,
1379 scat_data_array_mono[i_pt].aa_grid,
1380 scat_data_array_mono[i_pt].particle_type,
1394 const Index& doit_za_grid_size,
1395 const Vector& scat_aa_grid,
1396 const Index& scat_za_index,
1397 const Index& scat_aa_index,
1398 const Numeric& rtp_temperature,
1400 const Index& scat_p_index,
1401 const Index& scat_lat_index,
1402 const Index& scat_lon_index,
1407 out3 <<
"Calculate *pha_mat_spt* from scat_data_array_mono. \n";
1410 nlinspace(za_grid, 0, 180, doit_za_grid_size);
1412 const Index N_pt = scat_data_array_mono.
nelem();
1413 const Index stokes_dim = pha_mat_spt.
ncols();
1417 if (stokes_dim > 4 || stokes_dim < 1){
1418 throw runtime_error(
"The dimension of the stokes vector \n"
1419 "must be 1,2,3 or 4");
1422 assert( pha_mat_spt.
nshelves() == N_pt );
1430 for (
Index i_pt = 0; i_pt < N_pt; i_pt ++)
1435 if (pnd_field(i_pt, scat_p_index, scat_lat_index, scat_lon_index) >
1439 Tensor3 pha_mat_spt_tmp(scat_data_array_mono[i_pt].T_grid.
nelem(),
1442 pha_mat_spt_tmp = 0.;
1444 if( scat_data_array_mono[i_pt].T_grid.
nelem() > 1)
1447 os <<
"The temperature grid of the scattering data does not cover the \n"
1448 "atmospheric temperature at cloud location. The data should \n"
1449 "include the value T="<< rtp_temperature <<
" K. \n";
1453 gridpos(T_gp, scat_data_array_mono[i_pt].T_grid, rtp_temperature);
1459 for (
Index za_inc_idx = 0; za_inc_idx < doit_za_grid_size;
1462 for (
Index aa_inc_idx = 0; aa_inc_idx < scat_aa_grid.
nelem();
1465 for (
Index t_idx = 0; t_idx <
1466 scat_data_array_mono[i_pt].T_grid.
nelem();
1470 scat_data_array_mono[i_pt].
1474 scat_data_array_mono[i_pt].za_grid,
1475 scat_data_array_mono[i_pt].aa_grid,
1476 scat_data_array_mono[i_pt].particle_type,
1477 scat_za_index, scat_aa_index,
1479 aa_inc_idx, za_grid, scat_aa_grid,
1483 if( scat_data_array_mono[i_pt].T_grid.
nelem() > 1)
1485 for (
Index i = 0; i< stokes_dim; i++)
1487 for (
Index j = 0; j< stokes_dim; j++)
1489 pha_mat_spt(i_pt, za_inc_idx, aa_inc_idx, i, j)=
1496 pha_mat_spt(i_pt, za_inc_idx, aa_inc_idx,
joker,
joker) =
1511 const Index& atmosphere_dim,
1512 const Index& cloudbox_on,
1517 const Index& cloudbox_checked,
1520 if (!cloudbox_checked)
1521 throw std::runtime_error(
"You must call *cloudbox_checkedCalc* before this method.");
1523 if (atmosphere_dim != 1)
1524 throw std::runtime_error(
"Merging particles only works with a 1D atmoshere");
1530 pnd_field.
resize(0, 0, 0, 0);
1537 limits[0] = cloudbox_limits[0];
1538 limits[1] = cloudbox_limits[1] + 1;
1540 Tensor4 pnd_field_merged(limits[1] - limits[0],
1541 limits[1] - limits[0],
1548 scat_data_array_merged.resize(pnd_field_merged.
nbooks());
1549 for (
Index sp = 0; sp < scat_data_array_merged.
nelem(); sp++)
1554 this_part.
f_grid = scat_data_array[0].f_grid;
1555 this_part.
za_grid = scat_data_array[0].za_grid;
1556 this_part.
aa_grid = scat_data_array[0].aa_grid;
1560 scat_data_array[0].pha_mat_data.nshelves(),
1561 scat_data_array[0].pha_mat_data.nbooks(),
1562 scat_data_array[0].pha_mat_data.npages(),
1563 scat_data_array[0].pha_mat_data.nrows(),
1564 scat_data_array[0].pha_mat_data.ncols());
1567 scat_data_array[0].ext_mat_data.npages(),
1568 scat_data_array[0].ext_mat_data.nrows(),
1569 scat_data_array[0].ext_mat_data.ncols());
1572 scat_data_array[0].abs_vec_data.npages(),
1573 scat_data_array[0].abs_vec_data.nrows(),
1574 scat_data_array[0].abs_vec_data.ncols());
1579 this_part.
T_grid[0] = t_field(sp, 0, 0);
1584 for (
Index i_pt = 1; i_pt < pnd_field.
nbooks(); i_pt++)
1589 throw std::runtime_error(
"All particles must have the same type");
1592 throw std::runtime_error(
"All particles must have the same f_grid");
1602 throw std::runtime_error(
"All particles must have the same pha_mat_data size"
1603 " (except for temperature).");
1611 throw std::runtime_error(
"All particles must have the same ext_mat_data size"
1612 " (except for temperature).");
1620 throw std::runtime_error(
"All particles must have the same abs_vec_data size"
1621 " (except for temperature).");
1631 for (
Index i_lv = 0; i_lv < nlevels-1; i_lv++)
1633 pnd_field_merged(i_lv,i_lv,0,0) = 1.;
1636 for (
Index i_pt = 0; i_pt < pnd_field.
nbooks(); i_pt++)
1643 if (pnd_field(i_pt, i_lv, 0, 0) >
PND_LIMIT)
1646 if( scat_data_array[i_pt].T_grid.
nelem() > 1)
1649 os <<
"The temperature grid of the scattering data does not cover the \n"
1650 "atmospheric temperature at cloud location. The data should \n"
1651 "include the value T="<< this_part.
T_grid[0] <<
" K. \n";
1664 if( scat_data_array[i_pt].T_grid.
nelem() == 1)
1667 pnd_field(i_pt, i_lv, 0, 0)
1671 pnd_field(i_pt, i_lv, 0, 0)
1680 pnd_field(i_pt, i_lv, 0, 0)
1689 pnd_field(i_pt, i_lv, 0, 0)
1700 if( scat_data_array[i_pt].T_grid.
nelem() == 1)
1702 const Numeric pnd = pnd_field(i_pt, i_lv, 0, 0);
1706 pnd * orig_part.
pha_mat_data(i_f, 0, i_za, 0, 0, 0, i_s);
1715 pnd_field(i_pt, i_lv, 0, 0)
1730 if (z_field(cloudbox_limits[0], 0, 0) > z_surface(0, 0))
1731 pnd_field_merged(0, 0, 0, 0) = 0.;
1733 pnd_field = pnd_field_merged;
1734 scat_data_array = scat_data_array_merged;
1746 const Index& part_species_index,
1749 if ( part_species_index<0 )
1752 os <<
"part_species_index can't be <0!";
1753 throw runtime_error( os.str() );
1756 const Index nps = scat_data_per_part_species.
nelem();
1760 if ( !(nps>part_species_index) )
1763 os <<
"Can not extract data for scattering species #"
1764 << part_species_index <<
"\n"
1765 <<
"because scat_data_per_part_species has only " << nps <<
" elements.";
1766 throw runtime_error( os.str() );
1769 const Index npe = scat_data_per_part_species[part_species_index];
1775 for (
Index i=0; i<part_species_index; i++ )
1776 indoff+=scat_data_per_part_species[i];
1779 for (
Index i=0; i<npe; i++ )
1781 if ( meta_name==
"volume" )
1782 meta_param[i] = scat_meta_array[indoff+i].volume;
1783 else if ( meta_name==
"diameter_max" )
1784 meta_param[i] = scat_meta_array[indoff+i].diameter_max;
1785 else if ( meta_name==
"density" )
1786 meta_param[i] = scat_meta_array[indoff+i].density;
1787 else if ( meta_name==
"area_projected" )
1788 meta_param[i] = scat_meta_array[indoff+i].area_projected;
1789 else if ( meta_name==
"aspect_ratio" )
1790 meta_param[i] = scat_meta_array[indoff+i].aspect_ratio;
1794 os <<
"Meta parameter \"" << meta_name <<
"\"is unknown.";
1795 throw runtime_error( os.str() );