51 const String& pnd_field_file,
52 const Index& atmosphere_dim,
56 const Vector& pfr_lat_grid =
58 const Vector& pfr_lon_grid =
65 out3 <<
"Check particle number density file " << pnd_field_file <<
"\n";
68 (pfr_lat_grid.nelem() != 1 || pfr_lon_grid.nelem() != 1),
69 "The atmospheric dimension is 1D but the particle "
70 "number density file * ", pnd_field_file,
71 " is for a 3D atmosphere. \n")
73 if (atmosphere_dim == 3) {
75 "The atmospheric dimension is 3D but the particle "
76 "number density file * ", pnd_field_file,
77 " is for a 1D or a 2D atmosphere. \n")
80 out3 <<
"Particle number density data is o.k. \n";
94 const String& pnd_field_file,
95 const Index& atmosphere_dim,
99 for (Index i = 0; i < pnd_field_raw.
nelem(); i++) {
100 out3 <<
"Element in pnd_field_raw_file:" << i <<
"\n";
101 chk_pnd_data(pnd_field_raw[i], pnd_field_file, atmosphere_dim, verbosity);
126 ConstVectorView p_grid,
127 ConstVectorView lat_grid,
128 ConstVectorView lon_grid,
130 Numeric p, lat, lon,
v;
131 Index n, p_i, lat_i, lon_i;
133 for (n = 0; n < pnd_field_raw.
nelem(); n++) {
134 for (p_i = 0; p_i < pnd_field_raw[n].data.npages(); p_i++) {
135 for (lat_i = 0; lat_i < pnd_field_raw[n].data.nrows(); lat_i++) {
136 for (lon_i = 0; lon_i < pnd_field_raw[n].data.ncols(); lon_i++) {
137 v = pnd_field_raw[n].data(p_i, lat_i, lon_i);
140 p = pnd_field_raw[n].get_numeric_grid(GFIELD3_P_GRID)[p_i];
144 ((p >= p_grid[cloudbox_limits[0]]) &&
145 (cloudbox_limits[0] != 0)),
146 "Found non-zero pnd outside cloudbox. "
147 "Cloudbox extends from p=", p_grid[cloudbox_limits[0]],
148 " Pa to p=", p_grid[cloudbox_limits[1]],
149 " Pa, but found pnd=",
v,
"/m³ at p=", p,
150 " Pa for scattering "
154 lat = pnd_field_raw[n].get_numeric_grid(GFIELD3_LAT_GRID)[lat_i];
156 (lat < lat_grid[cloudbox_limits[3]])),
157 "Found non-zero pnd outside cloudbox. "
158 "Cloudbox extends from lat=",
159 lat_grid[cloudbox_limits[2]],
160 "° to lat=", lat_grid[cloudbox_limits[3]],
161 "°, but found pnd=",
v,
"/m³ at lat=", lat,
167 lon = pnd_field_raw[n].get_numeric_grid(GFIELD3_LON_GRID)[lon_i];
169 (lon < lon_grid[cloudbox_limits[5]])),
170 "Found non-zero pnd outside cloudbox. "
171 "Cloudbox extends from lon=",
172 lon_grid[cloudbox_limits[4]],
173 "° to lat=", lon_grid[cloudbox_limits[5]],
174 "°, but found pnd=",
v,
"/m³ at lon=", lon,
202 for (Index k = 0; k < scat_species.
nelem(); k++) {
203 scat_species[k].split(strarr, delim);
205 "Individual strings in scat_species must contain at least ", nelem,
207 "but entry #", k,
" contains only the following ",
208 strarr.
nelem(),
":\n",
228 "The number of elements in in current scat_species' *scat_data* and "
229 "*scat_meta* do not match.\n"
230 "Each *scat_data* entry must correspond to one entry in *scat_meta*.")
244 const String& scat_meta_file,
247 out3 <<
" Check scattering meta data file " << scat_meta_file <<
"\n";
284 "The first value of the zenith angle grid in the single"
285 " scattering properties data must be 0.")
288 "The last value of the zenith angle grid in the single"
289 " scattering properties data must be 180.")
292 scat_data_single.
aa_grid[0] != -180.,
293 "For ptype = \"general\" the first value"
294 " of the azimuth angle grid in the single scattering"
295 " properties data must be -180.")
298 scat_data_single.
aa_grid[0] != 0.,
299 "For ptype = \"azimuthally_random\""
301 " of the azimuth angle grid in the single scattering"
302 " properties data must be 0.")
306 "For ptypes = \"azimuthally_random\" and \"general\""
307 " the last value of the azimuth angle grid in the single"
308 " scattering properties data must be 180.")
310 ostringstream os_pha_mat;
311 os_pha_mat <<
"pha_mat ";
312 ostringstream os_ext_mat;
313 os_ext_mat <<
"ext_mat ";
314 ostringstream os_abs_vec;
315 os_abs_vec <<
"abs_vec ";
317 switch (scat_data_single.
ptype) {
320 out3 <<
" Data is for arbitrarily orientated particles. \n";
324 scat_data_single.
f_grid.nelem(),
325 scat_data_single.
T_grid.nelem(),
326 scat_data_single.
za_grid.nelem(),
327 scat_data_single.
aa_grid.nelem(),
328 scat_data_single.
za_grid.nelem(),
329 scat_data_single.
aa_grid.nelem(),
334 scat_data_single.
f_grid.nelem(),
335 scat_data_single.
T_grid.nelem(),
336 scat_data_single.
za_grid.nelem(),
337 scat_data_single.
aa_grid.nelem(),
342 scat_data_single.
f_grid.nelem(),
343 scat_data_single.
T_grid.nelem(),
344 scat_data_single.
za_grid.nelem(),
345 scat_data_single.
aa_grid.nelem(),
351 out3 <<
" Data is for macroscopically isotropic and mirror-symmetric "
352 <<
"scattering media, i.e. for totally randomly oriented particles "
353 <<
"with at least one plane of symmetry. \n";
357 scat_data_single.
f_grid.nelem(),
358 scat_data_single.
T_grid.nelem(),
359 scat_data_single.
za_grid.nelem(),
367 scat_data_single.
f_grid.nelem(),
368 scat_data_single.
T_grid.nelem(),
375 scat_data_single.
f_grid.nelem(),
376 scat_data_single.
T_grid.nelem(),
384 out3 <<
" Data is for azimuthally randomly oriented particles. \n";
388 scat_data_single.
f_grid.nelem(),
389 scat_data_single.
T_grid.nelem(),
390 scat_data_single.
za_grid.nelem(),
391 scat_data_single.
aa_grid.nelem(),
392 scat_data_single.
za_grid.nelem(),
398 scat_data_single.
f_grid.nelem(),
399 scat_data_single.
T_grid.nelem(),
400 scat_data_single.
za_grid.nelem(),
406 scat_data_single.
f_grid.nelem(),
407 scat_data_single.
T_grid.nelem(),
408 scat_data_single.
za_grid.nelem(),
422 "The temperature values in the single scattering data"
423 " are negative or very large. Check whether you use the "
424 "right unit [Kelvin].")
447 const bool& include_boundaries,
448 const Index& atmosphere_dim)
451 if (include_boundaries) {
454 if (ipos <
double(cloudbox_limits[0]) ||
455 ipos >
double(cloudbox_limits[1])) {
459 else if (atmosphere_dim >= 2) {
462 if (ipos <
double(cloudbox_limits[2]) ||
463 ipos >
double(cloudbox_limits[3])) {
467 else if (atmosphere_dim == 3) {
470 if (ipos <
double(cloudbox_limits[4]) ||
471 ipos >
double(cloudbox_limits[5])) {
480 if (ipos <=
double(cloudbox_limits[0]) ||
481 ipos >=
double(cloudbox_limits[1])) {
485 else if (atmosphere_dim >= 2) {
488 if (ipos <=
double(cloudbox_limits[2]) ||
489 ipos >=
double(cloudbox_limits[3])) {
493 else if (atmosphere_dim == 3) {
496 if (ipos <=
double(cloudbox_limits[4]) ||
497 ipos >=
double(cloudbox_limits[5])) {
525 const bool include_boundaries)
529 const Index np = ppath_step.
np;
532 ppath_step.
gp_lat[np - 1],
533 ppath_step.
gp_lon[np - 1],
556 Index nx = x.nelem();
562 w[0] =
min(x[1] - x[0],
563 0.5 * (x[1] + x[0]));
566 w[nx - 1] = x[nx - 1] - x[nx - 2];
568 w[0] = 0.5 * (x[1] - x[0]);
569 w[nx - 1] = 0.5 * (x[nx - 1] - x[nx - 2]);
571 for (Index i = 1; i < nx - 1; i++) {
572 w[i] = 0.5 * (x[i + 1] - x[i - 1]);
591 const Tensor3& scat_species_field,
594 const Vector& p_grid,
595 const Vector& lat_grid,
596 const Vector& lon_grid) {
599 "The size of *p_grid* (", p_grid.nelem(),
600 ") is unequal the number of pages of *", fieldname,
"* (",
601 scat_species_field.npages(),
").")
606 "The size of *lat_grid* (", lat_grid.nelem(),
607 ") is unequal the number of rows of *", fieldname,
"* (",
608 scat_species_field.nrows(),
").")
614 "The size of *lon_grid* (", lon_grid.nelem(),
615 ") is unequal the number of columns of *", fieldname,
"* (",
616 scat_species_field.ncols(),
").")
621 for (Index j = 0; j < scat_species_field.npages(); j++) {
622 for (Index k = 0; k < scat_species_field.nrows(); k++) {
623 for (Index l = 0; l < scat_species_field.ncols(); l++) {
624 if (scat_species_field(j, k, l) != 0.0 &&
625 !std::isnan(scat_species_field(j, k, l)))
651 const Tensor3& scat_species_field,
652 const Index& atmosphere_dim,
653 const Numeric& cloudbox_margin) {
654 if (atmosphere_dim == 1) {
656 ConstVectorView ss_prof = scat_species_field(joker, 0, 0);
662 if (cloudbox_margin != -1) {
665 for (i = 0; i < lower; i++) {
670 if (ss_prof[i] != 0.0 && !std::isnan(ss_prof[i])) {
686 for (Index j = scat_species_field.npages() - 1; j >=
max(i, upper); j--) {
691 if (ss_prof[j] != 0.0 && !std::isnan(ss_prof[j])) {
789 field_name.
split(strarr, delim);
793 if (strarr.size() > 0 && field_name[0] !=
'-') {
794 species_type = strarr[0];
797 "No information on field species type found in '",
820 field_name.
split(strarr, delim);
824 if (strarr.size() > 1) {
825 species_name = strarr[1];
828 "No information on field species name found in '",
851 field_name.
split(strarr, delim);
855 if (strarr.size() > 2) {
856 scat_type = strarr[2];
859 "No information on type of scat_species field found in '",
877 const String& part_string,
882 part_string.
split(strarr, delim);
885 if (strarr.size() > 0 && part_string[0] != delim[0]) {
886 partfield_name = strarr[0];
888 ARTS_USER_ERROR (
"No information on scattering species field name in '",
base max(const Array< base > &x)
Max function.
base min(const Array< base > &x)
Min function.
The global header file for ARTS.
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
void split(Array< my_basic_string< charT > > &aos, const my_basic_string< charT > &delim) const
void parse_atmcompact_speciesname(String &species_name, const String &field_name, const String &delim)
void chk_scat_species(const ArrayOfString &scat_species, const String &delim)
Check validity of scat_species setting.
void chk_scat_species_field(bool &empty_flag, const Tensor3 &scat_species_field, const String &fieldname, const Index &dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
Check whether field of a specific scattering species zero everywhere.
void chk_scattering_meta_data(const ScatteringMetaData &scat_meta_single, const String &scat_meta_file, const Verbosity &verbosity)
Check scattering data meta.
void find_cloudlimits(Index &lower, Index &upper, const Tensor3 &scat_species_field, const Index &atmosphere_dim, const Numeric &cloudbox_margin)
Adjust uppermost and lowermost cloudy level for one scat_species_*_*_field.
void chk_pnd_field_raw_only_in_cloudbox(const Index &dim, const ArrayOfGriddedField3 &pnd_field_raw, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, const ArrayOfIndex &cloudbox_limits)
chk_pnd_field_raw_only_in_cloudbox
void parse_partfield_name(String &partfield_name, const String &part_string, const String &delim)
void chk_pnd_raw_data(const ArrayOfGriddedField3 &pnd_field_raw, const String &pnd_field_file, const Index &atmosphere_dim, const Verbosity &verbosity)
Check particle number density files (pnd_field_raw)
void parse_atmcompact_speciestype(String &species_type, const String &field_name, const String &delim)
bool is_inside_cloudbox(const Ppath &ppath_step, const ArrayOfIndex &cloudbox_limits, const bool include_boundaries)
void parse_atmcompact_scattype(String &scat_type, const String &field_name, const String &delim)
void chk_scat_data(const SingleScatteringData &scat_data_single, const Verbosity &verbosity)
Check single scattering data.
void chk_scattering_data(const ArrayOfSingleScatteringData &scat_data, const ArrayOfScatteringMetaData &scat_meta, const Verbosity &)
Check scattering data general.
void chk_pnd_data(const GriddedField3 &pnd_field_raw, const String &pnd_field_file, const Index &atmosphere_dim, const Verbosity &verbosity)
Check particle number density files.
void bin_quadweights(Vector &w, const Vector &x, const Index &order)
bool is_gp_inside_cloudbox(const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon, const ArrayOfIndex &cloudbox_limits, const bool &include_boundaries, const Index &atmosphere_dim)
Internal cloudbox functions.
#define ARTS_ASSERT(condition,...)
#define ARTS_USER_ERROR(...)
#define ARTS_USER_ERROR_IF(condition,...)
Implementation of gridded fields.
Numeric fractional_gp(const GridPos &gp)
fractional_gp
Numeric last(ConstVectorView x)
last
Workspace functions for the solution of cloud-box radiative transfer by Monte Carlo methods....
Declarations having to do with the four output streams.
constexpr Index GFIELD3_LON_GRID
Global constant, Index of the longitude grid in GriddedField3.
constexpr Index GFIELD3_P_GRID
Global constant, Index of the pressure grid in GriddedField3.
constexpr Index GFIELD3_LAT_GRID
Global constant, Index of the latitude grid in GriddedField3.
This file contains declerations of functions of physical character.
Propagation path structure and functions.
Contains sorting routines.
Structure to store a grid position.
The structure to describe a propagation path and releated quantities.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
Index np
Number of points describing the ppath.
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.