79 Agenda& iy_cloudbox_agenda,
86 cloudbox_limits.resize ( 0 );
87 iy_cloudbox_agenda =
Agenda();
88 iy_cloudbox_agenda.
set_name (
"iy_cloudbox_agenda" );
90 scat_data_array.resize(0);
91 particle_masses.
resize(0,0);
103 const Index& atmosphere_dim,
107 const Tensor4& massdensity_field,
109 const Numeric& cloudbox_margin,
133 chk_atm_grids ( atmosphere_dim, p_grid, lat_grid, lon_grid );
138 cloudbox_limits.resize ( atmosphere_dim*2 );
141 for ( l=0; l<massdensity_field.
nbooks(); l++ )
158 if ( atmosphere_dim == 1 )
165 if ( cloudbox_margin == -1 )
167 cloudbox_limits[0] = 0;
174 for ( i=0; i<hydro_p.
nelem(); i++ )
176 if ( hydro_p[i] != 0.0 )
191 for ( j=hydro_p.
nelem()-1; j>=i; j-- )
193 if ( hydro_p[j] != 0.0 )
282 while ( p_grid[k+1] >= p_margin1 && k+1 < p_grid.
nelem() ) k++;
283 cloudbox_limits[0]= k;
287 p2 =
min(p2+1, massdensity_field.
npages()-1);
290 if ( p2 >= massdensity_field.
npages()-1)
293 out2<<
"The cloud reaches to TOA!\n"
294 <<
"Check massdensity_field data, if realistic!\n";
296 cloudbox_limits[1] = p2;
307 out0<<
"Cloudbox is switched off!\n";
316 assert ( p_grid[p1] > p_grid[p2] );
318 assert ( p_grid[p1] > p_grid[p_grid.
nelem()-1] );
320 assert ( p_grid[p2] < p_grid[0] );
322 if ( atmosphere_dim >= 2 )
325 assert ( lat_grid[lat2] > lat_grid[lat1] );
327 assert ( lat_grid[lat1] >= lat_grid[1] );
329 assert ( lat_grid[lat2] <= lat_grid[lat_grid.
nelem()-2] );
331 if ( atmosphere_dim == 3 )
334 assert ( lon_grid[lon2] > lon_grid[lon1] );
336 assert ( lon_grid[lon1] >= lon_grid[1] );
338 assert ( lon_grid[lon2] <= lon_grid[lon_grid.
nelem()-2] );
347 const Index& atmosphere_dim,
351 if( atmosphere_dim > 1 )
354 os <<
"WSM *cloudboxSetFullAtm* only available for atmosphere_dim=1.";
355 throw runtime_error( os.str() );
358 cloudbox_limits.resize(2);
359 cloudbox_limits[0] = 0;
360 cloudbox_limits[1] = p_grid.
nelem()-1;
369 const Index& atmosphere_dim,
388 throw runtime_error(
"The pressure in *p1* must be bigger than the "
389 "pressure in *p2*." );
390 if( p1 <= p_grid[p_grid.
nelem()-1] )
391 throw runtime_error(
"The pressure in *p1* must be larger than the "
392 "last value in *p_grid*." );
393 if( p2 >= p_grid[0] )
394 throw runtime_error(
"The pressure in *p2* must be smaller than the "
395 "first value in *p_grid*." );
396 if( atmosphere_dim >= 2 )
399 throw runtime_error(
"The latitude in *lat2* must be bigger than the "
400 "latitude in *lat1*.");
401 if( lat1 < lat_grid[1] )
402 throw runtime_error(
"The latitude in *lat1* must be >= the "
403 "second value in *lat_grid*." );
404 if( lat2 > lat_grid[lat_grid.
nelem()-2] )
405 throw runtime_error(
"The latitude in *lat2* must be <= the "
406 "next to last value in *lat_grid*." );
408 if( atmosphere_dim == 3 )
411 throw runtime_error(
"The longitude in *lon2* must be bigger than the "
412 "longitude in *lon1*.");
413 if( lon1 < lon_grid[1] )
414 throw runtime_error(
"The longitude in *lon1* must be >= the "
415 "second value in *lon_grid*." );
416 if( lon2 > lon_grid[lon_grid.
nelem()-2] )
417 throw runtime_error(
"The longitude in *lon2* must be <= the "
418 "next to last value in *lon_grid*." );
425 cloudbox_limits.resize( atmosphere_dim*2 );
430 cloudbox_limits[0] = 0;
434 for( cloudbox_limits[0]=1; p_grid[cloudbox_limits[0]+1]>=p1;
435 cloudbox_limits[0]++ ) {}
437 if( p2 < p_grid[p_grid.
nelem()-2] )
439 cloudbox_limits[1] = p_grid.
nelem() - 1;
443 for( cloudbox_limits[1]=p_grid.
nelem()-2;
444 p_grid[cloudbox_limits[1]-1]<=p2; cloudbox_limits[1]-- ) {}
448 if( atmosphere_dim >= 2 )
450 for( cloudbox_limits[2]=1; lat_grid[cloudbox_limits[2]+1]<=lat1;
451 cloudbox_limits[2]++ ) {}
452 for( cloudbox_limits[3]=lat_grid.
nelem()-2;
453 lat_grid[cloudbox_limits[3]-1]>=lat2; cloudbox_limits[3]-- ) {}
457 if( atmosphere_dim == 3 )
459 for( cloudbox_limits[4]=1; lon_grid[cloudbox_limits[4]+1]<=lon1;
460 cloudbox_limits[4]++ ) {}
461 for( cloudbox_limits[5]=lon_grid.
nelem()-2;
462 lon_grid[cloudbox_limits[5]-1]>=lon2; cloudbox_limits[5]-- ) {}
472 const Index& atmosphere_dim,
490 throw runtime_error(
"The altitude in *z1* must be smaller than the "
491 "altitude in *z2*." );
500 if( atmosphere_dim == 3 )
503 throw runtime_error(
"The latitude in *lat2* must be bigger than the "
504 " latitude in *lat1*.");
505 if( lat1 < lat_grid[1] )
506 throw runtime_error(
"The latitude in *lat1* must be >= the "
507 "second value in *lat_grid*." );
508 if( lat2 > lat_grid[lat_grid.
nelem()-2] )
509 throw runtime_error(
"The latitude in *lat2* must be <= the "
510 "next to last value in *lat_grid*." );
512 throw runtime_error(
"The longitude in *lon2* must be bigger than the "
513 "longitude in *lon1*.");
514 if( lon1 < lon_grid[1] )
515 throw runtime_error(
"The longitude in *lon1* must be >= the "
516 "second value in *lon_grid*." );
517 if( lon2 > lon_grid[lon_grid.
nelem()-2] )
518 throw runtime_error(
"The longitude in *lon2* must be <= the "
519 "next to last value in *lon_grid*." );
526 cloudbox_limits.resize( atmosphere_dim*2 );
529 if( z1 < z_field(1, 0, 0) )
531 cloudbox_limits[0] = 0;
535 for( cloudbox_limits[0]=1; z_field(cloudbox_limits[0]+1, 0, 0) <= z1;
536 cloudbox_limits[0]++ ) {}
538 if( z2 > z_field(z_field.
npages()-2, 0, 0) )
540 cloudbox_limits[1] = z_field.
npages() - 1;
544 for( cloudbox_limits[1]=z_field.
npages()- 2;
545 z_field(cloudbox_limits[1]-1, 0, 0) >= z2; cloudbox_limits[1]-- ) {}
549 if( atmosphere_dim >= 2 )
551 for( cloudbox_limits[2]=1; lat_grid[cloudbox_limits[2]+1]<=lat1;
552 cloudbox_limits[2]++ ) {}
553 for( cloudbox_limits[3]=lat_grid.
nelem()-2;
554 lat_grid[cloudbox_limits[3]-1]>=lat2; cloudbox_limits[3]-- ) {}
558 if( atmosphere_dim == 3 )
560 for( cloudbox_limits[4]=1; lon_grid[cloudbox_limits[4]+1]<=lon1;
561 cloudbox_limits[4]++ ) {}
562 for( cloudbox_limits[5]=lon_grid.
nelem()-2;
563 lon_grid[cloudbox_limits[5]-1]>=lon2; cloudbox_limits[5]-- ) {}
573 const Numeric& massdensity_threshold,
578 for (
Index i=0; i<massdensity_field.
nbooks(); i++ )
580 for (
Index j=0; j<massdensity_field.
npages(); j++ )
582 for (
Index k=0; k<massdensity_field.
nrows(); k++ )
584 for (
Index l=0; l<massdensity_field.
ncols(); l++ )
586 if ( massdensity_field ( i,j,k,l ) < massdensity_threshold )
588 massdensity_field ( i,j,k,l ) = 0.0;
601 part_species.resize ( 0 );
615 part_species.resize ( particle_tags.
nelem() );
617 part_species = particle_tags;
622 out3 <<
" Defined particle settings: ";
623 for (
Index i=0; i<part_species.
nelem(); ++i )
625 out3 <<
"\n " << i <<
": "<<part_species[i];
637 scat_data_array.resize(0);
638 pnd_field_raw.resize(0);
647 const Index& atmosphere_dim,
653 const String& scat_data_file,
654 const String& pnd_field_file,
666 if( f_grid.
nelem() == 0 )
667 throw runtime_error(
"The frequency grid is empty." );
675 scat_data_array.push_back(scat_data);
678 pnd_field_raw.push_back(pnd_field_data);
680 out2 <<
" Read single scattering data\n";
685 scat_data_file, f_grid, verbosity);
687 out2 <<
" Read particle number density field\n";
688 if (pnd_field_file.
nelem() < 1)
691 out1 <<
"Warning: No pnd_field_file specified. Ignored. \n";
699 pnd_field_file, atmosphere_dim, verbosity);
709 const Index& atmosphere_dim,
715 const String& filelist_scat_data,
716 const String& pnd_fieldarray_file,
728 if ( f_grid.
nelem() == 0 )
729 throw runtime_error (
"The frequency grid is empty." );
736 scat_data_array.resize ( data_files.
nelem() );
738 for (
Index i = 0; i<data_files.
nelem(); i++ )
741 out2 <<
" Read single scattering data\n";
745 data_files[i], f_grid,
750 out2 <<
" Read particle number density data \n";
754 pnd_fieldarray_file, atmosphere_dim, verbosity);
763 Index& propmat_clearsky_agenda_checked,
764 Index& abs_xsec_agenda_checked,
766 const Index& atmosphere_dim,
772 const String& scat_data_file,
773 const String& pnd_field_file,
785 if( f_grid.
nelem() == 0 )
786 throw runtime_error(
"The frequency grid is empty." );
795 scat_data_array.push_back(scat_data);
797 out2 <<
" Read single scattering data\n";
802 scat_data_file, f_grid, verbosity);
804 out2 <<
" Read particle number density field\n";
805 if (pnd_field_file.
nelem() < 1)
808 out1 <<
"Warning: No pnd_field_file specified. Ignored here,\n"
809 <<
"but user HAS TO add that later on!\n";
814 vmr_field_raw.push_back(pnd_field_data);
820 pnd_field_file, atmosphere_dim, verbosity);
823 out2 <<
" Append 'particle' field to abs_species\n";
825 species.push_back(
"particles");
828 propmat_clearsky_agenda_checked, abs_xsec_agenda_checked,
829 species, verbosity );
840 const String& filename_scat_data,
841 const String& filename_scat_meta_data,
852 scat_data_array.resize ( data_files.
nelem() );
854 for (
Index i = 0; i<data_files.
nelem(); i++ )
856 out3 <<
" Read single scattering data\n";
860 data_files[i], f_grid,
867 scat_meta_array.resize ( meta_data_files.
nelem() );
869 for (
Index i = 0; i<meta_data_files.
nelem(); i++ )
872 out3 <<
" Read scattering meta data\n";
877 meta_data_files[i], verbosity );
883 scat_meta_array, verbosity );
902 Index intarr_total = 0;
909 scat_data_per_part_species.resize( part_species.
nelem() );
912 selected.resize(scat_meta_array_tmp.
nelem());
915 for (
Index k=0; k<part_species.
nelem(); k++ )
929 for (
Index j=0; j<scat_meta_array_tmp.
nelem(); j++ )
932 if ( scat_meta_array_tmp[j].material == part_material )
937 pow ( 3./4. * scat_meta_array_tmp[j].volume * 1e18 /
PI , 1./3. );
942 if ( r_particle >= sizemin &&
943 ( sizemax >= r_particle || sizemax < 0. ))
946 intarr.push_back ( j );
949 out3 <<
"Selecting particle " << j+1 <<
"/" << scat_meta_array_tmp.
nelem()
950 <<
" (" << scat_meta_array_tmp[j].material <<
")\n";
955 scat_data_per_part_species[k] = intarr.
nelem() - intarr_total;
956 intarr_total = intarr.
nelem();
961 if (scat_data_per_part_species[k]<1)
964 os <<
"Particle species " << partfield_name <<
" of type " << part_material
966 <<
"But no Scattering Data found for it!\n";
967 throw runtime_error ( os.str() );
972 if ( !intarr.
nelem() )
981 out1 <<
"WARNING! No ScatteringData selected.\n"
982 <<
"Continuing with no particles.\n";
999 scat_data_array.resize ( intarr.
nelem() );
1000 scat_meta_array.resize ( intarr.
nelem() );
1005 scat_meta_array[j] = scat_meta_array_tmp[intarr[j]] ;
1006 scat_data_array[j] = scat_data_array_tmp[intarr[j]] ;
1022 particle_masses.
resize(np,1);
1024 for(
Index i=0; i<np; i++ )
1026 if( scat_meta_array[i].density <= 0 ||
1027 scat_meta_array[i].density > 20e3 )
1030 os <<
"A presumably incorrect value found for "
1031 <<
"scat_meta_array[" << i <<
"].density.\n"
1032 <<
"The value is " << scat_meta_array[i].density;
1033 throw std::runtime_error(os.str());
1036 if( scat_meta_array[i].volume <= 0 ||
1037 scat_meta_array[i].volume > 0.01 )
1040 os <<
"A presumably incorrect value found for "
1041 <<
"scat_meta_array[" << i <<
"].volume.\n"
1042 <<
"The value is " << scat_meta_array[i].volume;
1043 throw std::runtime_error(os.str());
1046 particle_masses(i,0) = scat_meta_array[i].density *
1047 scat_meta_array[i].volume;
1064 if (scat_data_per_part_species.
nelem() != part_species.
nelem())
1067 os <<
"Dimensions of part_species and scat_data_per_part_species do not agree.";
1068 throw runtime_error(os.str());
1073 particle_masses = 0.;
1074 Index scat_data_start = 0;
1077 for (
Index k=0; k<part_species.
nelem(); k++ )
1079 for (
Index j=scat_data_start; j<scat_data_start+scat_data_per_part_species[k]; j++ )
1081 particle_masses (j, k) =
1082 scat_meta_array[j].density * scat_meta_array[j].volume;
1085 scat_data_start += scat_data_per_part_species[k];
1099 const Index& atmosphere_dim,
1101 const Index& zeropadding,
1108 if (pnd_field_raw.
nelem() == 0)
1109 throw runtime_error(
1110 "No particle number density data given. Please\n"
1111 "use WSMs *ParticleTypeInit* and \n"
1112 "*ParticleTypeAdd(All)* for reading cloud particle\n"
1116 chk_atm_grids( atmosphere_dim, p_grid, lat_grid, lon_grid );
1144 if ( cloudbox_limits.
nelem()!= 2*atmosphere_dim)
1145 throw runtime_error(
1146 "*cloudbox_limits* is a vector which contains the"
1147 "upper and lower limit of the cloud for all "
1148 "atmospheric dimensions. So its dimension must"
1149 "be 2 x *atmosphere_dim*");
1151 cloudbox_limits_tmp = cloudbox_limits;
1156 for (
Index d = 0; d < atmosphere_dim; d++)
1158 for (
Index i = 0; i < pnd_field_raw.
nelem(); i++)
1160 if (pnd_field_raw[i].get_grid_size(d) < 2)
1163 os <<
"Error in pnd_field_raw data. ";
1164 os <<
"Dimension " << d <<
" (name: \"";
1165 os << pnd_field_raw[i].get_grid_name(d);
1166 os <<
"\") has only ";
1167 os << pnd_field_raw[i].get_grid_size(d);
1169 os << ((pnd_field_raw[i].get_grid_size(d)==1) ?
"" :
"s");
1170 os <<
". Must be at least 2.";
1171 throw runtime_error(os.str());
1175 const Index Np_cloud = cloudbox_limits_tmp[1]-cloudbox_limits_tmp[0]+1;
1181 p_grid, lat_grid, lon_grid,
1182 cloudbox_limits_tmp);
1185 if ( atmosphere_dim == 1)
1190 1, zeropadding, verbosity);
1194 pnd_field_tmp[0].get_numeric_grid(1),
1195 pnd_field_tmp[0].get_numeric_grid(2),
1196 pnd_field_tmp, verbosity);
1198 else if(atmosphere_dim == 2)
1200 const Index Nlat_cloud = cloudbox_limits_tmp[3]-cloudbox_limits_tmp[2]+1;
1203 lat_grid[
Range(cloudbox_limits_tmp[2],Nlat_cloud)];
1209 out0 <<
"WARNING: zeropadding currently only supported for 1D.";
1213 pnd_field.
resize( pnd_field_raw.
nelem(), Np_cloud, Nlat_cloud, 1 );
1221 for (
Index i = 0; i < pnd_field_raw.
nelem(); ++ i)
1230 Tensor3 itw( Np_cloud, Nlat_cloud, 4 );
1235 pnd_field_raw[i].data(
joker,
joker,0), gp_p, gp_lat );
1240 const Index Nlat_cloud = cloudbox_limits_tmp[3]-cloudbox_limits_tmp[2]+1;
1241 const Index Nlon_cloud = cloudbox_limits_tmp[5]-cloudbox_limits_tmp[4]+1;
1247 out0 <<
"WARNING: zeropadding currently only supported for 1D.";
1251 lat_grid[
Range(cloudbox_limits_tmp[2],Nlat_cloud)];
1253 lon_grid[
Range(cloudbox_limits_tmp[4],Nlon_cloud)];
1256 pnd_field.
resize( pnd_field_raw.
nelem(), Np_cloud, Nlat_cloud,
1266 for (
Index i = 0; i < pnd_field_raw.
nelem(); ++ i)
1277 Tensor4 itw( Np_cloud, Nlat_cloud, Nlon_cloud, 8 );
1282 pnd_field_raw[i].data, gp_p, gp_lat, gp_lon );
1290 const Index& atmosphere_dim,
1291 const Index& cloudbox_on,
1300 if( atmosphere_dim == 1 )
1301 {
throw runtime_error(
"No use in calling this method for 1D." ); }
1303 {
throw runtime_error(
1304 "No use in calling this method with cloudbox off." ); }
1307 {
throw runtime_error(
"The argument *nzero must be > 0." ); }
1311 const Index np = cloudbox_limits[1] - cloudbox_limits[0] + 1;
1312 const Index nlat = cloudbox_limits[3] - cloudbox_limits[2] + 1;
1314 if( atmosphere_dim == 3 )
1315 { nlon = cloudbox_limits[5] - cloudbox_limits[4] + 1; }
1317 if( pnd_field.
npages() != np || pnd_field.
nrows() != 1 ||
1318 pnd_field.
ncols() != 1 )
1319 {
throw runtime_error(
"The input *pnd_field* is either not 1D or does not "
1320 "match pressure size of cloudbox." );}
1326 pnd_field.
resize( npart, np, nlat, nlon );
1329 for(
Index ilon=nzero; ilon<nlon-nzero; ilon++ )
1331 for(
Index ilat=nzero; ilat<nlat-nzero; ilat++ )
1333 for(
Index ip=0; ip<np; ip++ )
1335 for(
Index is=0; is<npart; is++ )
1336 { pnd_field(is,ip,ilat,ilon) = pnd_temp(is,ip,0,0); }
1354 if (lat_grid.
nelem()>1)
1369 scat_data_array.resize(1);
1371 scat_data_array[0].description =
" ";
1373 nlinspace(scat_data_array[0].f_grid, 1e9, 3.848043e+13 , 5);
1374 nlinspace(scat_data_array[0].T_grid, 0, 400, 5);
1375 nlinspace(scat_data_array[0].za_grid, 0, 180, 5);
1376 nlinspace(scat_data_array[0].aa_grid, 0, 360, 5);
1378 scat_data_array[0].pha_mat_data.resize(5,5,5,1,1,1,6);
1379 scat_data_array[0].pha_mat_data = 0.;
1380 scat_data_array[0].ext_mat_data.resize(5,5,1,1,1);
1381 scat_data_array[0].ext_mat_data = 0.;
1382 scat_data_array[0].abs_vec_data.resize(5,5,1,1,1);
1383 scat_data_array[0].abs_vec_data = 0.;
1391 const Index& atmosphere_dim,
1392 const Index& cloudbox_on,
1394 const Tensor4& massdensity_field,
1408 pnd_field.
resize(0, 0, 0, 0);
1416 limits[0] = cloudbox_limits[0];
1417 limits[1] = cloudbox_limits[1]+1;
1419 if ( atmosphere_dim > 1 )
1421 limits[2] = cloudbox_limits[2];
1422 limits[3] = cloudbox_limits[3]+1;
1429 if ( atmosphere_dim > 2 )
1431 limits[4] = cloudbox_limits[4];
1432 limits[5] = cloudbox_limits[5]+1;
1442 if ((limits[1] > massdensity_field.
npages()) ||
1443 (limits[1] > t_field.
npages()) ||
1444 (limits[3] > massdensity_field.
nrows()) ||
1445 (limits[3] > t_field.
nrows()) ||
1446 (limits[5] > massdensity_field.
ncols()) ||
1447 (limits[5] > t_field.
ncols()))
1450 os <<
"Cloudbox out of bounds compared to fields. "
1451 <<
"Upper limits: (p, lat, lon): "
1452 <<
"(" << limits[1] <<
", " << limits[3] <<
", " << limits[5] <<
"). "
1453 <<
"*massdensity_field*: "
1454 <<
"(" << massdensity_field.
npages() <<
", "
1455 << massdensity_field.
nrows() <<
", "
1456 << massdensity_field.
ncols() <<
"). "
1458 <<
"(" << t_field.
npages() <<
", "
1459 << t_field.
nrows() <<
", "
1460 << t_field.
ncols() <<
").";
1461 throw runtime_error(os.str());
1465 pnd_field.
resize ( scat_meta_array.
nelem(), limits[1]-limits[0],
1466 limits[3]-limits[2], limits[5]-limits[4] );
1467 Index scat_data_start = 0;
1473 for (
Index k=0; k<part_species.
nelem(); k++ )
1487 Vector vol_unsorted ( scat_data_per_part_species[k], 0.0 );
1488 Vector d_max_unsorted (scat_data_per_part_species[k], 0.0);
1489 Vector vol ( scat_data_per_part_species[k], 0.0 );
1490 Vector dm ( scat_data_per_part_species[k], 0.0 );
1491 Vector r ( scat_data_per_part_species[k], 0.0 );
1492 Vector rho ( scat_data_per_part_species[k], 0.0 );
1493 Vector pnd ( scat_data_per_part_species[k], 0.0 );
1495 Vector dN ( scat_data_per_part_species[k], 0.0 );
1502 if ( psd_param.substr(0,4) ==
"MH97" )
1507 if ( partfield_name !=
"IWC" )
1509 out1 <<
"WARNING! The particle field name is unequal 'IWC'.\n"
1510 << psd <<
" should should only be applied to cloud"
1515 if ( part_material !=
"Ice" )
1517 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1518 << psd <<
" should only be applied to ice"
1525 scat_meta_array, scat_data_start,
1526 scat_data_per_part_species[k], part_species[k], delim,
1531 else if ( psd_param ==
"H11" )
1536 if ( partfield_name !=
"IWC" && partfield_name !=
"Snow")
1538 out1 <<
"WARNING! The particle field name is unequal 'IWC' and 'Snow'.\n"
1539 << psd <<
" should only be applied to cloud or precipitating"
1545 if ( part_material !=
"Ice" && part_material !=
"Water" )
1547 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1548 << psd <<
" should only be applied to ice (cloud ice or snow)"
1554 scat_meta_array, scat_data_start,
1555 scat_data_per_part_species[k], part_species[k], delim,
1560 else if ( psd_param ==
"H13" )
1565 if ( partfield_name !=
"IWC" && partfield_name !=
"Snow")
1567 out1 <<
"WARNING! The particle field name is unequal 'IWC' and 'Snow'.\n"
1568 << psd <<
" should only be applied to cloud or precipitating"
1574 if ( part_material !=
"Ice" && part_material !=
"Water" )
1576 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1577 << psd <<
" should only be applied to ice (cloud ice or snow)"
1584 scat_meta_array, scat_data_start,
1585 scat_data_per_part_species[k], part_species[k], delim,
1590 else if ( psd_param ==
"H13Shape" )
1595 if ( partfield_name !=
"IWC" && partfield_name !=
"Snow")
1597 out1 <<
"WARNING! The particle field name is unequal 'IWC' and 'Snow'.\n"
1598 << psd <<
" should only be applied to cloud or precipitating"
1604 if ( part_material !=
"Ice" && part_material !=
"Water" )
1606 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1607 << psd <<
" should only be applied to ice (cloud ice or snow)"
1614 scat_meta_array, scat_data_start,
1615 scat_data_per_part_species[k], part_species[k], delim,
1620 else if ( psd_param ==
"F07TR" )
1625 if ( partfield_name !=
"SWC" && partfield_name !=
"IWC")
1627 out1 <<
"WARNING! The particle field name is unequal 'IWC' and 'SWC'.\n"
1628 << psd <<
" should only be applied to cloud or precipitating"
1634 if ( part_material !=
"Ice" && part_material !=
"Snow" )
1636 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1637 << psd <<
" should only be applied to ice (cloud ice or snow)"
1644 scat_meta_array, scat_data_start,
1645 scat_data_per_part_species[k], part_species[k], delim,
1649 else if ( psd_param ==
"F07ML" )
1654 if ( partfield_name !=
"SWC" && partfield_name !=
"IWC")
1656 out1 <<
"WARNING! The particle field name is unequal 'IWC' and 'SWC'.\n"
1657 << psd <<
" should only be applied to cloud or precipitating"
1663 if ( part_material !=
"Ice" && part_material !=
"Snow" )
1665 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1666 << psd <<
" should only be applied to ice (cloud ice or snow)"
1673 scat_meta_array, scat_data_start,
1674 scat_data_per_part_species[k], part_species[k], delim,
1679 else if ( psd_param ==
"MGD_LWC" )
1684 if ( partfield_name !=
"LWC")
1686 out1 <<
"WARNING! The particle field name is unequal LWC.\n"
1687 << psd <<
" should only be applied to cloud liquid water.\n";
1691 if ( part_material !=
"Water" )
1693 out1 <<
"WARNING! The particle phase is unequal 'Water'.\n"
1694 << psd <<
" should only be applied to liquid water.\n";
1700 scat_meta_array, scat_data_start,
1701 scat_data_per_part_species[k], part_species[k], delim,
1706 else if ( psd_param ==
"MGD_IWC" )
1711 if ( partfield_name !=
"IWC")
1713 out1 <<
"WARNING! The particle field name is unequal IWC.\n"
1714 << psd <<
" should only be applied to cloud ice.\n";
1718 if ( part_material !=
"Ice" )
1720 out1 <<
"WARNING! The particle phase is unequal 'Ice'.\n"
1721 << psd <<
" should only be applied to ice.\n";
1727 scat_meta_array, scat_data_start,
1728 scat_data_per_part_species[k], part_species[k], delim,
1733 else if ( psd_param ==
"GM58" )
1738 if ( partfield_name !=
"Snow")
1740 out1 <<
"WARNING! The particle field name is unequal 'Snow'.\n"
1741 << psd <<
" should only be applied to frozen"
1742 <<
" precipitation.\n";
1746 if ( part_material !=
"Ice")
1748 out1 <<
"WARNING! The particle phase is unequal 'Ice' and 'Water'.\n"
1749 << psd <<
" should only be applied to ice particles.\n";
1755 scat_meta_array, scat_data_start,
1756 scat_data_per_part_species[k], part_species[k], delim,
1761 else if ( psd_param ==
"SS70" )
1766 if ( partfield_name !=
"Snow")
1768 out1 <<
"WARNING! The particle field name is unequal 'Snow'.\n"
1769 << psd <<
" should only be applied to frozen"
1770 <<
" precipitation.\n";
1774 if ( part_material !=
"Ice")
1776 out1 <<
"WARNING! The particle phase is unequal 'Ice' and 'Water'.\n"
1777 << psd <<
" should only be applied to ice particles.\n";
1783 scat_meta_array, scat_data_start,
1784 scat_data_per_part_species[k], part_species[k], delim,
1790 else if ( psd_param ==
"MP48" )
1795 if ( partfield_name !=
"Rain" && partfield_name !=
"Snow")
1797 out1 <<
"WARNING! The particle field name is unequal 'Rain' and 'Snow'.\n"
1798 << psd <<
" should only be applied to liquid or frozen"
1799 <<
" precipitation.\n";
1803 if ( part_material !=
"Ice" && part_material !=
"Water" )
1805 out1 <<
"WARNING! The particle phase is unequal 'Ice' and 'Water'.\n"
1806 << psd <<
" should only be applied to liquid water or water"
1807 <<
" ice particles.\n";
1813 scat_meta_array, scat_data_start,
1814 scat_data_per_part_species[k], part_species[k], delim,
1820 else if ( psd_param ==
"H98_STCO" || psd_param ==
"STCO" || psd_param ==
"liquid" )
1825 if ( partfield_name !=
"LWC")
1827 out1 <<
"WARNING! The particle field name is unequal 'LWC'.\n"
1828 << psd <<
" should should only be applied to liquid or frozen"
1829 <<
" precipitation.\n";
1833 if ( part_material !=
"Water" )
1835 out1 <<
"WARNING! The particle phase is unequal 'Water'.\n"
1836 << psd <<
" should only be applied to liquid water"
1843 scat_meta_array, scat_data_start,
1844 scat_data_per_part_species[k], part_species[k], delim,
1851 os <<
"Size distribution function '" << psd_param <<
"' is unknown!\n";
1852 throw runtime_error( os.str() );
1857 scat_data_start = scat_data_start + scat_data_per_part_species[k];
1875 if ( density.
nelem() != n )
1878 os <<
"Particle size and particle density vectors need to be of\n"
1879 <<
"identical size, but are not.";
1880 throw runtime_error(os.str());
1885 for (
Index i=0; i<n; i++ )
1889 dN[i] =
IWCtopnd_MH97 ( IWC, Dme[i], t, density[i], noisy );
1904 for (
Index i=0; i<n; i++ )
1925 for (
Index i=0; i<n; i++ )
1939 const Vector& diameter_max,
1949 for (
Index i=0; i<n_se; i++ )
1961 const Vector& diameter_max,
1971 for (
Index i=0; i<n_se; i++ )
1992 for (
Index i=0; i<n_se; i++ )
2012 for (
Index i=0; i<n_se; i++ )
2033 if ( density.
nelem() != n )
2036 os <<
"Particle size and particle density vectors need to be of\n"
2037 <<
"identical size, but are not.";
2038 throw runtime_error(os.str());
2043 for (
Index i=0; i<n; i++ )
2047 dN[i] =
LWCtopnd ( LWC, density[i], R[i] );
2062 for (
Index i=0; i<n; i++ )
2078 const Vector& scatelem_volume,
2079 const Vector& scatelem_density,
2085 if (diameter.
nelem() > 1)
2092 chk_pndsum ( pnd, total_content, scatelem_volume, scatelem_density,
2093 0, 0, 0,
"your field", verbosity );