69 const String& pnd_field_file,
70 const Index& atmosphere_dim,
74 const Vector& pfr_lat_grid =
76 const Vector& pfr_lon_grid =
83 out3 <<
"Check particle number density file " << pnd_field_file <<
"\n";
86 (pfr_lat_grid.
nelem() != 1 || pfr_lon_grid.
nelem() != 1),
87 "The atmospheric dimension is 1D but the particle "
88 "number density file * ", pnd_field_file,
89 " is for a 3D atmosphere. \n")
91 if (atmosphere_dim == 3) {
93 "The atmospheric dimension is 3D but the particle "
94 "number density file * ", pnd_field_file,
95 " is for a 1D or a 2D atmosphere. \n")
98 out3 <<
"Particle number density data is o.k. \n";
112 const String& pnd_field_file,
113 const Index& atmosphere_dim,
117 for (
Index i = 0; i < pnd_field_raw.
nelem(); i++) {
118 out3 <<
"Element in pnd_field_raw_file:" << i <<
"\n";
119 chk_pnd_data(pnd_field_raw[i], pnd_field_file, atmosphere_dim, verbosity);
149 Index n, p_i, lat_i, lon_i;
151 for (n = 0; n < pnd_field_raw.
nelem(); n++) {
152 for (p_i = 0; p_i < pnd_field_raw[n].data.npages(); p_i++) {
153 for (lat_i = 0; lat_i < pnd_field_raw[n].data.nrows(); lat_i++) {
154 for (lon_i = 0; lon_i < pnd_field_raw[n].data.ncols(); lon_i++) {
155 v = pnd_field_raw[n].data(p_i, lat_i, lon_i);
158 p = pnd_field_raw[n].get_numeric_grid(GFIELD3_P_GRID)[p_i];
162 ((p >= p_grid[cloudbox_limits[0]]) &&
163 (cloudbox_limits[0] != 0)),
164 "Found non-zero pnd outside cloudbox. "
165 "Cloudbox extends from p=", p_grid[cloudbox_limits[0]],
166 " Pa to p=", p_grid[cloudbox_limits[1]],
167 " Pa, but found pnd=",
v,
"/m³ at p=", p,
168 " Pa for scattering "
172 lat = pnd_field_raw[n].get_numeric_grid(GFIELD3_LAT_GRID)[lat_i];
174 (lat < lat_grid[cloudbox_limits[3]])),
175 "Found non-zero pnd outside cloudbox. "
176 "Cloudbox extends from lat=",
177 lat_grid[cloudbox_limits[2]],
178 "° to lat=", lat_grid[cloudbox_limits[3]],
179 "°, but found pnd=",
v,
"/m³ at lat=", lat,
185 lon = pnd_field_raw[n].get_numeric_grid(GFIELD3_LON_GRID)[lon_i];
187 (lon < lon_grid[cloudbox_limits[5]])),
188 "Found non-zero pnd outside cloudbox. "
189 "Cloudbox extends from lon=",
190 lon_grid[cloudbox_limits[4]],
191 "° to lat=", lon_grid[cloudbox_limits[5]],
192 "°, but found pnd=",
v,
"/m³ at lon=", lon,
220 for (
Index k = 0; k < scat_species.
nelem(); k++) {
221 scat_species[k].split(strarr, delim);
223 "Individual strings in scat_species must contain at least ", nelem,
225 "but entry #", k,
" contains only the following ",
226 strarr.
nelem(),
":\n",
246 "The number of elements in in current scat_species' *scat_data* and "
247 "*scat_meta* do not match.\n"
248 "Each *scat_data* entry must correspond to one entry in *scat_meta*.")
262 const String& scat_meta_file,
265 out3 <<
" Check scattering meta data file " << scat_meta_file <<
"\n";
302 "The first value of the zenith angle grid in the single"
303 " scattering properties data must be 0.")
306 "The last value of the zenith angle grid in the single"
307 " scattering properties data must be 180.")
310 scat_data_single.
aa_grid[0] != -180.,
311 "For ptype = \"general\" the first value"
312 " of the azimuth angle grid in the single scattering"
313 " properties data must be -180.")
316 scat_data_single.
aa_grid[0] != 0.,
317 "For ptype = \"azimuthally_random\""
319 " of the azimuth angle grid in the single scattering"
320 " properties data must be 0.")
324 "For ptypes = \"azimuthally_random\" and \"general\""
325 " the last value of the azimuth angle grid in the single"
326 " scattering properties data must be 180.")
328 ostringstream os_pha_mat;
329 os_pha_mat <<
"pha_mat ";
330 ostringstream os_ext_mat;
331 os_ext_mat <<
"ext_mat ";
332 ostringstream os_abs_vec;
333 os_abs_vec <<
"abs_vec ";
335 switch (scat_data_single.
ptype) {
338 out3 <<
" Data is for arbitrarily orientated particles. \n";
369 out3 <<
" Data is for macroscopically isotropic and mirror-symmetric "
370 <<
"scattering media, i.e. for totally randomly oriented particles "
371 <<
"with at least one plane of symmetry. \n";
402 out3 <<
" Data is for azimuthally randomly oriented particles. \n";
440 "The temperature values in the single scattering data"
441 " are negative or very large. Check whether you use the "
442 "right unit [Kelvin].")
465 const bool& include_boundaries,
466 const Index& atmosphere_dim)
469 if (include_boundaries) {
472 if (ipos <
double(cloudbox_limits[0]) ||
473 ipos >
double(cloudbox_limits[1])) {
477 else if (atmosphere_dim >= 2) {
480 if (ipos <
double(cloudbox_limits[2]) ||
481 ipos >
double(cloudbox_limits[3])) {
485 else if (atmosphere_dim == 3) {
488 if (ipos <
double(cloudbox_limits[4]) ||
489 ipos >
double(cloudbox_limits[5])) {
498 if (ipos <=
double(cloudbox_limits[0]) ||
499 ipos >=
double(cloudbox_limits[1])) {
503 else if (atmosphere_dim >= 2) {
506 if (ipos <=
double(cloudbox_limits[2]) ||
507 ipos >=
double(cloudbox_limits[3])) {
511 else if (atmosphere_dim == 3) {
514 if (ipos <=
double(cloudbox_limits[4]) ||
515 ipos >=
double(cloudbox_limits[5])) {
543 const bool include_boundaries)
547 const Index np = ppath_step.
np;
550 ppath_step.
gp_lat[np - 1],
551 ppath_step.
gp_lon[np - 1],
580 w[0] =
min(x[1] - x[0],
581 0.5 * (x[1] + x[0]));
584 w[nx - 1] = x[nx - 1] - x[nx - 2];
586 w[0] = 0.5 * (x[1] - x[0]);
587 w[nx - 1] = 0.5 * (x[nx - 1] - x[nx - 2]);
589 for (
Index i = 1; i < nx - 1; i++) {
590 w[i] = 0.5 * (x[i + 1] - x[i - 1]);
609 const Tensor3& scat_species_field,
617 "The size of *p_grid* (", p_grid.
nelem(),
618 ") is unequal the number of pages of *", fieldname,
"* (",
619 scat_species_field.
npages(),
").")
624 "The size of *lat_grid* (", lat_grid.
nelem(),
625 ") is unequal the number of rows of *", fieldname,
"* (",
626 scat_species_field.
nrows(),
").")
632 "The size of *lon_grid* (", lon_grid.
nelem(),
633 ") is unequal the number of columns of *", fieldname,
"* (",
634 scat_species_field.
ncols(),
").")
639 for (
Index j = 0; j < scat_species_field.
npages(); j++) {
640 for (
Index k = 0; k < scat_species_field.
nrows(); k++) {
641 for (
Index l = 0; l < scat_species_field.
ncols(); l++) {
642 if (scat_species_field(j, k, l) != 0.0 &&
643 !std::isnan(scat_species_field(j, k, l)))
669 const Tensor3& scat_species_field,
670 const Index& atmosphere_dim,
671 const Numeric& cloudbox_margin) {
672 if (atmosphere_dim == 1) {
680 if (cloudbox_margin != -1) {
683 for (i = 0; i < lower; i++) {
688 if (ss_prof[i] != 0.0 && !std::isnan(ss_prof[i])) {
704 for (
Index j = scat_species_field.
npages() - 1; j >=
max(i, upper); j--) {
709 if (ss_prof[j] != 0.0 && !std::isnan(ss_prof[j])) {
807 field_name.
split(strarr, delim);
811 if (strarr.size() > 0 && field_name[0] !=
'-') {
812 species_type = strarr[0];
815 "No information on field species type found in '",
838 field_name.
split(strarr, delim);
842 if (strarr.size() > 1) {
843 species_name = strarr[1];
846 "No information on field species name found in '",
869 field_name.
split(strarr, delim);
873 if (strarr.size() > 2) {
874 scat_type = strarr[2];
877 "No information on type of scat_species field found in '",
895 const String& part_string,
900 part_string.
split(strarr, delim);
903 if (strarr.size() > 0 && part_string[0] != delim[0]) {
904 partfield_name = strarr[0];
906 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
Index npages() const
Returns the number of pages.
Index nrows() const
Returns the number of rows.
Index ncols() const
Returns the number of columns.
A constant view of a Vector.
Index nelem() const noexcept
Returns the number of elements.
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
Linear algebra functions.
bool is_increasing(ConstVectorView x)
Checks if a vector is sorted and strictly increasing.
Header file for logic.cc.
Numeric last(ConstVectorView x)
last
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
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.
member functions of the Rng class and gsl_rng code
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.