ARTS  2.0.49
special_interp.h File Reference

Header file for special_interp.cc. More...

#include "interpolation.h"
#include "interpolation_poly.h"
#include "gridded_fields.h"

Go to the source code of this file.

Functions

void interp_atmfield_gp2itw (Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 interp_atmfield_gp2itw More...
 
void interp_atmfield_by_itw (VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
 interp_atmfield_by_itw More...
 
void interp_atmfield_by_gp (VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 interp_atmfield_by_gp More...
 
Numeric interp_atmfield_by_gp (const Index &atmosphere_dim, ConstTensor3View x_field, const GridPos &gp_p, const GridPos &gp_lat, const GridPos &gp_lon)
 interp_atmfield_by_gp More...
 
void interp_cloudfield_gp2itw (Matrix &itw, ArrayOfGridPos &gp_p_out, ArrayOfGridPos &gp_lat_out, ArrayOfGridPos &gp_lon_out, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
 interp_cloudfield_gp2itw More...
 
void interp_atmsurface_gp2itw (Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 interp_atmsurface_gp2itw More...
 
void interp_atmsurface_by_itw (VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
 interp_atmsurface_by_itw More...
 
void interp_atmsurface_by_gp (VectorView x, const Index &atmosphere_dim, ConstMatrixView x_field, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 interp_atmsurface_by_gp More...
 
Numeric interp_atmsurface_by_gp (const Index &atmosphere_dim, ConstMatrixView x_field, const GridPos &gp_lat, const GridPos &gp_lon)
 interp_atmsurface_by_gp More...
 
void interp_gfield3 (Numeric &value, const GriddedField3 &gfield3, const Index &effective_dim, const Numeric &x, const Numeric &y, const Numeric &z, const String &dim0, const String &dim1, const String &dim2)
 interp_gfield3 More...
 
void itw2p (VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
 itw2p More...
 
void p2gridpos (ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac=0.5)
 p2gridpos More...
 
void p2gridpos_poly (ArrayOfGridPosPoly &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Index order, const Numeric &extpolfac=0.5)
 p2gridpos_poly More...
 
void z_at_lat_2d (VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstMatrixView z_field, const GridPos &gp_lat)
 z_at_lat_2d More...
 
void z_at_latlon (VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, const GridPos &gp_lat, const GridPos &gp_lon)
 z_at_latlon More...
 

Detailed Description

Header file for special_interp.cc.

Author
Patrick Eriksson Patri.nosp@m.ck.E.nosp@m.rikss.nosp@m.on@r.nosp@m.ss.ch.nosp@m.alme.nosp@m.rs.se
Date
2002-11-14

Definition in file special_interp.h.

Function Documentation

◆ interp_atmfield_by_gp() [1/2]

Numeric interp_atmfield_by_gp ( const Index atmosphere_dim,
ConstTensor3View  x_field,
const GridPos gp_p,
const GridPos gp_lat,
const GridPos gp_lon 
)

interp_atmfield_by_gp

As the function above but return-numeric version.

Author
Patrick Eriksson
Date
2002-11-13

Definition at line 240 of file special_interp.cc.

References gridpos_copy(), and interp_atmfield_by_gp().

◆ interp_atmfield_by_gp() [2/2]

void interp_atmfield_by_gp ( VectorView  x,
const Index atmosphere_dim,
ConstTensor3View  x_field,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

interp_atmfield_by_gp

Interpolates an atmospheric field given the grid positions.

The function performs the interpolation for a number of positions. The return variable (x) is accordingly a vector. The vector must be set to have the same length as the grid position arrays before calling the function.

The input atmospheric field is checked to be consistent with the atmosphere_dim*, p_grid, lat_grid and lon_grid. The length of the grid position arrays are asserted to be the identical, or for dimensions not used, that the length is zero.

Parameters
xOutput: Values obtained by the interpolation.
atmosphere_dimAs the WSV with the same name.
x_fieldThe atmospheric field to be interpolated.
gp_pPressure grid positions.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 215 of file special_interp.cc.

References interp_atmfield_by_itw(), and interp_atmfield_gp2itw().

Referenced by interp_atmfield_by_gp(), InterpAtmFieldToRteGps(), and mcPathTraceIPA().

◆ interp_atmfield_by_itw()

void interp_atmfield_by_itw ( VectorView  x,
const Index atmosphere_dim,
ConstTensor3View  x_field,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon,
ConstMatrixView  itw 
)

interp_atmfield_by_itw

Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw.

The function performs the interpolation for a number of positions. The return variable (x) is accordingly a vector. The vector must be set to have the same length as the grid position arrays before calling the function.

The input atmospheric field is checked to be consistent with the atmosphere_dim*, p_grid, lat_grid and lon_grid. The length of the grid position arrays are asserted to be the identical, or for dimensions not used, that the length is zero.

Parameters
xOutput: Values obtained by the interpolation.
atmosphere_dimAs the WSV with the same name.
x_fieldThe atmospheric field to be interpolated.
gp_pPressure grid positions.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
itwInterpolation weights from interp_atmfield_gp2itw.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 159 of file special_interp.cc.

References interp(), joker, ConstMatrixView::ncols(), Array< base >::nelem(), and ConstVectorView::nelem().

Referenced by clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), get_ppath_atmvars(), get_ppath_pnd(), and interp_atmfield_by_gp().

◆ interp_atmfield_gp2itw()

void interp_atmfield_gp2itw ( Matrix itw,
const Index atmosphere_dim,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

interp_atmfield_gp2itw

Converts atmospheric grid positions to weights for interpolation of an atmospheric field.

The function is intended for "blue" interpolation, that is, interpolation for a set of positions.

The output matrix for interpolation weights are resized inside the function.

The input atmospheric grids are checked to be consistent.

Parameters
itwOutput: Interpolation weights.
atmosphere_dimAs the WSV with the same name.
gp_pPressure grid positions.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 99 of file special_interp.cc.

References interpweights(), Array< base >::nelem(), and Matrix::resize().

Referenced by clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), get_ppath_atmvars(), and interp_atmfield_by_gp().

◆ interp_atmsurface_by_gp() [1/2]

Numeric interp_atmsurface_by_gp ( const Index atmosphere_dim,
ConstMatrixView  x_surface,
const GridPos gp_lat,
const GridPos gp_lon 
)

interp_atmsurface_by_gp

As the function above, but return-numeric version.

Author
Patrick Eriksson
Date
2002-11-13

Definition at line 529 of file special_interp.cc.

References gridpos_copy(), and interp_atmsurface_by_gp().

◆ interp_atmsurface_by_gp() [2/2]

void interp_atmsurface_by_gp ( VectorView  x,
const Index atmosphere_dim,
ConstMatrixView  x_surface,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

interp_atmsurface_by_gp

Interpolates a surface-type variable given the grid positions.

The function performs the interpolation for a number of positions. The return variable (x) is accordingly a vector. The vector must be set to have the same length as the grid position arrays before calling the function.

The input surface-type variable is checked to be consistent with the atmosphere_dim*, lat_grid and lon_grid. The length of the grid position arrays are asserted to be the identical, or for dimensions not used, that the length is zero.

Parameters
xOutput: Values obtained by the interpolation.
atmosphere_dimAs the WSV with the same name.
x_surfaceThe atmospheric field to be interpolated.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 506 of file special_interp.cc.

References interp_atmsurface_by_itw(), and interp_atmsurface_gp2itw().

Referenced by interp_atmsurface_by_gp(), and InterpSurfaceFieldToRteGps().

◆ interp_atmsurface_by_itw()

void interp_atmsurface_by_itw ( VectorView  x,
const Index atmosphere_dim,
ConstMatrixView  x_surface,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon,
ConstMatrixView  itw 
)

interp_atmsurface_by_itw

Interpolates a surface-type variable with pre-calculated weights by interp_atmsurface_gp2itw.

The function performs the interpolation for a number of positions. The return variable (x) is accordingly a vector. The vector must be set to have the same length as the grid position arrays before calling the function.

The input surface-type variable is checked to be consistent with the atmosphere_dim*, lat_grid and lon_grid. The length of the grid position arrays are asserted to be the identical, or for dimensions not used, that the length is zero.

Parameters
xOutput: Values obtained by the interpolation.
atmosphere_dimAs the WSV with the same name.
x_surfaceThe atmospheric field to be interpolated.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
itwInterpolation weights from interp_atmsurface_gp2itw.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 452 of file special_interp.cc.

References interp(), joker, ConstMatrixView::ncols(), Array< base >::nelem(), and ConstVectorView::nelem().

Referenced by interp_atmsurface_by_gp().

◆ interp_atmsurface_gp2itw()

void interp_atmsurface_gp2itw ( Matrix itw,
const Index atmosphere_dim,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

interp_atmsurface_gp2itw

Converts atmospheric grid positions to weights for interpolation of a surface-type variable.

The function is intended for "blue" interpolation, that is, interpolation for a set of positions.

The output matrix for interpolation weights are resized inside the function.

The input atmospheric grids are checked to be consistent.

Parameters
itwOutput: Interpolation weights.
atmosphere_dimAs the WSV with the same name.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 396 of file special_interp.cc.

References interpweights(), Array< base >::nelem(), and Matrix::resize().

Referenced by interp_atmsurface_by_gp().

◆ interp_cloudfield_gp2itw()

void interp_cloudfield_gp2itw ( Matrix itw,
ArrayOfGridPos gp_p_out,
ArrayOfGridPos gp_lat_out,
ArrayOfGridPos gp_lon_out,
const ArrayOfGridPos gp_p_in,
const ArrayOfGridPos gp_lat_in,
const ArrayOfGridPos gp_lon_in,
const Index atmosphere_dim,
const ArrayOfIndex cloudbox_limits 
)

interp_cloudfield_gp2itw

Converts atmospheric grid positions to weights for interpolation of a field defined ONLY inside the cloudbox.

That is, as interp_atmfield_gp2itw, but for cloudbox only variables.

The input grid positions shall be with respect to total grids. If grid positions already refer to grid parts inside the cloudbox, you can use interp_atmfield_gp2itw.

The output grid positions are created by the function, to match the cloudbox field, and can be used for later calls of e.g. interp_atmfield_by_itw

Parameters
itwOutput: Interpolation weights.
gp_p_outOutput: Pressure cloudbox grid positions.
gp_lat_outOutput: Latitude cloudbox grid positions.
gp_lon_outOutput: Longitude cloudbox grid positions.
gp_p_inPressure grid positions.
gp_lat_inLatitude grid positions.
gp_lon_inLongitude grid positions.
atmosphere_dimAs the WSV with the same name.
cloudbiox_limitsAs the WSV with the same name.
Author
Patrick Eriksson
Date
2010-02-12

Definition at line 300 of file special_interp.cc.

References gridpos_copy(), gridpos_upperend_check(), interpweights(), Array< base >::nelem(), and Matrix::resize().

Referenced by get_ppath_pnd().

◆ interp_gfield3()

void interp_gfield3 ( Numeric value,
const GriddedField3 gfield3,
const Index effective_dim,
const Numeric x,
const Numeric y,
const Numeric z,
const String dim0,
const String dim1,
const String dim2 
)

interp_gfield3

Single point interpolation of a GriddedField3.

Data where not all dimensions are effectively used can be handled. For example, if the last dimension is not ysed, effective_dim* is set to 2.

"First dimension" refers to the left-most dimension.

Parameters
valueOutput: Obtained value.
gfield3Field to interpolate
effective_dimEffective dimension of gfield. See above.
xFirst dimension position of interpolation point.
ySecond dimension position of interpolation point.
zThird dimension position of interpolation point.
dim0Expected name of grid for first dimension
dim1Expected name of grid for second dimension
dim2Expected name of grid for third dimension
Author
Patrick Eriksson
Date
2008-10-01

Definition at line 581 of file special_interp.cc.

References chk_if_in_range(), chk_if_increasing(), GriddedField3::data, GriddedField::get_grid_name(), GriddedField::get_numeric_grid(), gridpos(), interp(), interpweights(), joker, last(), ConstTensor3View::ncols(), and ConstTensor3View::nrows().

Referenced by InterpSurfaceEmissivityFieldIncLatLon().

◆ itw2p()

void itw2p ( VectorView  p_values,
ConstVectorView  p_grid,
const ArrayOfGridPos gp,
ConstMatrixView  itw 
)

itw2p

Converts interpolation weights to pressures.

The function takes interpolation weights calculated with respect to the vertical dimension, and determines the corresponding pressures. This function can be used when a geometrical altitude is known and the pressure for that altitude shall be determined. The interpolation weights are then calculated using the geometrical altitudes for the pressure levels for the position of concern.

This can be seen as a 1D "blue" interpolation. That means that the number of columns of itw shall be 2.

Parameters
p_valuesOutput: Found pressure values.
p_gridAs the WSV with the same name.
gpAltitude grid positions.
itwInterpolation weights
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 763 of file special_interp.cc.

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

Referenced by clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), cloud_ppath_update3D(), get_ppath_atmvars(), get_refr_index_1d(), get_refr_index_2d(), get_refr_index_3d(), and interp_cloud_coeff1D().

◆ p2gridpos()

void p2gridpos ( ArrayOfGridPos gp,
ConstVectorView  old_pgrid,
ConstVectorView  new_pgrid,
const Numeric extpolfac 
)

p2gridpos

Calculates grid positions for pressure values.

This function works as gridpos, but is adapted to handle pressure grids. The ARTS defintions result in that pressures shall not be interpolated directly, it is the log of the pressure that shall be interpolated. This means that if some values shall be interpolated to some given pressures, the grid positions shall be calculated with this function. The interpolation can then be performed as usual.

Parameters
[out]gpOutput: Grid position Array.
[in]old_pgridThe original pressure grid.
[in]new_pgridThe new pressure grid.
[in]extpolfacExtrapolation factor. Default value is 0.5, which means that extrapolation of half of the last grid distance is allowed. You don't have to specify this.
Author
Patrick Eriksson
Date
2003-01-20
Author
Stefan Buehler
Date
2008-03-03

Definition at line 810 of file special_interp.cc.

References gridpos(), ConstVectorView::nelem(), and transform().

Referenced by atm_fields_compactAddSpecies(), diy_from_path_to_rgrids(), doit_i_fieldSetClearsky(), get_perturbation_gridpos(), pnd_fieldCalc(), and z_fieldFromHSE().

◆ p2gridpos_poly()

void p2gridpos_poly ( ArrayOfGridPosPoly gp,
ConstVectorView  old_pgrid,
ConstVectorView  new_pgrid,
const Index  order,
const Numeric extpolfac 
)

p2gridpos_poly

Calculates grid positions for pressure values - higher order interpolation.

This function is similar to p2gridpos, but for higher order interpolation.

Parameters
[out]gpOutput: Grid position Array.
[in]old_pgridThe original pressure grid.
[in]new_pgridThe new pressure grid.
[in]orderInterpolation order (1=linear, 2=quadratic, etc.)
[in]extpolfacExtrapolation factor. Default value is 0.5, which means that extrapolation of half of the last grid distance is allowed. You don't have to specify this.
Author
Stefan Buehler
Date
2010-05-03

Definition at line 843 of file special_interp.cc.

References gridpos_poly(), ConstVectorView::nelem(), and transform().

Referenced by AtmFieldsCalc().

◆ z_at_lat_2d()

void z_at_lat_2d ( VectorView  z,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstMatrixView  z_field,
const GridPos gp_lat 
)

z_at_lat_2d

Returns the geomtrical altitudes of p_grid for one latitude.

The latitude is specified by its grid position, in an ArrayOfGridPos of length 1. The altitude field (z_field) is then interpolated to that latitude.

Parameters
zOut: Found altitudes.
p_gridAs the WSV with the same name.
lat_gridAs the WSV with the same name.
z_fieldThe pressure and latitude part of the WSV with the same name (that is, the first column).
gp_latLatitude grid position.
Author
Patrick Eriksson
Date
2002-11-18

Definition at line 882 of file special_interp.cc.

References gridpos(), gridpos_copy(), interp(), interpweights(), joker, and ConstVectorView::nelem().

Referenced by get_refr_index_2d(), and ppath_start_stepping().

◆ z_at_latlon()

void z_at_latlon ( VectorView  z,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
const GridPos gp_lat,
const GridPos gp_lon 
)

z_at_latlon

Returns the geomtrical altitudes of p_grid for one latitude and one longitude.

The latitude and longitude are specified by their grid position, in an ArrayOfGridPos of length 1. The altitude field (z_field) is then interpolated to that latitude and longitude.

Parameters
zOut: Found altitudes.
p_gridAs the WSV with the same name.
lat_gridAs the WSV with the same name.
lon_gridAs the WSV with the same name.
z_fieldAs the WSV with the same name.
gp_latLatitude grid positions.
gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-12-31

Definition at line 934 of file special_interp.cc.

References gridpos(), gridpos_copy(), interp(), interpweights(), joker, and ConstVectorView::nelem().

Referenced by get_refr_index_3d(), mcPathTraceIPA(), and ppath_start_stepping().