ARTS 2.5.11 (git: 6827797f)
special_interp.h File Reference

Header file for special_interp.cc. More...

#include "gridded_fields.h"
#include "interpolation.h"
#include "jacobian.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)
 Converts atmospheric grid positions to weights for interpolation of an atmospheric field.
 
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)
 Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw.
 
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)
 Interpolates an atmospheric field given the grid positions.
 
Numeric interp_atmfield_by_gp (const Index &atmosphere_dim, ConstTensor3View x_field, const GridPos &gp_p={0, {0, 1}}, const GridPos &gp_lat={0, {0, 1}}, const GridPos &gp_lon={0, {0, 1}})
 Interpolates an atmospheric field given the grid positions.
 
void interp_cloudfield_gp2itw (VectorView itw, GridPos &gp_p_out, GridPos &gp_lat_out, GridPos &gp_lon_out, const GridPos &gp_p_in, const GridPos &gp_lat_in, const GridPos &gp_lon_in, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
 Converts atmospheric a grid position to weights for interpolation of a field defined ONLY inside the cloudbox.
 
void interp_atmsurface_gp2itw (Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Converts atmospheric grid positions to weights for interpolation of a surface-type variable.
 
void interp_atmsurface_by_itw (VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
 Interpolates a surface-type variable with pre-calculated weights by interp_atmsurface_gp2itw.
 
void interp_atmsurface_by_gp (VectorView x, const Index &atmosphere_dim, ConstMatrixView x_field, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Interpolates a surface-type variable given the grid positions.
 
Numeric interp_atmsurface_by_gp (const Index &atmosphere_dim, ConstMatrixView x_field, const GridPos &gp_lat, const GridPos &gp_lon)
 Interpolates a surface-type variable given the grid positions.
 
void regrid_atmfield_by_gp (Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Regrids an atmospheric field, for precalculated grid positions.
 
void regrid_atmsurf_by_gp (Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Regrids an atmospheric surface, for precalculated grid positions.
 
void get_gp_atmgrids_to_rq (ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
 Determines grid positions for regridding of atmospheric fields to retrieval grids.
 
void get_gp_atmsurf_to_rq (ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid)
 Determines grid positions for regridding of atmospheric surfaces to retrieval grids.
 
void get_gp_rq_to_atmgrids (ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, Index &n_p, Index &n_lat, Index &n_lon, const ArrayOfVector &ret_grids, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
 Determines grid positions for regridding of atmospheric fields to retrieval grids.
 
void get_gp_rq_to_atmgrids (ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, Index &n_lat, Index &n_lon, const ArrayOfVector &ret_grids, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid)
 Determines grid positions for regridding of atmospheric surfaces to retrieval grids.
 
void regrid_atmfield_by_gp_oem (Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Regridding of atmospheric field OEM-type.
 
void regrid_atmsurf_by_gp_oem (Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
 Regridding of surface field OEM-type.
 
void itw2p (VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
 Converts interpolation weights to pressures.
 
void p2gridpos (ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac=0.5)
 Calculates grid positions for pressure values.
 
void rte_pos2gridpos (GridPos &gp_p, GridPos &gp_lat, GridPos &gp_lon, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView rte_pos)
 Converts a geographical position (rte_pos) to grid positions for p, lat and lon.
 
void rte_pos2gridpos (GridPos &gp_lat, GridPos &gp_lon, const Index &atmosphere_dim, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
 Converts a geographical position (rte_pos) to grid positions for lat and lon.
 
void z_at_lat_2d (VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstMatrixView z_field, const GridPos &gp_lat)
 Returns the geomtrical altitudes of p_grid for one latitude.
 
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)
 Returns the geomtrical altitudes of p_grid for one latitude and one longitude.
 
void complex_n_interp (MatrixView n_real, MatrixView n_imag, const GriddedField3 &complex_n, const String &varname, ConstVectorView f_grid, ConstVectorView t_grid)
 General function for interpolating data of complex n type.
 

Detailed Description

Header file for special_interp.cc.

Author
Patrick Eriksson Patri.nosp@m.ck.E.nosp@m.rikss.nosp@m.on@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e
Date
2002-11-14

Definition in file special_interp.h.

Function Documentation

◆ complex_n_interp()

void complex_n_interp ( MatrixView  n_real,
MatrixView  n_imag,
const GriddedField3 complex_n,
const String varname,
ConstVectorView  f_grid,
ConstVectorView  t_grid 
)

General function for interpolating data of complex n type.

See documentation of comples_refr_index for format of complex_n-.

Parameters
[out]n_realReal part [nf,nt]
[out]n_imagImaginary part [nf,nt]
[in]complex_nComplex refracton index data.
[in]varnameThe name of complex_n to use in error message.
[in]f_gridOutput frequency grid [nf]
[in]t_gridOutput temperature grid [nt]
Author
Patrick Eriksson
Date
2013-08-16

Definition at line 894 of file special_interp.cc.

References ARTS_ASSERT, GriddedField3::checksize_strict(), chk_griddedfield_gridname(), chk_interpolation_grids(), GriddedField3::data, GriddedField::get_numeric_grid(), gridpos(), interp(), and interpweights().

Referenced by scat_data_singleTmatrix(), and surfaceFlatRefractiveIndex().

◆ get_gp_atmgrids_to_rq()

void get_gp_atmgrids_to_rq ( ArrayOfGridPos gp_p,
ArrayOfGridPos gp_lat,
ArrayOfGridPos gp_lon,
const RetrievalQuantity rq,
const Index &  atmosphere_dim,
const Vector &  p_grid,
const Vector &  lat_grid,
const Vector &  lon_grid 
)

Determines grid positions for regridding of atmospheric fields to retrieval grids.

The grid positions arrays are sized inside the function. gp_lat is given length 0 for atmosphere_dim=1 etc.

This regridding uses extpolfac=0.

Parameters
[out]gp_pPressure grid positions.
[out]gp_latLatitude grid positions.
[out]gp_lonLongitude grid positions.
[in]rqRetrieval quantity structure.
[in]atmosphere_dimAs the WSV with same name.
[in]p_gridAs the WSV with same name.
[in]lat_gridAs the WSV with same name.
[in]lon_gridAs the WSV with same name.
Author
Patrick Eriksson
Date
2015-09-09

Definition at line 349 of file special_interp.cc.

References gridpos(), RetrievalQuantity::Grids(), and p2gridpos().

◆ get_gp_atmsurf_to_rq()

void get_gp_atmsurf_to_rq ( ArrayOfGridPos gp_lat,
ArrayOfGridPos gp_lon,
const RetrievalQuantity rq,
const Index &  atmosphere_dim,
const Vector &  lat_grid,
const Vector &  lon_grid 
)

Determines grid positions for regridding of atmospheric surfaces to retrieval grids.

The grid positions arrays are sized inside the function. gp_lat is given length 0 for atmosphere_dim=1 etc.

This regridding uses extpolfac=0.

Parameters
[out]gp_latLatitude grid positions.
[out]gp_lonLongitude grid positions.
[in]rqRetrieval quantity structure.
[in]atmosphere_dimAs the WSV with same name.
[in]lat_gridAs the WSV with same name.
[in]lon_gridAs the WSV with same name.
Author
Patrick Eriksson
Date
2018-04-12

Definition at line 375 of file special_interp.cc.

References gridpos(), and RetrievalQuantity::Grids().

◆ get_gp_rq_to_atmgrids() [1/2]

void get_gp_rq_to_atmgrids ( ArrayOfGridPos gp_lat,
ArrayOfGridPos gp_lon,
Index &  n_lat,
Index &  n_lon,
const ArrayOfVector &  ret_grids,
const Index &  atmosphere_dim,
const Vector &  lat_grid,
const Vector &  lon_grid 
)

Determines grid positions for regridding of atmospheric surfaces to retrieval grids.

The grid positions arrays are sized inside the function. gp_lat is given length 0 for atmosphere_dim=1 etc.

This regridding uses extpolfac=Inf (where Inf is a very large value).

Note that the length output arguments (n_p etc.) are for the retrieval grids (not the length of grid positions arrays). n-Lat is set to 1 for atmosphere_dim=1 etc.

Parameters
[out]gp_latLatitude grid positions.
[out]gp_lonLongitude grid positions.
[out]n_latLength of retrieval lataitude grid.
[out]n_lonLength of retrieval longitude grid.
[in]rqRetrieval quantity structure.
[in]atmosphere_dimAs the WSV with same name.
[in]lat_gridAs the WSV with same name.
[in]lon_gridAs the WSV with same name.
Author
Patrick Eriksson
Date
2018-04-12

Definition at line 449 of file special_interp.cc.

References gp4length1grid(), gridpos(), jacobian_type_extrapol(), and Array< base >::nelem().

◆ get_gp_rq_to_atmgrids() [2/2]

void get_gp_rq_to_atmgrids ( ArrayOfGridPos gp_p,
ArrayOfGridPos gp_lat,
ArrayOfGridPos gp_lon,
Index &  n_p,
Index &  n_lat,
Index &  n_lon,
const ArrayOfVector &  ret_grids,
const Index &  atmosphere_dim,
const Vector &  p_grid,
const Vector &  lat_grid,
const Vector &  lon_grid 
)

Determines grid positions for regridding of atmospheric fields to retrieval grids.

The grid positions arrays are sized inside the function. gp_lat is given length 0 for atmosphere_dim=1 etc.

This regridding uses extpolfac=Inf (where Inf is a very large value).

Note that the length output arguments (n_p etc.) are for the retrieval grids (not the length of grid positions arrays). n-Lat is set to 1 for atmosphere_dim=1 etc.

Parameters
[out]gp_pPressure grid positions.
[out]gp_latLatitude grid positions.
[out]gp_lonLongitude grid positions.
[out]n_pLength of retrieval pressure grid.
[out]n_latLength of retrieval lataitude grid.
[out]n_lonLength of retrieval longitude grid.
[in]rqRetrieval quantity structure.
[in]atmosphere_dimAs the WSV with same name.
[in]p_gridAs the WSV with same name.
[in]lat_gridAs the WSV with same name.
[in]lon_gridAs the WSV with same name.
Author
Patrick Eriksson
Date
2015-09-09

Definition at line 396 of file special_interp.cc.

References gp4length1grid(), gridpos(), jacobian_type_extrapol(), Array< base >::nelem(), and p2gridpos().

Referenced by AtmFieldPerturb(), and x2artsAtmAndSurf().

◆ interp_atmfield_by_gp() [1/2]

Numeric interp_atmfield_by_gp ( const Index &  atmosphere_dim,
ConstTensor3View  x_field,
const GridPos gp_p = {0, {0, 1}},
const GridPos gp_lat = {0, {0, 1}},
const GridPos gp_lon = {0, {0, 1}} 
)

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.

There is also a vector version of this function.

Parameters
[in]atmosphere_dimAs the WSV with the same name.
[in]x_fieldThe atmospheric field to be interpolated.
[in]gp_pPressure grid positions.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Returns
Value obtained by the interpolation.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 122 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 
)

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.

There is also a return version of this function.

Parameters
[out]xValues obtained by the interpolation.
[in]atmosphere_dimAs the WSV with the same name.
[in]x_fieldThe atmospheric field to be interpolated.
[in]gp_pPressure grid positions.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 109 of file special_interp.cc.

References interp_atmfield_by_itw(), and interp_atmfield_gp2itw().

Referenced by emission_from_propmat_field(), interp_atmfield_by_gp(), and InterpAtmFieldToPosition().

◆ 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 
)

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
[out]xValues obtained by the interpolation.
[in]atmosphere_dimAs the WSV with the same name.
[in]x_fieldThe atmospheric field to be interpolated.
[in]gp_pPressure grid positions.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
[in]itwInterpolation weights from interp_atmfield_gp2itw.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 84 of file special_interp.cc.

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

Referenced by clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), get_ppath_atmvars(), get_ppath_cloudvars(), interp_atmfield_by_gp(), EnergyLevelMap::InterpToGridPos(), and iyIndependentBeamApproximation().

◆ 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 
)

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
[out]itwInterpolation weights.
[in]atmosphere_dimAs the WSV with the same name.
[in]gp_pPressure grid positions.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 58 of file special_interp.cc.

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

Referenced by clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), get_ppath_atmvars(), interp_atmfield_by_gp(), EnergyLevelMap::InterpToGridPos(), and iyIndependentBeamApproximation().

◆ interp_atmsurface_by_gp() [1/2]

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

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.

There is also a vecor version of this function.

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

Definition at line 266 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_field,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

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.

There is also a return version of this function.

Parameters
[out]xValues obtained by the interpolation.
[in]atmosphere_dimAs the WSV with the same name.
[in]x_surfaceThe atmospheric field to be interpolated.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 254 of file special_interp.cc.

References interp_atmsurface_by_itw(), and interp_atmsurface_gp2itw().

Referenced by interp_atmsurface_by_gp(), and InterpSurfaceFieldToPosition().

◆ 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 
)

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
[out]xValues obtained by the interpolation.
[in]atmosphere_dimAs the WSV with the same name.
[in]x_surfaceThe atmospheric field to be interpolated.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
[in]itwInterpolation weights from interp_atmsurface_gp2itw.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 230 of file special_interp.cc.

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

Referenced by interp_atmsurface_by_gp(), and surface_props_interp().

◆ interp_atmsurface_gp2itw()

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

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
[out]itwInterpolation weights.
[in]atmosphere_dimAs the WSV with the same name.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 207 of file special_interp.cc.

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

Referenced by interp_atmsurface_by_gp(), iySurfaceFlatReflectivity(), iySurfaceFlatRefractiveIndex(), iySurfaceLambertian(), SurfaceBlackbody(), SurfaceFastem(), SurfaceFlatScalarReflectivity(), and SurfaceTessem().

◆ interp_cloudfield_gp2itw()

void interp_cloudfield_gp2itw ( VectorView  itw,
GridPos gp_p_out,
GridPos gp_lat_out,
GridPos gp_lon_out,
const GridPos gp_p_in,
const GridPos gp_lat_in,
const GridPos gp_lon_in,
const Index &  atmosphere_dim,
const ArrayOfIndex cloudbox_limits 
)

Converts atmospheric a grid position 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 position 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
[out]itwInterpolation weights. Vector must be given correct size before call of function.
[in]gp_p_outOutput: Pressure cloudbox grid position.
[in]gp_lat_outOutput: Latitude cloudbox grid position.
[in]gp_lon_outOutput: Longitude cloudbox grid position.
[in]gp_p_inPressure grid position.
[in]gp_lat_inLatitude grid position.
[in]gp_lon_inLongitude grid position.
[in]atmosphere_dimAs the WSV with the same name.
[in]cloudbox_limitsAs the WSV with the same name.
Author
Patrick Eriksson
Date
2010-02-12

Definition at line 148 of file special_interp.cc.

References ARTS_ASSERT, gridpos_copy(), gridpos_upperend_check(), GridPos::idx, and interpweights().

Referenced by get_ppath_cloudvars(), and iyIndependentBeamApproximation().

◆ itw2p()

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

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
[out]p_valuesFound pressure values.
[in]p_gridAs the WSV with the same name.
[in]gpAltitude grid positions.
[in]itwInterpolation weights
Author
Patrick Eriksson
Date
2002-11-13

Definition at line 701 of file special_interp.cc.

References ARTS_ASSERT, and interp().

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(), interp_cloud_coeff1D(), iyIndependentBeamApproximation(), and reduced_1datm().

◆ p2gridpos()

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

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]gpGrid 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 742 of file special_interp.cc.

References gridpos().

Referenced by atm_fields_compactAddSpecies(), cloudbox_fieldSetClearsky(), diy_from_path_to_rgrids(), get_gp_atmgrids_to_rq(), get_gp_rq_to_atmgrids(), and pnd_fieldCalcFrompnd_field_raw().

◆ regrid_atmfield_by_gp()

void regrid_atmfield_by_gp ( Tensor3 &  field_new,
const Index &  atmosphere_dim,
ConstTensor3View  field_old,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

Regrids an atmospheric field, for precalculated grid positions.

The function adopts automatically to atmosphere_dim. Grid positions not used are ignored, i.e. gp_lat is ignored for atmosphere_dim=1 etc.

Parameters
[out]field_newField after interpolation.
[in]

in] atmosphere_dim As the WSV with same name.

Parameters
[in]

in] field_old Field to be interpolated.

Parameters
[in]

in] gp_p Pressure grid positions.

Parameters
[in]

in] gp_lat Latitude grid positions.

Parameters
[in]

in] gp_lon Longitude grid positions.

Author
Patrick Eriksson
Date
2015-09-09

Definition at line 293 of file special_interp.cc.

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

Referenced by regrid_atmfield_by_gp_oem().

◆ regrid_atmfield_by_gp_oem()

void regrid_atmfield_by_gp_oem ( Tensor3 &  field_new,
const Index &  atmosphere_dim,
ConstTensor3View  field_old,
const ArrayOfGridPos gp_p,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

Regridding of atmospheric field OEM-type.

In this regridding infinite extrapolation (by closest neighbour) is allowed, including the case of that the grid length in original field can be 1.

Parameters
[out]field_newNew field.
[in]atmosphere_dimAtmospheric dimensionality.
[in]field_oldOriginal field.
[in]gp_pPressure grid positions.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2018-04-12

Definition at line 490 of file special_interp.cc.

References ARTS_ASSERT, interp(), interpweights(), Array< base >::nelem(), and regrid_atmfield_by_gp().

Referenced by AtmFieldPerturb(), and x2artsAtmAndSurf().

◆ regrid_atmsurf_by_gp()

void regrid_atmsurf_by_gp ( Matrix &  field_new,
const Index &  atmosphere_dim,
ConstMatrixView  field_old,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

Regrids an atmospheric surface, for precalculated grid positions.

The function adopts automatically to atmosphere_dim. Grid positions not used are ignored, i.e. gp_lat is ignored for atmosphere_dim=1 etc.

Parameters
[out]field_newField after interpolation.
[in]

in] atmosphere_dim As the WSV with same name.

Parameters
[in]

in] field_old Field to be interpolated.

Parameters
[in]

in] gp_lat Latitude grid positions.

Parameters
[in]

in] gp_lon Longitude grid positions.

Author
Patrick Eriksson
Date
2018-04-12

Definition at line 326 of file special_interp.cc.

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

Referenced by regrid_atmsurf_by_gp_oem().

◆ regrid_atmsurf_by_gp_oem()

void regrid_atmsurf_by_gp_oem ( Matrix &  field_new,
const Index &  atmosphere_dim,
ConstMatrixView  field_old,
const ArrayOfGridPos gp_lat,
const ArrayOfGridPos gp_lon 
)

Regridding of surface field OEM-type.

In this regridding infinite extrapolation (by closest neighbour) is allowed, including the case of that the grid length in original field can be 1.

Parameters
[out]field_newNew field.
[in]atmosphere_dimAtmospheric dimensionality.
[in]field_oldOriginal field.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2018-04-12

Definition at line 641 of file special_interp.cc.

References ARTS_ASSERT, interp(), interpweights(), Array< base >::nelem(), and regrid_atmsurf_by_gp().

Referenced by x2artsAtmAndSurf().

◆ rte_pos2gridpos() [1/2]

void rte_pos2gridpos ( GridPos gp_lat,
GridPos gp_lon,
const Index &  atmosphere_dim,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstVectorView  rte_pos 
)

Converts a geographical position (rte_pos) to grid positions for lat and lon.

(surface version)

The function converts latitude and longitude in rte_pos to matching grid positions. Handles 1D, 2D and 3D (gp_lat and gp_lon untouched if not used).

Note that the function performs several checks of runtime error type.

Parameters
[in]gp_latOutput: Latitude grid position.
[in]gp_lonOutput: Longitude grid position.
[in]atmosphere_dimAs the WSV with the same name.
[in]lat_gridAs the WSV with the same name.
[in]lon_gridAs the WSV with the same name.
[in]rte_posAs the WSV with the same name.
Author
Patrick Eriksson
Date
2018-04-01

Definition at line 808 of file special_interp.cc.

References chk_interpolation_grids(), chk_rte_pos(), and gridpos().

◆ rte_pos2gridpos() [2/2]

void rte_pos2gridpos ( GridPos gp_p,
GridPos gp_lat,
GridPos gp_lon,
const Index &  atmosphere_dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstVectorView  rte_pos 
)

Converts a geographical position (rte_pos) to grid positions for p, lat and lon.

(field version)

The function converts the altitude, latitude and longitude in rte_pos to matching grid positions. The conversion is straightforwatd for latitude and longitude. The altitude shall be converted pressure grid position which requires an interpolation of z_field.

Handles 1D, 2D and 3D (gp_lat and gp_lon untouched if not used).

Note that the function performs several checks of runtime error type.

Parameters
[out]gp_pPressure grid position.
[out]gp_latLatitude grid position.
[out]gp_lonLongitude grid position.
[in]atmosphere_dimAs the WSV with the same name.
[in]p_gridAs the WSV with the same name.
[in]lat_gridAs the WSV with the same name.
[in]lon_gridAs the WSV with the same name.
[in]z_fieldAs the WSV with the same name.
[in]rte_posAs the WSV with the same name.
Author
Patrick Eriksson
Date
2012-06-22

Definition at line 756 of file special_interp.cc.

References chk_interpolation_grids(), chk_rte_pos(), gridpos(), gridpos_1to1(), interp(), and interpweights().

Referenced by InterpAtmFieldToPosition(), iyInterpCloudboxField(), iySurfaceFlatReflectivity(), iySurfaceFlatRefractiveIndex(), iySurfaceLambertian(), ppath_start_stepping(), SurfaceBlackbody(), SurfaceFastem(), SurfaceFlatScalarReflectivity(), and SurfaceTessem().

◆ z_at_lat_2d()

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

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
[out]zFound altitudes.
[in]p_gridAs the WSV with the same name.
[in]lat_gridAs the WSV with the same name.
[in]z_fieldThe pressure and latitude part of the WSV with the same name (that is, the first column).
[in]gp_latLatitude grid position.
Author
Patrick Eriksson
Date
2002-11-18

Definition at line 828 of file special_interp.cc.

References ARTS_ASSERT, gridpos(), gridpos_copy(), interp(), and interpweights().

Referenced by get_refr_index_2d().

◆ 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 
)

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
[in]zOut: Found altitudes.
[in]p_gridAs the WSV with the same name.
[in]lat_gridAs the WSV with the same name.
[in]lon_gridAs the WSV with the same name.
[in]z_fieldAs the WSV with the same name.
[in]gp_latLatitude grid positions.
[in]gp_lonLongitude grid positions.
Author
Patrick Eriksson
Date
2002-12-31

Definition at line 856 of file special_interp.cc.

References ARTS_ASSERT, gridpos(), gridpos_copy(), interp(), and interpweights().

Referenced by get_refr_index_3d().