check_input.h File Reference

#include "agenda_class.h"
#include "exceptions.h"
#include "matpackVII.h"
#include "mystring.h"

Include dependency graph for check_input.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void chk_if_bool (const String &x_name, const Index &x)
 chk_if_bool
void chk_if_in_range (const String &x_name, const Index &x, const Index &x_low, const Index &x_high)
 chk_if_in_range
void chk_if_increasing (const String &x_name, const ArrayOfIndex &x)
 chk_if_increasing
void chk_if_over_0 (const String &x_name, const Numeric &x)
 chk_if_over_0
void chk_if_in_range (const String &x_name, const Numeric &x, const Numeric &x_low, const Numeric &x_high)
 chk_if_in_range
void chk_vector_length (const String &x_name, ConstVectorView x, const Index &l)
 chk_vector_length
void chk_vector_length (const String &x1_name, const String &x2_name, ConstVectorView x1, ConstVectorView x2)
 chk_vector_length
void chk_if_increasing (const String &x_name, ConstVectorView x)
 chk_if_increasing
void chk_if_decreasing (const String &x_name, ConstVectorView x)
 chk_if_decreasing
void chk_interpolation_grids (const String &which_interpolation, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac=0.5)
 Check interpolation grids.
void chk_interpolation_grids (const String &which_interpolation, ConstVectorView old_grid, const Numeric &new_grid, const Numeric &extpolfac=0.5)
 Check interpolation grids.
void chk_matrix_ncols (const String &x_name, ConstMatrixView x, const Index &l)
 chk_matrix_ncols
void chk_matrix_nrows (const String &x_name, ConstMatrixView x, const Index &l)
 chk_matrix_nrows
void chk_atm_grids (const Index &dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid)
 chk_atm_grids
void chk_atm_field (const String &x_name, ConstTensor3View x, const Index &dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid)
 chk_atm_field (simple fields)
void chk_atm_field (const String &x_name, ConstTensor4View x, const Index &dim, const Index &nspecies, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid)
 chk_atm_field (fields with one more dimension)
void chk_atm_surface (const String &x_name, const Matrix &x, const Index &dim, ConstVectorView lat_grid, ConstVectorView lon_grid)
 chk_atm_surface
void chk_cloudbox (const Index &dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits)
 chk_cloudbox
void chk_not_empty (const String &x_name, const Agenda &x)
 chk_not_empty
template<class T>
Index chk_contains (const String &x_name, const Array< T > &x, const T &what)
 Check if an array contains a value.
template<class T>
void chk_size (const String &x_name, const Array< T > &x, const Index &c)
 Check the size of an array.
void chk_size (const String &x_name, ConstVectorView x, const Index &c)
 Runtime check for size of Vector.
void chk_size (const String &x_name, ConstMatrixView x, const Index &r, const Index &c)
 Runtime check for size of Matrix.
void chk_size (const String &x_name, ConstTensor3View x, const Index &p, const Index &r, const Index &c)
 Runtime check for size of Tensor.
void chk_size (const String &x_name, ConstTensor4View x, const Index &b, const Index &p, const Index &r, const Index &c)
 Runtime check for size of Tensor.
void chk_size (const String &x_name, ConstTensor5View x, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Runtime check for size of Tensor.
void chk_size (const String &x_name, ConstTensor6View x, const Index &v, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Runtime check for size of Tensor.
void chk_size (const String &x_name, ConstTensor7View x, const Index &l, const Index &v, const Index &s, const Index &b, const Index &p, const Index &r, const Index &c)
 Runtime check for size of Tensor.


Detailed Description

Author:
Patrick Eriksson <Patrick.Eriksson@rss.chalmers.se>
Date:
2002-04-15
This file contains the declaration of functions in check_input.cc.

Definition in file check_input.h.


Function Documentation

void chk_atm_field ( const String x_name,
ConstTensor4View  x,
const Index dim,
const Index nspecies,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid 
)

chk_atm_field (fields with one more dimension)

Checks if an atmospheric field matches the dimensionality and the grids. This is the version for fields like vmr_field, which are a Tensor4, not a Tensor3. (First dimension is the gas species.)

The function gives an error message if this is not the case.

Parameters:
x_name The name of the atmospheric field.
x A variable holding an atmospheric field.
dim The atmospheric dimensionality.
nspecies Number of species.
p_grid The pressure grid.
lat_grid The latitude grid.
lon_grid The longitude grid.
Author:
Stefan Buehler, cloned from Patrick Eriksson
Date:
2002-12-20

Definition at line 678 of file check_input.cc.

References ConstTensor4View::nbooks(), ConstTensor4View::ncols(), ConstVectorView::nelem(), ConstTensor4View::npages(), and ConstTensor4View::nrows().

void chk_atm_field ( const String x_name,
ConstTensor3View  x,
const Index dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid 
)

chk_atm_field (simple fields)

Checks if an atmospheric field matches the dimensionality and the grids.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the atmospheric field.
x A variable holding an atmospheric field.
dim The atmospheric dimensionality.
p_grid The pressure grid.
lat_grid The latitude grid.
lon_grid The longitude grid.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 635 of file check_input.cc.

References ConstTensor3View::ncols(), ConstVectorView::nelem(), ConstTensor3View::npages(), and ConstTensor3View::nrows().

Referenced by abs_fieldCalc(), abs_lookupSetup(), AtmFieldsRefinePgrid(), interp_atmfield_by_itw(), refr_indexFieldAndGradients(), rtecalc_check_input(), and ZaSatOccultation().

void chk_atm_grids ( const Index dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid 
)

chk_atm_grids

Checks if the atmospheric grids and the specified atmospheric dimensionality match, and if the grids are ordered correctly.

The function gives an error message if this is not the case.

Parameters:
dim The atmospheric dimensionality.
p_grid The pressure grid.
lat_grid The latitude grid.
lon_grid The longitude grid.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 558 of file check_input.cc.

References chk_if_decreasing(), chk_if_increasing(), and ConstVectorView::nelem().

Referenced by abs_fieldCalc(), abs_lookupSetup(), AtmFieldsCalc(), AtmFieldsCalcExpand1D(), AtmFieldsFromCompact(), AtmFieldsRefinePgrid(), cloudboxSetManually(), doit_i_fieldSetConst(), doit_i_fieldUpdateSeq3D(), DoitCloudboxFieldPut(), interp_atmfield_gp2itw(), ParticleTypeAdd(), ParticleTypeAddAll(), pnd_fieldCalc(), r_geoidSpherical(), r_geoidWGS84(), refr_indexFieldAndGradients(), rtecalc_check_input(), and ZaSatOccultation().

void chk_atm_surface ( const String x_name,
const Matrix x,
const Index dim,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid 
)

chk_atm_surface

Checks if an atmospheric surface matches the dimensionality and the grids.

An example on an atmospheric surface is *z_ground*.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the atmospheric surface.
x A variable holding an atmospheric surface.
dim The atmospheric dimensionality.
lat_grid The latitude grid.
lon_grid The longitude grid.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 728 of file check_input.cc.

References ConstMatrixView::ncols(), ConstVectorView::nelem(), and ConstMatrixView::nrows().

Referenced by doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq3D(), interp_atmsurface_by_itw(), refr_indexFieldAndGradients(), rtecalc_check_input(), sensor_posAddRgeoid(), and ZaSatOccultation().

void chk_cloudbox ( const Index dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits 
)

chk_cloudbox

Checks the consistency of the cloud box workspace variables.

The consistency is checked both internally and with respect to the grids.

The function gives an error message if a consistency failure is found.

Parameters:
dim The atmospheric dimensionality.
p_grid The pressure grid.
lat_grid The latitude grid.
lon_grid The longitude grid.
cloudbox_on Flag to activate the cloud box.
cloudbox_limits Index limits of the cloud box.
Author:
Patrick Eriksson
Date:
2002-05-11

Definition at line 774 of file check_input.cc.

References chk_if_bool(), ConstVectorView::nelem(), and Array< base >::nelem().

Referenced by rtecalc_check_input().

template<class T>
Index chk_contains ( const String x_name,
const Array< T > &  x,
const T &  what 
) [inline]

Check if an array contains a value.

This makes sure that the array *x* contains the element with value *what* exactly once.

As a bonus, it returns the index of *what* in *x*.

This template function can be used for arrays of anything, provided that the "==" operator is defined.

Returns:
The index of the thing we looked for.
Parameters:
x_name Name of the array to check
x The array to check
what The value to look for.
Author:
Stefan Buehler
Date:
2002-11-28

Definition at line 184 of file check_input.h.

References find_all(), and Array< base >::nelem().

Referenced by GasAbsLookup::Adapt(), jacobianCalcAbsSpecies(), and RteCalc().

void chk_if_bool ( const String x_name,
const Index x 
)

chk_if_bool

Checks that a variable of type Index has the value 0 or 1.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Index.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 63 of file check_input.cc.

References is_bool().

Referenced by chk_cloudbox(), sensor_responseAntenna(), and sensor_responseInit().

void chk_if_decreasing ( const String x_name,
ConstVectorView  x 
)

chk_if_decreasing

Checks if a vector is strictly decreasing.

Duplicated values are not allowed.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Vector.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 313 of file check_input.cc.

References is_decreasing().

Referenced by GasAbsLookup::Adapt(), chk_atm_grids(), doit_i_fieldUpdate1D(), and doit_i_fieldUpdateSeq1D().

void chk_if_in_range ( const String x_name,
const Numeric x,
const Numeric x_low,
const Numeric x_high 
)

chk_if_in_range

Checks that a variable of type Numeric has a value inside the specified range.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Numeric.
x_low Lowest allowed value for x.
x_high Highest allowed value for x.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 184 of file check_input.cc.

void chk_if_in_range ( const String x_name,
const Index x,
const Index x_low,
const Index x_high 
)

void chk_if_increasing ( const String x_name,
ConstVectorView  x 
)

chk_if_increasing

Checks if a vector is strictly increasing.

Duplicated values are not allowed.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Vector.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 283 of file check_input.cc.

References is_increasing().

void chk_if_increasing ( const String x_name,
const ArrayOfIndex x 
)

chk_if_increasing

Checks if an ArrayOfIndex is strictly increasing. Cloned from Patricks similar function for Vector.

Duplicated values are not allowed.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type ArrayOfIndex.
Author:
Stefan Buehler
Date:
2007-05-18

Definition at line 122 of file check_input.cc.

References is_increasing().

Referenced by GasAbsLookup::Adapt(), chk_atm_grids(), doit_conv_flagAbsBT(), doit_conv_flagLsq(), doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq3D(), interp_gfield3(), jacobianCalcPointing(), ParticleTypeAdd(), ParticleTypeAddAll(), rtecalc_check_input(), ScatteringDoit(), sensor_responseAntenna(), and sensor_responseInit().

void chk_if_over_0 ( const String x_name,
const Numeric x 
)

chk_if_over_0

Checks that a variable of type Numeric is 0 or is positive. range.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Numeric.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 154 of file check_input.cc.

Referenced by Cloudbox_ppathCalc(), ppath_calc(), surfaceBlackbody(), surfaceFlatRefractiveIndex(), and surfaceFlatVaryingEmissivity().

void chk_interpolation_grids ( const String which_interpolation,
ConstVectorView  old_grid,
const Numeric new_grid,
const Numeric extpolfac 
)

Check interpolation grids.

This function checks if old and new grid for an interpolation are ok. If not, it throws a detailed runtime error message. This is intended for workspace method input variable checking.

This is for the special case that the new grid is just a single Numeric, instead of a Vector. ("Red" interpolation.) It just calles the other more general chk_interpolation_grids function for which both grid arguments are vectors.

Parameters:
which_interpolation A string describing the interpolation for which the grids are intended.
old_grid The original grid.
new_grid The new grid.
extpolfac The extrapolation fraction. See gridpos function for details. Has a default value, which is consistent with gridpos.
Author:
Stefan Buehler
Date:
2008-11-24

Definition at line 465 of file check_input.cc.

References chk_interpolation_grids().

void chk_interpolation_grids ( const String which_interpolation,
ConstVectorView  old_grid,
ConstVectorView  new_grid,
const Numeric extpolfac 
)

Check interpolation grids.

This function checks if old and new grid for an interpolation are ok. If not, it throws a detailed runtime error message. This is intended for workspace method input variable checking.

Parameters:
which_interpolation A string describing the interpolation for which the grids are intended.
old_grid The original grid.
new_grid The new grid.
extpolfac The extrapolation fraction. See gridpos function for details. Has a default value, which is consistent with gridpos.
Author:
Stefan Buehler
Date:
2008-11-24

Definition at line 349 of file check_input.cc.

References is_decreasing(), is_increasing(), max, min, and ConstVectorView::nelem().

Referenced by chk_interpolation_grids().

void chk_matrix_ncols ( const String x_name,
ConstMatrixView  x,
const Index l 
)

chk_matrix_ncols

Checks that a matrix has the specified number of columns.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A matrix.
l The expected length of x.
Author:
Patrick Eriksson
Date:
2002-05-16

Definition at line 494 of file check_input.cc.

References ConstMatrixView::ncols().

Referenced by GasAbsLookup::Adapt(), sensor_posAddGeoidWGS84(), sensor_posAddRgeoid(), and surfaceFlatRefractiveIndex().

void chk_matrix_nrows ( const String x_name,
ConstMatrixView  x,
const Index l 
)

chk_matrix_nrows

Checks that a matrix has the specified number of rows.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A matrix.
l The expected length of x.
Author:
Patrick Eriksson
Date:
2002-05-16

Definition at line 523 of file check_input.cc.

References ConstMatrixView::nrows().

Referenced by GasAbsLookup::Adapt().

void chk_not_empty ( const String x_name,
const Agenda x 
)

chk_not_empty

Checks that an agenda is not empty.

The function gives an error message if the agenda is empty.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
Author:
Patrick Eriksson
Date:
2002-08-20

Definition at line 857 of file check_input.cc.

References Agenda::nelem().

Referenced by cloud_RT_surface(), doit_i_fieldIterate(), doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq3D(), doit_scat_fieldCalc(), doit_scat_fieldCalcLimb(), get_radiative_background(), RteCalc(), and ScatteringDoit().

void chk_size ( const String x_name,
ConstTensor7View  x,
const Index l,
const Index v,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Runtime check for size of Tensor.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
l Required number of libraries
v Required number of vitrines
s Required number of shelves
b Required number of books
p Required number of pages
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 1134 of file check_input.cc.

References is_size(), ConstTensor7View::nbooks(), ConstTensor7View::ncols(), ConstTensor7View::nlibraries(), ConstTensor7View::npages(), ConstTensor7View::nrows(), ConstTensor7View::nshelves(), and ConstTensor7View::nvitrines().

void chk_size ( const String x_name,
ConstTensor6View  x,
const Index v,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Runtime check for size of Tensor.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
v Required number of vitrines
s Required number of shelves
b Required number of books
p Required number of pages
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 1083 of file check_input.cc.

References is_size(), ConstTensor6View::nbooks(), ConstTensor6View::ncols(), ConstTensor6View::npages(), ConstTensor6View::nrows(), ConstTensor6View::nshelves(), and ConstTensor6View::nvitrines().

void chk_size ( const String x_name,
ConstTensor5View  x,
const Index s,
const Index b,
const Index p,
const Index r,
const Index c 
)

Runtime check for size of Tensor.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
s Required number of shelves
b Required number of books
p Required number of pages
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 1036 of file check_input.cc.

References is_size(), ConstTensor5View::nbooks(), ConstTensor5View::ncols(), ConstTensor5View::npages(), ConstTensor5View::nrows(), and ConstTensor5View::nshelves().

void chk_size ( const String x_name,
ConstTensor4View  x,
const Index b,
const Index p,
const Index r,
const Index c 
)

Runtime check for size of Tensor.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
b Required number of books
p Required number of pages
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 993 of file check_input.cc.

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

void chk_size ( const String x_name,
ConstTensor3View  x,
const Index p,
const Index r,
const Index c 
)

Runtime check for size of Tensor.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
p Required number of pages
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 954 of file check_input.cc.

References is_size(), ConstTensor3View::ncols(), ConstTensor3View::npages(), and ConstTensor3View::nrows().

void chk_size ( const String x_name,
ConstMatrixView  x,
const Index r,
const Index c 
)

Runtime check for size of Matrix.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
r Required number of rows
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 919 of file check_input.cc.

References is_size(), ConstMatrixView::ncols(), and ConstMatrixView::nrows().

void chk_size ( const String x_name,
ConstVectorView  x,
const Index c 
)

Runtime check for size of Vector.

This is the runtime version of is_size. An appropriate error message is generated if the size is not correct.

Parameters:
x_name The name of the agenda.
x A variable of type Agenda.
c Required number of columns
Author:
Stefan Buehler
Date:
2002-11-29

Definition at line 888 of file check_input.cc.

References is_size(), and ConstVectorView::nelem().

Referenced by abs_coefCalcFromXsec(), abs_lookupCreate(), GasAbsLookup::Adapt(), chk_single_scattering_data(), doit_i_fieldUpdate1D(), doit_i_fieldUpdateSeq1D(), doit_i_fieldUpdateSeq3D(), and doit_za_grid_optCalc().

template<class T>
void chk_size ( const String x_name,
const Array< T > &  x,
const Index c 
) [inline]

Check the size of an array.

Checks the size of an Array. Cloned from Patricks similar function for Vector.

The function throws a runtime_error if the size is not correct.

This is a template function that works for any array type.

Parameters:
x_name The name of the variable.
x A variable of type ArrayOfIndex.
c The size to match
Author:
Stefan Buehler
Date:
2007-05-18

Definition at line 241 of file check_input.h.

References Array< base >::nelem().

void chk_vector_length ( const String x1_name,
const String x2_name,
ConstVectorView  x1,
ConstVectorView  x2 
)

chk_vector_length

Checks if two vectors have the same length.

The function gives an error message if this is not the case.

Parameters:
x1_name The name of the first vector
x2_name The name of the second vector
x1 The first vector.
x2 The second vector.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 250 of file check_input.cc.

References ConstVectorView::nelem().

void chk_vector_length ( const String x_name,
ConstVectorView  x,
const Index l 
)

chk_vector_length

Checks that a vector has the specified length.

The function gives an error message if this is not the case.

Parameters:
x_name The name of the variable.
x A variable of type Vector.
l The expected length of x.
Author:
Patrick Eriksson
Date:
2002-04-15

Definition at line 219 of file check_input.cc.

References ConstVectorView::nelem().

Referenced by GasAbsLookup::Adapt(), Cloudbox_ppathCalc(), ppath_calc(), rte_posAddGeoidWGS84(), and rte_posAddRgeoid().


Generated on Mon Mar 23 14:06:33 2009 for ARTS by  doxygen 1.5.6