ARTS  2.3.1285(git:92a29ea9-dirty)
m_cloudbox.cc File Reference

Workspace functions related to the definintion of the cloud box. More...

#include <cmath>
#include <cstdlib>
#include <stdexcept>
#include "array.h"
#include "arts.h"
#include "auto_md.h"
#include "check_input.h"
#include "cloudbox.h"
#include "file.h"
#include "gridded_fields.h"
#include "interpolation.h"
#include "lin_alg.h"
#include "logic.h"
#include "math_funcs.h"
#include "messages.h"
#include "microphysics.h"
#include "optproperties.h"
#include "parameters.h"
#include "physics_funcs.h"
#include "rte.h"
#include "sorting.h"
#include "special_interp.h"
#include "xml_io.h"

Go to the source code of this file.

Functions

void cloudboxOff (Index &cloudbox_on, Index &ppath_inside_cloudbox_do, ArrayOfIndex &cloudbox_limits, Agenda &iy_cloudbox_agenda, Tensor4 &pnd_field, ArrayOfTensor4 &dpnd_field_dx, ArrayOfString &scat_species, ArrayOfArrayOfSingleScatteringData &scat_data, ArrayOfArrayOfSingleScatteringData &scat_data_raw, Index &scat_data_checked, Matrix &particle_masses, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &)
 WORKSPACE METHOD: cloudboxOff. More...
 
void cloudboxSetAutomatically (Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor4 &particle_field, const ArrayOfIndex &cloudbox_limits_old, const Numeric &cloudbox_margin, const Verbosity &verbosity)
 WORKSPACE METHOD: cloudboxSetAutomatically. More...
 
void cloudboxSetFullAtm (Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Verbosity &)
 WORKSPACE METHOD: cloudboxSetFullAtm. More...
 
void cloudboxSetManually (Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Numeric &p1, const Numeric &p2, const Numeric &lat1, const Numeric &lat2, const Numeric &lon1, const Numeric &lon2, const Verbosity &)
 WORKSPACE METHOD: cloudboxSetManually. More...
 
void cloudboxSetManuallyAltitude (Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Tensor3 &z_field, const Vector &lat_grid, const Vector &lon_grid, const Numeric &z1, const Numeric &z2, const Numeric &lat1, const Numeric &lat2, const Numeric &lon1, const Numeric &lon2, const Verbosity &)
 WORKSPACE METHOD: cloudboxSetManuallyAltitude. More...
 
void iyInterpCloudboxField (Matrix &iy, const Tensor7 &cloudbox_field, const Vector &rte_pos, const Vector &rte_los, const Index &jacobian_do, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &z_surface, const Index &stokes_dim, const Vector &za_grid, const Vector &aa_grid, const Vector &f_grid, const Index &za_interp_order, const Index &za_restrict, const Index &cos_za_interp, const Numeric &za_extpolfac, const Index &aa_interp_order, const Verbosity &)
 WORKSPACE METHOD: iyInterpCloudboxField. More...
 
void cloudbox_fieldCrop (Tensor7 &cloudbox_field, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Index &cloudbox_on, const Index &new_limit0, const Index &new_limit1, const Index &new_limit2, const Index &new_limit3, const Index &new_limit4, const Index &new_limit5, const Verbosity &)
 WORKSPACE METHOD: cloudbox_fieldCrop. More...
 
void particle_fieldCleanup (Tensor4 &particle_field_out, const Tensor4 &particle_field_in, const Numeric &threshold, const Verbosity &)
 WORKSPACE METHOD: particle_fieldCleanup. More...
 
void ScatSpeciesInit (ArrayOfString &scat_species, ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfArrayOfScatteringMetaData &scat_meta, Index &scat_data_checked, ArrayOfGriddedField3 &pnd_field_raw, const Verbosity &)
 WORKSPACE METHOD: ScatSpeciesInit. More...
 
void ScatElementsPndAndScatAdd (ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfGriddedField3 &pnd_field_raw, const Index &atmosphere_dim, const ArrayOfString &scat_data_files, const ArrayOfString &pnd_field_files, const Verbosity &verbosity)
 WORKSPACE METHOD: ScatElementsPndAndScatAdd. More...
 
void ScatSpeciesPndAndScatAdd (ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfGriddedField3 &pnd_field_raw, const Index &atmosphere_dim, const ArrayOfString &scat_data_files, const String &pnd_fieldarray_file, const Verbosity &verbosity)
 WORKSPACE METHOD: ScatSpeciesPndAndScatAdd. More...
 
void ScatElementsToabs_speciesAdd (ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfGriddedField3 &vmr_field_raw, ArrayOfArrayOfSpeciesTag &abs_species, Index &propmat_clearsky_agenda_checked, Index &abs_xsec_agenda_checked, const Index &atmosphere_dim, const Vector &f_grid, const ArrayOfString &scat_data_files, const ArrayOfString &pnd_field_files, const Verbosity &verbosity)
 WORKSPACE METHOD: ScatElementsToabs_speciesAdd. More...
 
void ScatSpeciesScatAndMetaRead (ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfArrayOfScatteringMetaData &scat_meta, const ArrayOfString &scat_data_files, const Verbosity &verbosity)
 WORKSPACE METHOD: ScatSpeciesScatAndMetaRead. More...
 
void ScatElementsSelect (ArrayOfArrayOfSingleScatteringData &scat_data_raw, ArrayOfArrayOfScatteringMetaData &scat_meta, const ArrayOfString &scat_species, const String &species, const String &sizeparam, const Numeric &sizemin, const Numeric &sizemax, const Numeric &tolerance, const String &delim, const Verbosity &)
 WORKSPACE METHOD: ScatElementsSelect. More...
 
void ScatSpeciesExtendTemperature (ArrayOfArrayOfSingleScatteringData &scat_data_raw, const ArrayOfString &scat_species, const String &species, const String &scat_species_delim, const Numeric &T_low, const Numeric &T_high, const Verbosity &)
 WORKSPACE METHOD: ScatSpeciesExtendTemperature. More...
 
void pnd_fieldCalcFrompnd_field_raw (Tensor4 &pnd_field, ArrayOfTensor4 &dpnd_field_dx, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const ArrayOfGriddedField3 &pnd_field_raw, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits, const ArrayOfRetrievalQuantity &jacobian_quantities, const Index &zeropadding, const Verbosity &verbosity)
 WORKSPACE METHOD: pnd_fieldCalcFrompnd_field_raw. More...
 
void pnd_fieldExpand1D (Tensor4 &pnd_field, const Index &atmosphere_dim, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &nzero, const Verbosity &)
 WORKSPACE METHOD: pnd_fieldExpand1D. More...
 
void pnd_fieldZero (Tensor4 &pnd_field, ArrayOfTensor4 &dpnd_field_dx, ArrayOfArrayOfSingleScatteringData &scat_data, const Index &atmosphere_dim, const Vector &f_grid, const ArrayOfIndex &cloudbox_limits, const ArrayOfRetrievalQuantity &jacobian_quantities, const Verbosity &)
 WORKSPACE METHOD: pnd_fieldZero. More...
 

Variables

const Index GFIELD3_P_GRID
 
const Index GFIELD3_LAT_GRID
 
const Index GFIELD3_LON_GRID
 
const Numeric PI
 
const Numeric DEG2RAD
 
const Numeric RAD2DEG
 
const Numeric LAT_LON_MIN
 
const Numeric DENSITY_OF_ICE
 

Detailed Description

Workspace functions related to the definintion of the cloud box.

Author
Patrick Eriksson, Claudia Emde and Sreerekha T. R.
Date
2002-05-08

These functions are listed in the doxygen documentation as entries of the file auto_md.h.

Definition in file m_cloudbox.cc.

Function Documentation

◆ cloudbox_fieldCrop()

void cloudbox_fieldCrop ( Tensor7 cloudbox_field,
ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Index cloudbox_on,
const Index new_limit0,
const Index new_limit1,
const Index new_limit2,
const Index new_limit3,
const Index new_limit4,
const Index new_limit5,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudbox_fieldCrop.

Extracts a part of an existing cloudbox_field.

The cropping is defined by defining new cloudbox limits. Note that new_limit0* is an index with respect to p_grid, etc.

The following must be valid: <br> new_limit0 >= cloudbox_limits[0] <br> new_limit1 <= cloudbox_limits[1] <br> new_limit2 >= cloudbox_limits[2] <br> new_limit3 <= cloudbox_limits[3] <br> new_limit4 >= cloudbox_limits[4] <br> new_limit5 <= cloudbox_limits[5]

Indexes for dimensions not used are ignored.

Author
Patrick Eriksson
Parameters
[in,out]cloudbox_fieldWS Input/Output
[in,out]cloudbox_limitsWS Input/Output
[in]atmosphere_dimWS Input
[in]cloudbox_onWS Input
[in]new_limit0Generic Input (Default: "0")
[in]new_limit1Generic Input (Default: "0")
[in]new_limit2Generic Input (Default: "0")
[in]new_limit3Generic Input (Default: "0")
[in]new_limit4Generic Input (Default: "0")
[in]new_limit5Generic Input (Default: "0")

Definition at line 1030 of file m_cloudbox.cc.

References joker.

Referenced by cloudbox_fieldCrop_g().

◆ cloudboxOff()

void cloudboxOff ( Index cloudbox_on,
Index ppath_inside_cloudbox_do,
ArrayOfIndex cloudbox_limits,
Agenda iy_cloudbox_agenda,
Tensor4 pnd_field,
ArrayOfTensor4 dpnd_field_dx,
ArrayOfString scat_species,
ArrayOfArrayOfSingleScatteringData scat_data,
ArrayOfArrayOfSingleScatteringData scat_data_raw,
Index scat_data_checked,
Matrix particle_masses,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudboxOff.

Deactivates the cloud box.

Use this method if no scattering calculations shall be performed.

The function sets cloudbox_on to 0, cloudbox_limits, pnd_field*, scat_data, scat_data_raw, iy_cloudbox_agenda and particle_masses to be empty and sizes dpnd_field_dx to be consitent with jacobian_quantities.

Author
Patrick Eriksson
Parameters
[out]cloudbox_onWS Output
[out]ppath_inside_cloudbox_doWS Output
[out]cloudbox_limitsWS Output
[out]iy_cloudbox_agendaWS Output
[out]pnd_fieldWS Output
[out]dpnd_field_dxWS Output
[out]scat_speciesWS Output
[out]scat_dataWS Output
[out]scat_data_rawWS Output
[out]scat_data_checkedWS Output
[out]particle_massesWS Output
[in]jacobian_quantitiesWS Input

Definition at line 81 of file m_cloudbox.cc.

References Array< base >::nelem(), Tensor4::resize(), Matrix::resize(), and Agenda::set_name().

Referenced by cloudboxOff_g().

◆ cloudboxSetAutomatically()

void cloudboxSetAutomatically ( Index cloudbox_on,
ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor4 particle_field,
const ArrayOfIndex cloudbox_limits_old,
const Numeric cloudbox_margin,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudboxSetAutomatically.

Sets the cloud box to encompass the cloud given by the entries in particle_field.

This WSM handles one Tensor4 type particle_field at a time. It can be used to determine the cloudbox from particle_bulkprop_field, but also from the various scat_species_XXX_field (or even from a read-in pnd_field). For the latter, the WSM needs to be called once per each scat_species_XXX_field, with previously determined cloudbox_limits* provided through cloudbox_limits_old.

The function must be called before executing any WSM that applies cloudbox_limits*.

The function iterates over all 3D fields in particle_field (which might correspond to the different scattering species as in scat_species_XXX_field or to different particle bulk properties as in particle_bulkprop_field). Each field is searched for the first and last pressure index, where the value is unequal to zero. This index is then copied to cloudbox_limits. If particle_field is empty, the cloudbox is switched off (cloudbox_on=0).

Additionaly the lower cloudbox_limit is altered by cloudbox_margin. The margin is given as a height difference in meters and transformed into a pressure (via isothermal barometric height formula). This alteration is to ensure covering photons that leave the cloud, but reenter through a limb path. If cloudbox_margin is set to -1 (default), the cloudbox will extend to the surface. Hence, the lower cloudbox_limit is set to 0 (index of first pressure level). cloudbox_margin* will be applied on each call of the WSM. Hence, if called successively, e.g. for several scat_species_XXX_field, and cloudbox_margin is not -1, it is suggested to apply the desired cloudbox_margin only for the last WSM call, while for the others set cloudbox_margin to 0.

Works only for atmosphere_dim==1.

Author
Jana Mendrok, Daniel Kreyling
Parameters
[out]cloudbox_onWS Output
[out]cloudbox_limitsWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]particle_fieldGeneric Input
[in]cloudbox_limits_oldGeneric Input (Default: "[-1]")
[in]cloudbox_marginGeneric Input (Default: "-1")

Definition at line 112 of file m_cloudbox.cc.

References barometric_heightformula(), chk_atm_grids(), chk_if_in_range(), chk_scat_species_field(), CREATE_OUT0, CREATE_OUT2, ConstTensor4View::empty(), find_cloudlimits(), joker, max, min, ConstTensor4View::nbooks(), Array< base >::nelem(), ConstVectorView::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().

Referenced by cloudboxSetAutomatically_g().

◆ cloudboxSetFullAtm()

void cloudboxSetFullAtm ( Index cloudbox_on,
ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudboxSetFullAtm.

Sets the cloudbox to cover the full atmosphere.

Author
Claudia Emde, Jana Mendrok
Parameters
[out]cloudbox_onWS Output
[out]cloudbox_limitsWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input

Definition at line 283 of file m_cloudbox.cc.

References abs, DEG2RAD, i, LAT_LON_MIN, max, ConstVectorView::nelem(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().

Referenced by cloudboxSetFullAtm_g(), and DisortCalcClearsky().

◆ cloudboxSetManually()

void cloudboxSetManually ( Index cloudbox_on,
ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Numeric p1,
const Numeric p2,
const Numeric lat1,
const Numeric lat2,
const Numeric lon1,
const Numeric lon2,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudboxSetManually.

Sets the cloud box to encompass the given positions.

The function sets cloudbox_on to 1 and sets cloudbox_limits following the given pressure, latitude and longitude positions. The index limits in cloudbox_limits are selected to give the smallest possible cloud box that encompass the given points.

The points must be given in the same order as used in cloudbox_limits*. That means that the first keyword argument shall be a higher pressure than argument two, while the latitude and longitude points are given in increasing order. Positions given for dimensions not used by the selected atmospheric dimensionality are ignored.

The given pressure points can be outside the range of p_grid. The pressure limit is then set to the end point of p_grid. The given latitude and longitude points must be inside the range of the corresponding grid. In addition, the latitude and longitude points cannot be inside the outermost grid ranges as the latitude and longitude limits in cloudbox_limits are not allowed to be grid end points.

Author
Patrick Eriksson
Parameters
[out]cloudbox_onWS Output
[out]cloudbox_limitsWS Output
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]p1Generic Input
[in]p2Generic Input
[in]lat1Generic Input
[in]lat2Generic Input
[in]lon1Generic Input
[in]lon2Generic Input

Definition at line 368 of file m_cloudbox.cc.

References chk_atm_grids(), chk_if_in_range(), and ConstVectorView::nelem().

Referenced by cloudboxSetManually_g(), and ybatchMetProfiles().

◆ cloudboxSetManuallyAltitude()

void cloudboxSetManuallyAltitude ( Index cloudbox_on,
ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Tensor3 z_field,
const Vector lat_grid,
const Vector lon_grid,
const Numeric z1,
const Numeric z2,
const Numeric lat1,
const Numeric lat2,
const Numeric lon1,
const Numeric lon2,
const Verbosity verbosity 
)

WORKSPACE METHOD: cloudboxSetManuallyAltitude.

Sets the cloud box to encompass the given positions.

As cloudboxSetManually but uses altitudes instead of pressure. The given altitude points can be outside the range of z_field. The altitude limit is then set to the end point of p_grid.

Author
Claudia Emde
Parameters
[out]cloudbox_onWS Output
[out]cloudbox_limitsWS Output
[in]atmosphere_dimWS Input
[in]z_fieldWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]z1Generic Input
[in]z2Generic Input
[in]lat1Generic Input
[in]lat2Generic Input
[in]lon1Generic Input
[in]lon2Generic Input

Definition at line 477 of file m_cloudbox.cc.

References chk_if_in_range(), ConstVectorView::nelem(), and ConstTensor3View::npages().

Referenced by cloudboxSetManuallyAltitude_g().

◆ iyInterpCloudboxField()

void iyInterpCloudboxField ( Matrix iy,
const Tensor7 cloudbox_field,
const Vector rtp_pos,
const Vector rtp_los,
const Index jacobian_do,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor3 z_field,
const Matrix z_surface,
const Index stokes_dim,
const Vector za_grid,
const Vector aa_grid,
const Vector f_grid,
const Index za_interp_order,
const Index za_restrict,
const Index cos_za_interp,
const Numeric za_extpolfac,
const Index aa_interp_order,
const Verbosity verbosity 
)

WORKSPACE METHOD: iyInterpCloudboxField.

Interpolates the intensity field of the cloud box.

Determines the intensity field at the position and direction specified by rte_pos and rte_los. The position can be both inside the cloud box or at its edge.

The interpolation in the spatial dimensions is linear.

For the zenith angle dimensions several options for controlling the interpolation are at hand. Default is linear interpolation. Higher order polynomial interpolation is activated by setting za_interp_order* to a value > 1. Default is to perform the interpolation separately for [0,90[ and ]90,180]. To handle 90 degree or use the full range ([0,180]) as basis for the interpolation, set za_restrict to 0. You can select to use cos(za) as the independent variable (instead of za) by setting cos_za_interp* to 1.

For the azimuth dimension the interpolation order can be selected, in the same manner as for zenith.

Author
Claudia Emde
Patrick Eriksson
Jana Mendrok
Parameters
[out]iyWS Output
[in]cloudbox_fieldWS Input
[in]rtp_posWS Input
[in]rtp_losWS Input
[in]jacobian_doWS Input
[in]cloudbox_onWS Input
[in]cloudbox_limitsWS Input
[in]atmosphere_dimWS Input
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]z_fieldWS Input
[in]z_surfaceWS Input
[in]stokes_dimWS Input
[in]za_gridWS Input
[in]aa_gridWS Input
[in]f_gridWS Input
[in]za_interp_orderGeneric Input (Default: "1")
[in]za_restrictGeneric Input (Default: "1")
[in]cos_za_interpGeneric Input (Default: "0")
[in]za_extpolfacGeneric Input (Default: "0.5")
[in]aa_interp_orderGeneric Input (Default: "1")

Definition at line 583 of file m_cloudbox.cc.

References DEBUG_ONLY, fractional_gp(), gridpos_upperend_check(), GridPos::idx, interp(), interpweights(), is_gridpos_at_index_i(), is_same_within_epsilon(), is_size(), joker, ConstTensor7View::nbooks(), ConstMatrixView::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), ConstTensor7View::nlibraries(), ConstTensor7View::nrows(), ConstMatrixView::nrows(), ConstTensor7View::nshelves(), ConstTensor7View::nvitrines(), Matrix::resize(), and rte_pos2gridpos().

Referenced by iyInterpCloudboxField_g().

◆ particle_fieldCleanup()

void particle_fieldCleanup ( Tensor4 particle_field_out,
const Tensor4 particle_field_in,
const Numeric threshold,
const Verbosity verbosity 
)

WORKSPACE METHOD: particle_fieldCleanup.

Removes unrealistically small or erroneous data from particle fields.

This WSM checks if the input particle field (e.g. particle_bulkprop_field*, scat_species_XXX_field) contains values smaller than the given threshold. In this case, these values will be set to zero.

The method should be applied if the particle fields contain unrealistically small or erroneous data (NWP/GCM model data, e.g. from the Chevallierl_91l sets, often contain very small or even negative values, which are numerical artefacts rather than physical values.) For the scat_species_XXX_fields, it needs to be applied separately per Tensor4 type field collection. This allows to use different thresholds for the different types of fields (not for the different scattering species, though).

particle_fieldCleanup* shall be called after generation of the atmopheric fields.

Author
Daniel Kreyling
Parameters
[out]particle_field_outGeneric output
[in]particle_field_inGeneric Input
[in]thresholdGeneric Input

Definition at line 1104 of file m_cloudbox.cc.

References i, ConstTensor4View::nbooks(), and ConstTensor4View::npages().

Referenced by particle_fieldCleanup_g().

◆ pnd_fieldCalcFrompnd_field_raw()

void pnd_fieldCalcFrompnd_field_raw ( Tensor4 pnd_field,
ArrayOfTensor4 dpnd_field_dx,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const ArrayOfGriddedField3 pnd_field_raw,
const Index atmosphere_dim,
const ArrayOfIndex cloudbox_limits,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Index zeropadding,
const Verbosity verbosity 
)

WORKSPACE METHOD: pnd_fieldCalcFrompnd_field_raw.

Interpolation of particle number density fields to calculation grid inside cloudbox.

This method interpolates the particle number density field from the raw data pnd_field_raw to obtain pnd_field. For 1D cases, where internally GriddedFieldPRegrid and GriddedFieldLatLonRegrid* are applied, zeropadding=1 sets the pnd_field* at pressure levels levels exceeding pnd_field_raw's pressure grid to 0 (not implemented for 2D and 3D yet). Default: zeropadding=0, which throws an error if the calculation pressure grid p_grid* is not completely covered by pnd_field_raw's pressure grid.

Author
Sreerekha T.R.
Claudia Emde
Oliver Lemke
Parameters
[out]pnd_fieldWS Output
[out]dpnd_field_dxWS Output
[in]p_gridWS Input
[in]lat_gridWS Input
[in]lon_gridWS Input
[in]pnd_field_rawWS Input
[in]atmosphere_dimWS Input
[in]cloudbox_limitsWS Input
[in]jacobian_quantitiesWS Input
[in]zeropaddingGeneric Input (Default: "0")

Definition at line 1766 of file m_cloudbox.cc.

References chk_atm_grids(), chk_pnd_field_raw_only_in_cloudbox(), CREATE_OUT0, data, FieldFromGriddedField(), GFIELD3_LAT_GRID, GFIELD3_LON_GRID, GFIELD3_P_GRID, GriddedFieldPRegrid(), gridpos(), i, interp(), interpweights(), joker, Array< base >::nelem(), p2gridpos(), Tensor4::resize(), and _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str().

Referenced by pnd_fieldCalcFrompnd_field_raw_g().

◆ pnd_fieldExpand1D()

void pnd_fieldExpand1D ( Tensor4 pnd_field,
const Index atmosphere_dim,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits,
const Index nzero,
const Verbosity verbosity 
)

WORKSPACE METHOD: pnd_fieldExpand1D.

Maps a 1D pnd_field to a (homogeneous) 2D or 3D pnd_field.

This method takes a 1D pnd_field and converts it to a 2D or 3D "cloud". It is assumed that a complete 1D case has been created, and after this atmosphere_dim, lat_grid, lon_grid and cloudbox_limits* have been changed to a 2D or 3D case (without changing the vertical extent of the cloudbox.

No modification of pnd_field is made for the pressure dimension. At the latitude and longitude cloudbox edge points pnd_field is set to zero. This corresponds to nzero=1. If you want a larger margin between the lat and lon cloudbox edges and the "cloud" you increase nzero*, where nzero is the number of grid points for which pnd_field* shall be set to 0, counted from each lat and lon edge.

See further AtmFieldsExpand1D.

Author
Patrick Eriksson
Parameters
[in,out]pnd_fieldWS Input/Output
[in]atmosphere_dimWS Input
[in]cloudbox_onWS Input
[in]cloudbox_limitsWS Input
[in]nzeroGeneric Input (Default: "1")

Definition at line 1974 of file m_cloudbox.cc.

References ConstTensor4View::nbooks(), ConstTensor4View::ncols(), ConstTensor4View::npages(), ConstTensor4View::nrows(), and Tensor4::resize().

Referenced by pnd_fieldExpand1D_g().

◆ pnd_fieldZero()

void pnd_fieldZero ( Tensor4 pnd_field,
ArrayOfTensor4 dpnd_field_dx,
ArrayOfArrayOfSingleScatteringData scat_data,
const Index atmosphere_dim,
const Vector f_grid,
const ArrayOfIndex cloudbox_limits,
const ArrayOfRetrievalQuantity jacobian_quantities,
const Verbosity verbosity 
)

WORKSPACE METHOD: pnd_fieldZero.

Sets pnd_field to zero.

Creates an empty pnd_field of cloudbox size according to cloudbox_limits* and with number of scattering elemements according to scat_data. If scat_data is not set yet, it will be filled with one dummy scattering element.

The method works with both scat_data and scat_data_raw. This method primarily exists for testing purposes. On the one hand, empty pnd_field runs can be used to test the agreement between true clear-sky (cloudboxOff) solutions and the scattering solver solution in factual clear-sky conditions. It is important to avoid discontinuities when switching from thin-cloud to clear-sky conditions. Moreover, scattering calculations using the DOIT method include interpolation errors. If one is interested in this effect, one should compare the DOIT result with an empty cloudbox to a clearsky calculation. That means that the iterative method is performed for a cloudbox with no particles.

Author
Claudia Emde, Jana Mendrok
Parameters
[out]pnd_fieldWS Output
[out]dpnd_field_dxWS Output
[in,out]scat_dataWS Input/Output
[in]atmosphere_dimWS Input
[in]f_gridWS Input
[in]cloudbox_limitsWS Input
[in]jacobian_quantitiesWS Input

Definition at line 2030 of file m_cloudbox.cc.

References chk_if_in_range(), Array< base >::nelem(), ConstVectorView::nelem(), nlinspace(), PTYPE_TOTAL_RND, Tensor4::resize(), and TotalNumberOfElements().

Referenced by DisortCalcClearsky(), and pnd_fieldZero_g().

◆ ScatElementsPndAndScatAdd()

void ScatElementsPndAndScatAdd ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfGriddedField3 pnd_field_raw,
const Index atmosphere_dim,
const ArrayOfString scat_data_files,
const ArrayOfString pnd_field_files,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatElementsPndAndScatAdd.

Adds single scattering data and particle number density for individual scattering elements.

The methods reads the specified files and appends the obtained data to scat_data and pnd_field_raw. Scattering data is appended to the current last existing scattering species in scat_data.

Author
Claudia Emde, Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in,out]pnd_field_rawWS Input/Output
[in]atmosphere_dimWS Input
[in]scat_data_filesGeneric Input
[in]pnd_field_filesGeneric Input

Definition at line 1145 of file m_cloudbox.cc.

References chk_if_in_range(), chk_pnd_data(), CREATE_OUT1, CREATE_OUT2, i, Array< base >::nelem(), Absorption::nelem(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and xml_read_from_file().

Referenced by ScatElementsPndAndScatAdd_g().

◆ ScatElementsSelect()

void ScatElementsSelect ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfArrayOfScatteringMetaData scat_meta,
const ArrayOfString scat_species,
const String species,
const String sizeparam,
const Numeric sizemin,
const Numeric sizemax,
const Numeric tolerance,
const String delim,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatElementsSelect.

Allows to limit considered scattering elements according to size.

Scattering elements of a specified scattering species are removed from scat_data_raw and scat_meta, i.e. removed from further calculations, if their particle size exceeds the specified limits. Specification of the scattering species is done by name matching the scattering species name part of scat_species tag. As size parameter, all size parameters reported by the meta data can be used (see scat_meta_single for offered parameters and their naming).

Author
Daniel Kreyling, Oliver Lemke, Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in,out]scat_metaWS Input/Output
[in]scat_speciesWS Input
[in]speciesGeneric Input
[in]sizeparamGeneric Input
[in]sizeminGeneric Input (Default: "0.")
[in]sizemaxGeneric Input (Default: "-1.")
[in]toleranceGeneric Input (Default: "1e-6")
[in]delimGeneric Input (Default: "-")

Definition at line 1504 of file m_cloudbox.cc.

References i, Array< base >::nelem(), parse_partfield_name(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and TotalNumberOfElements().

Referenced by ScatElementsSelect_g().

◆ ScatElementsToabs_speciesAdd()

void ScatElementsToabs_speciesAdd ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfGriddedField3 vmr_field_raw,
ArrayOfArrayOfSpeciesTag abs_species,
Index propmat_clearsky_agenda_checked,
Index abs_xsec_agenda_checked,
const Index atmosphere_dim,
const Vector f_grid,
const ArrayOfString scat_data_files,
const ArrayOfString pnd_field_files,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatElementsToabs_speciesAdd.

Appends scattering elements to abs_species including reading single scattering data and corresponding pnd field.

The methods reads the specified single scattering and pnd_field data of individual scattering elements and appends the obtained data to scat_data (appending to its last scattering species) and vmr_field_raw*. Per scattering element, it also appends one instance of species 'particles' to abs_species.

Author
Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in,out]vmr_field_rawWS Input/Output
[in,out]abs_speciesWS Input/Output
[in,out]propmat_clearsky_agenda_checkedWS Input/Output
[in,out]abs_xsec_agenda_checkedWS Input/Output
[in]atmosphere_dimWS Input
[in]f_gridWS Input
[in]scat_data_filesGeneric Input
[in]pnd_field_filesGeneric Input

Definition at line 1256 of file m_cloudbox.cc.

References abs_speciesAdd(), chk_if_in_range(), chk_if_increasing(), chk_interpolation_grids(), chk_pnd_data(), CREATE_OUT1, CREATE_OUT2, ConstVectorView::empty(), i, Array< base >::nelem(), Absorption::nelem(), scat_dataCheck(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), and xml_read_from_file().

Referenced by ScatElementsToabs_speciesAdd_g().

◆ ScatSpeciesExtendTemperature()

void ScatSpeciesExtendTemperature ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
const ArrayOfString scat_species,
const String species,
const String scat_species_delim,
const Numeric T_low,
const Numeric T_high,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatSpeciesExtendTemperature.

Extends valid temperature range of single scattering data.

The method allows to extend the temperature range of given single scattering data by duplicating optical property data at the low and/or high limits of the associated temperature grid. T_low and T_high* specify the temperature grid points that are added. Extension is only performed if T_low is lower and T_high is higher than the original lowest and highest temperatures, respectively, and if the original data contains more than one temperature grid point (i.e., when not assumed constant anyways).

The method is thought, e.g., for atmospheric ice falling into atmospheric layers with temperatures above the melting point of ice, where ambient and particle temperature deviate (as long as frozen the ice temperature remains at the melting point temperature). It is not internally checked, whether the original data includes the melting point. The method can be used in a wider sense. However, it remains in the responsibility of the user to apply the method in a meaningful sense and on meaningful single scattering data.

The temperature extension is applied on all scattering elements of a scattering species. If scat_species is defined, species can be used to select the species on which the extension shall be applied comparing species with the scattering species name part of scat_species. If no species is specified, the method is applied on the current last existing scattering species in scat_data*. Through the latter the method can be applied for cases when scat_species is not defined (e.g. when pnd_field data is created externally instead of from hydrometeor fields

Author
Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in]scat_speciesWS Input
[in]speciesGeneric Input (Default: "")
[in]scat_species_delimGeneric Input (Default: "-")
[in]T_lowGeneric Input (Default: "-1.")
[in]T_highGeneric Input (Default: "-1.")

Definition at line 1614 of file m_cloudbox.cc.

References SingleScatteringData::aa_grid, SingleScatteringData::abs_vec_data, SingleScatteringData::description, SingleScatteringData::ext_mat_data, SingleScatteringData::f_grid, i, joker, last(), ConstTensor7View::nbooks(), ConstTensor5View::ncols(), ConstTensor7View::ncols(), Array< base >::nelem(), ConstVectorView::nelem(), ConstTensor7View::npages(), ConstTensor7View::nrows(), ConstTensor7View::nshelves(), parse_partfield_name(), SingleScatteringData::pha_mat_data, SingleScatteringData::ptype, Tensor5::resize(), Tensor7::resize(), _CS_basic_sstream_base< _CS_cT, _CS_Tr, _CS_Al >::str(), SingleScatteringData::T_grid, and SingleScatteringData::za_grid.

Referenced by ScatSpeciesExtendTemperature_g().

◆ ScatSpeciesInit()

void ScatSpeciesInit ( ArrayOfString scat_species,
ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfArrayOfScatteringMetaData scat_meta,
Index scat_data_checked,
ArrayOfGriddedField3 pnd_field_raw,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatSpeciesInit.

Initializes the scattering species related data variables.

This method initializes the scat_species WSV, the variables that will hold the raw optical properties and the raw particle number distributions of the scattering elements (scat_data_raw and pnd_field_raw*, respectively) as well as the one holding the meta information about the scattering elements (scat_meta).

This method has to be executed before WSM reading/adding to the said variable, e.g. before ScatSpeciesPndAndScatAdd.

Author
Jana Mendrok
Parameters
[out]scat_speciesWS Output
[out]scat_data_rawWS Output
[out]scat_metaWS Output
[out]scat_data_checkedWS Output
[out]pnd_field_rawWS Output

Definition at line 1130 of file m_cloudbox.cc.

Referenced by ScatSpeciesInit_g().

◆ ScatSpeciesPndAndScatAdd()

void ScatSpeciesPndAndScatAdd ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfGriddedField3 pnd_field_raw,
const Index atmosphere_dim,
const ArrayOfString scat_data_files,
const String pnd_fieldarray_file,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatSpeciesPndAndScatAdd.

Adds single scattering data and particle number densities for one scattering species.

The WSV pnd_field_raw containing particle number densities for all scattering species can be generated outside ARTS, for example by using PyARTS or atmlab. This method reads this data as well as its corresponding single scattering data, which is added as a new scattering species to scat_data. This method needs as input an ArrayOfString holding the filenames of the single scattering data for each scattering element and a file containing the corresponding pnd_field_raw. In contrast to the scattering data, the pnd-fields are stored in a single XML-file containing an ArrayofGriddedField3, i.e. holding the pnd-field data of all scattering elements.

Important note: The order of the filenames for the scattering data files has to correspond to the order of the pnd-fields, stored in the variable pnd_field_raw*.

Author
Claudia Emde, Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in,out]pnd_field_rawWS Input/Output
[in]atmosphere_dimWS Input
[in]scat_data_filesGeneric Input
[in]pnd_fieldarray_fileGeneric Input

Definition at line 1211 of file m_cloudbox.cc.

References chk_if_in_range(), chk_pnd_raw_data(), CREATE_OUT2, i, Array< base >::nelem(), and xml_read_from_file().

Referenced by ScatSpeciesPndAndScatAdd_g().

◆ ScatSpeciesScatAndMetaRead()

void ScatSpeciesScatAndMetaRead ( ArrayOfArrayOfSingleScatteringData scat_data_raw,
ArrayOfArrayOfScatteringMetaData scat_meta,
const ArrayOfString scat_data_files,
const Verbosity verbosity 
)

WORKSPACE METHOD: ScatSpeciesScatAndMetaRead.

Reads single scattering data and scattering meta data for one scattering species.

This method takes a string array as input containing the location (path and filename) of the single scattering data. Location of corresponding scattering meta data is derived applying a naming convention: ending '.xml*' is replaced by '.meta.xml' (search for zipped files is done automatically).

All scattering elements read in one call of the method are assigned to one and the same scattering species. That is, reading in data for a bunch of scattering species can be realized by multiple call of this method. Assignment to scattering species is in the order of the calls (i.e., first method call reads data for first scat_species entry, second call for second scat_species entry and so on). Note that no two scattering elements of the same scattering species are allowed to be equal in size*

Important note: The order of the filenames for the single scattering data files has to exactly correspond to the order of the scattering meta data files.

Author
Daniel Kreyling, Oliver Lemke, Jana Mendrok
Parameters
[in,out]scat_data_rawWS Input/Output
[in,out]scat_metaWS Input/Output
[in]scat_data_filesGeneric Input

Definition at line 1367 of file m_cloudbox.cc.

References CREATE_OUT2, CREATE_OUT3, file_exists(), find_xml_file(), i, Array< base >::nelem(), my_basic_string< charT >::split(), and xml_read_from_file().

Referenced by ScatSpeciesScatAndMetaRead_g().

Variable Documentation

◆ DEG2RAD

const Numeric DEG2RAD

Referenced by cloudboxSetFullAtm().

◆ DENSITY_OF_ICE

const Numeric DENSITY_OF_ICE

◆ GFIELD3_LAT_GRID

const Index GFIELD3_LAT_GRID

◆ GFIELD3_LON_GRID

const Index GFIELD3_LON_GRID

◆ GFIELD3_P_GRID

const Index GFIELD3_P_GRID

◆ LAT_LON_MIN

const Numeric LAT_LON_MIN

Referenced by cloudboxSetFullAtm().

◆ PI

const Numeric PI

◆ RAD2DEG

const Numeric RAD2DEG