ARTS
2.3.1285(git:92a29ea9-dirty)
|
Internal functions for scattering calculations. More...
#include "cloudbox.h"
#include <algorithm>
#include <cmath>
#include <ctime>
#include <limits>
#include <stdexcept>
#include "arts.h"
#include "check_input.h"
#include "lin_alg.h"
#include "logic.h"
#include "math_funcs.h"
#include "mc_antenna.h"
#include "messages.h"
#include "physics_funcs.h"
#include "ppath.h"
#include "rng.h"
#include "sorting.h"
Go to the source code of this file.
Functions | |
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. More... | |
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) More... | |
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 More... | |
void | chk_scat_species (const ArrayOfString &scat_species, const String &delim) |
Check validity of scat_species setting. More... | |
void | chk_scattering_data (const ArrayOfSingleScatteringData &scat_data, const ArrayOfScatteringMetaData &scat_meta, const Verbosity &) |
Check scattering data general. More... | |
void | chk_scattering_meta_data (const ScatteringMetaData &scat_meta_single, const String &scat_meta_file, const Verbosity &verbosity) |
Check scattering data meta. More... | |
void | chk_scat_data (const SingleScatteringData &scat_data_single, const Verbosity &verbosity) |
Check single scattering data. More... | |
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) |
bool | is_inside_cloudbox (const Ppath &ppath_step, const ArrayOfIndex &cloudbox_limits, const bool include_boundaries) |
void | bin_quadweights (Vector &w, const Vector &x, const Index &order) |
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. More... | |
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. More... | |
void | parse_atmcompact_speciestype (String &species_type, const String &field_name, const String &delim) |
void | parse_atmcompact_speciesname (String &species_name, const String &field_name, const String &delim) |
void | parse_atmcompact_scattype (String &scat_type, const String &field_name, const String &delim) |
void | parse_partfield_name (String &partfield_name, const String &part_string, const String &delim) |
Variables | |
const Index | GFIELD3_P_GRID |
const Index | GFIELD3_LAT_GRID |
const Index | GFIELD3_LON_GRID |
Internal functions for scattering calculations.
Definition in file cloudbox.cc.
Derives weights of a bin-type quadrature for arbitrary wide bins.
Note: Rectangular and trapezoidal rule essentially give the same weights when considering the same nodes x (not the mid-points between the nodes as rectangular is sometimes using) and limiting the quadrature range by the first and last node). Keyword order=0 calculates rectangular bins (ie bins extend beyond the first and last nodes), order=1 to trapezoidal bins (ie bins end exactly at nodes).
w | resulting weights at ordinates. |
x | ordinates. |
order | order of quadrature (see above for details). |
Definition at line 611 of file cloudbox.cc.
References i, is_increasing(), min, and ConstVectorView::nelem().
Referenced by pndFromPsd(), and pndFromPsdBasic().
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.
This function checks, whether the particle number density file has the right atmospheric dimension (check for no non-zero pnd values outside cloudbox removed. done in pnd_fieldCalcFrompnd_field_raw).
pnd_field_raw | pnd field data |
pnd_field_file | pnd field filename |
atmosphere_dim | Atmospheric dimension |
Definition at line 67 of file cloudbox.cc.
References CREATE_OUT3, GriddedField::get_numeric_grid(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, ConstVectorView::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by chk_pnd_raw_data(), ScatElementsPndAndScatAdd(), and ScatElementsToabs_speciesAdd().
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
Checks whether the pnd_field is zero outside the cloudbox. This is of a higher level than chk_pnd_data because it does not require any filename and because it works on all pnd_field_raw rather than just one element. Otherwise, it is mostly a new implementation of the same functionality.
dim | The atmospheric dimensionality. |
pnd_field_raw | All pnd_field_raw data. |
p_grid | Pressure grid. |
lat_grid | Latitude grid. |
lon_grid | Longitude grid. |
cloudbox_limits | The edges of the cloudbox. |
Definition at line 146 of file cloudbox.cc.
References GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, n, Array< base >::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by pnd_fieldCalcFrompnd_field_raw().
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)
pnd_field_raw | pnd field raw data (array for all scattering elements) |
pnd_field_file | pnd field filename |
atmosphere_dim | Atmospheric dimension |
Definition at line 116 of file cloudbox.cc.
References chk_pnd_data(), CREATE_OUT3, i, and Array< base >::nelem().
Referenced by ScatSpeciesPndAndScatAdd().
void chk_scat_data | ( | const SingleScatteringData & | scat_data_single, |
const Verbosity & | verbosity | ||
) |
Check single scattering data.
This function checks the self consistency of the data by checking the dimensions of pha_mat, ext_mat and abs_vec depending on the ptype case. It furthermore checks whether the angular grids are defined correctly depending on ptype and the sanity of the temperature grid.
scat_data_single[in] | Single scattering data of a single scattering element |
Definition at line 313 of file cloudbox.cc.
References SingleScatteringData::aa_grid, SingleScatteringData::abs_vec_data, chk_size(), CREATE_OUT3, SingleScatteringData::ext_mat_data, SingleScatteringData::f_grid, last(), ConstVectorView::nelem(), SingleScatteringData::pha_mat_data, SingleScatteringData::ptype, PTYPE_AZIMUTH_RND, PTYPE_GENERAL, PTYPE_TOTAL_RND, _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), SingleScatteringData::T_grid, and SingleScatteringData::za_grid.
Referenced by xml_read_from_stream().
void chk_scat_species | ( | const ArrayOfString & | scat_species, |
const String & | delim | ||
) |
Check validity of scat_species setting.
This function checks, whether number of elements in each scattering species string is ok, and whether the entries for size limits are indeed numbers (or '*').
\param scat_species Array of scattering species tags.
delim | delimiter string of scat_species elements. |
Definition at line 230 of file cloudbox.cc.
References Absorption::nelem().
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.
scat_species_field | scattering species field (e.g. mass density, mass flux, total number density) |
fieldname | name of scattering species field (just for info) |
dim | the atmosphere dimension |
p_grid | pressure grid of current atmosphere |
lat_grid | latitude grid of current atmosphere |
lon_grid | longitude grid of current atmosphere |
Definition at line 646 of file cloudbox.cc.
References ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), ConstTensor3View::nrows(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by cloudboxSetAutomatically().
void chk_scattering_data | ( | const ArrayOfSingleScatteringData & | scat_data, |
const ArrayOfScatteringMetaData & | scat_meta, | ||
const Verbosity & | |||
) |
Check scattering data general.
FIXME
Definition at line 259 of file cloudbox.cc.
References Array< base >::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
void chk_scattering_meta_data | ( | const ScatteringMetaData & | scat_meta_single, |
const String & | scat_meta_file, | ||
const Verbosity & | verbosity | ||
) |
Check scattering data meta.
FIXME
scat_meta_single | scattering meta data |
scat_meta_file | filename of the data to be checked |
Definition at line 281 of file cloudbox.cc.
References CREATE_OUT3.
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.
lower and upper levels have to be preinitialized before calling this function.
[in,out] | lower | lowermost level containing scattering particles |
[in,out] | upper | uppermost level containing scattering particles |
[in] | scat_species_field | scattering species field (e.g. mass density, mass flux, total number density) |
[in] | atmosphere_dim | the atmosphere dimension |
[in] | cloudbox_margin | flag whether to determine lowermost level or set to surface |
Definition at line 714 of file cloudbox.cc.
References i, joker, max, ConstTensor3View::npages(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by cloudboxSetAutomatically().
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 | ||
) |
Checks, whether a gridpoint is inside the cloudbox.
gp_p | pressure GridPos |
gp_lat | latitude GridPos |
gp_lon | longitude GridPos |
cloudbox_limits | The limits of the cloudbox. |
include_boundaries | boolean: determines whther or not points on the boundary are considered to be inside the cloudbox. |
Definition at line 499 of file cloudbox.cc.
References fractional_gp().
Referenced by get_ppath_cloudvars(), get_ppath_transmat(), is_inside_cloudbox(), iyIndependentBeamApproximation(), and mcPathTraceRadar().
bool is_inside_cloudbox | ( | const Ppath & | ppath_step, |
const ArrayOfIndex & | cloudbox_limits, | ||
const bool | include_boundaries | ||
) |
Checks, whether the last point of a propagation path is inside the cloudbox.
Works only for 3D !!!
ppath_step | Propagation path step. |
cloudbox_limits | The limits of the cloudbox. |
include_boundaries | boolean: determines whther or not points on the boundary are considered to be inside the cloudbox. |
Definition at line 579 of file cloudbox.cc.
References Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, is_gp_inside_cloudbox(), Array< base >::nelem(), and Ppath::np.
Referenced by cloud_ppath_update3D().
void parse_atmcompact_scattype | ( | String & | scat_type, |
const String & | field_name, | ||
const String & | delim | ||
) |
Parse atm_field_compact fieldname for type of scat_species field
scat_type | species name (second part of field_name) |
field_name | fieldname of atm_field_compact data entry |
delim | delimiter string of field_name |
Definition at line 912 of file cloudbox.cc.
References my_basic_string< charT >::split(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
void parse_atmcompact_speciesname | ( | String & | species_name, |
const String & | field_name, | ||
const String & | delim | ||
) |
Parse atm_field_compact fieldname for species name
species_type | species name (second part of field_name) |
field_name | fieldname of atm_field_compact data entry |
delim | delimiter string of field_name |
Definition at line 880 of file cloudbox.cc.
References my_basic_string< charT >::split(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by abs_lookupSetupBatch().
void parse_atmcompact_speciestype | ( | String & | species_type, |
const String & | field_name, | ||
const String & | delim | ||
) |
Parse atm_field_compact fieldname for species type
species_type | species indentifier (first part of field_name) |
field_name | fieldname of atm_field_compact data entry |
delim | delimiter string of field_name |
Definition at line 848 of file cloudbox.cc.
References my_basic_string< charT >::split(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by abs_lookupSetupBatch().
void parse_partfield_name | ( | String & | partfield_name, |
const String & | part_string, | ||
const String & | delim | ||
) |
Splitting scat_species string and parse type of scattering species field
partfield_name | name of atmospheric scattering species field |
part_string | scattering species tag from scat_species |
delim | delimiter string of scat_species elements |
Definition at line 944 of file cloudbox.cc.
References my_basic_string< charT >::split(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().
Referenced by ScatElementsSelect(), and ScatSpeciesExtendTemperature().
const Index GFIELD3_LAT_GRID |
Referenced by chk_pnd_data(), and chk_pnd_field_raw_only_in_cloudbox().
const Index GFIELD3_LON_GRID |
Referenced by chk_pnd_data(), and chk_pnd_field_raw_only_in_cloudbox().
const Index GFIELD3_P_GRID |
Referenced by chk_pnd_field_raw_only_in_cloudbox().