ARTS 2.5.0 (git: 9ee3ac6c)
interpolation.cc File Reference

Interpolation routines. More...

#include "interpolation.h"
#include <cmath>
#include <iostream>
#include "array.h"
#include "check_input.h"
#include "logic.h"

Go to the source code of this file.

Macros

#define LOOPIT(x)   for (const Numeric* x = &t##x.fd[1]; x >= &t##x.fd[0]; --x)
 Macro for interpolation weight loops. More...
 

Functions

ostream & operator<< (ostream &os, const GridPos &gp)
 Output operator for GridPos. More...
 
void gridpos (ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
 Set up a grid position Array. More...
 
void gridpos (GridPos &gp, ConstVectorView old_grid, const Numeric &new_grid, const Numeric &extpolfac)
 gridpos More...
 
void gridpos_1to1 (ArrayOfGridPos &gp, ConstVectorView grid)
 gridpos_1to1 More...
 
void gridpos_copy (GridPos &gp_new, const GridPos &gp_old)
 gridpos_copy More...
 
Numeric fractional_gp (const GridPos &gp)
 fractional_gp More...
 
void gridpos_check_fd (GridPos &gp)
 gridpos_check_fd More...
 
void gridpos_force_end_fd (GridPos &gp, const Index &n)
 gridpos_force_end_fd More...
 
void gridpos_upperend_check (GridPos &gp, const Index &ie)
 gridpos_upperend_check More...
 
void gridpos_upperend_check (ArrayOfGridPos &gp, const Index &ie)
 gridpos_upperend_check More...
 
void gp4length1grid (ArrayOfGridPos &gp)
 Grid position matching a grid of length 1. More...
 
bool is_gridpos_at_index_i (const GridPos &gp, const Index &i, const bool &strict)
 is_gridpos_at_index_i More...
 
Index gridpos2gridrange (const GridPos &gp, const bool &upwards)
 gridpos2gridrange More...
 
void interpweights (VectorView itw, const GridPos &tc)
 Red 1D interpolation weights. More...
 
void interpweights (VectorView itw, const GridPos &tr, const GridPos &tc)
 Red 2D interpolation weights. More...
 
void interpweights (VectorView itw, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 3D interpolation weights. More...
 
void interpweights (VectorView itw, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 4D interpolation weights. More...
 
void interpweights (VectorView itw, const GridPos &ts, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 5D interpolation weights. More...
 
void interpweights (VectorView itw, const GridPos &tv, const GridPos &ts, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 6D interpolation weights. More...
 
Numeric interp (ConstVectorView itw, ConstVectorView a, const GridPos &tc)
 Red 1D Interpolate. More...
 
Numeric interp (ConstVectorView itw, ConstMatrixView a, const GridPos &tr, const GridPos &tc)
 Red 2D Interpolate. More...
 
Numeric interp (ConstVectorView itw, ConstTensor3View a, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 3D Interpolate. More...
 
Numeric interp (ConstVectorView itw, ConstTensor4View a, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 4D Interpolate. More...
 
Numeric interp (ConstVectorView itw, ConstTensor5View a, const GridPos &ts, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 5D Interpolate. More...
 
Numeric interp (ConstVectorView itw, ConstTensor6View a, const GridPos &tv, const GridPos &ts, const GridPos &tb, const GridPos &tp, const GridPos &tr, const GridPos &tc)
 Red 6D Interpolate. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &cgp)
 Compute 1D interpolation weights. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 2D interpolation weights for a sequence of positions. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 3D interpolation weights for a sequence of positions. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 4D interpolation weights for a sequence of positions. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 5D interpolation weights for a sequence of positions. More...
 
void interpweights (MatrixView itw, const ArrayOfGridPos &vgp, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 6D interpolation weights for a sequence of positions. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstVectorView a, const ArrayOfGridPos &cgp)
 Interpolate 1D field. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstMatrixView a, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 2D field to a sequence of positions. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstTensor3View a, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 3D field to a sequence of positions. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstTensor4View a, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 4D field to a sequence of positions. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstTensor5View a, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 5D field to a sequence of positions. More...
 
void interp (VectorView ia, ConstMatrixView itw, ConstTensor6View a, const ArrayOfGridPos &vgp, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 6D field to a sequence of positions. More...
 
void interpweights (Tensor3View itw, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 2D interpolation weights for an entire field. More...
 
void interpweights (Tensor4View itw, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 3D interpolation weights for an entire field. More...
 
void interpweights (Tensor5View itw, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 4D interpolation weights for an entire field. More...
 
void interpweights (Tensor6View itw, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 5D interpolation weights for an entire field. More...
 
void interpweights (Tensor7View itw, const ArrayOfGridPos &vgp, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Compute 6D interpolation weights for an entire field. More...
 
void interp (MatrixView ia, ConstTensor3View itw, ConstMatrixView a, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 2D field to another 2D field. More...
 
void interp (Tensor3View ia, ConstTensor4View itw, ConstTensor3View a, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 3D field to another 3D field. More...
 
void interp (Tensor4View ia, ConstTensor5View itw, ConstTensor4View a, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 4D field to another 4D field. More...
 
void interp (Tensor5View ia, ConstTensor6View itw, ConstTensor5View a, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 5D field to another 5D field. More...
 
void interp (Tensor6View ia, ConstTensor7View itw, ConstTensor6View a, const ArrayOfGridPos &vgp, const ArrayOfGridPos &sgp, const ArrayOfGridPos &bgp, const ArrayOfGridPos &pgp, const ArrayOfGridPos &rgp, const ArrayOfGridPos &cgp)
 Interpolate 6D field to another 6D field. More...
 
void polint (Numeric &y_int, Numeric &dy_int, ConstVectorView xa, ConstVectorView ya, const Index &n, const Numeric &x)
 Polynomial interpolation. More...
 
Numeric interp_poly (ConstVectorView x, ConstVectorView y, const Numeric &x_i, const GridPos &gp)
 Polynomial interpolation. More...
 

Variables

const Numeric FD_TOL = 1.5e-3
 The maximum difference from 1 that we allow for a sum check. More...
 

Detailed Description

Interpolation routines.

Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

There are no general single-step interpolation functions in ARTS. Rather, there are a set of useful utility functions that can be used to achieve interpolation. Roughly, you can separate these into functions determining grid-position Arrays, functions determining interpolation weight Tensors, and functions applying the interpolation.

Doing an interpolation requires a chain of function calls:

  1. gridpos (one for each interpolation dimension)
  2. interpweights
  3. interp

Definition in file interpolation.cc.

Macro Definition Documentation

◆ LOOPIT

#define LOOPIT (   x)    for (const Numeric* x = &t##x.fd[1]; x >= &t##x.fd[0]; --x)

Macro for interpolation weight loops.

We use the macro LOOPIT to make the notation for the nested for loops in the interpweights functions more concise, and to avoid typing errors.

Should resolve to something like:

for ( const Numeric* p=&tp.fd[1]; p>=&tp.fd[0]; –p )

Definition at line 85 of file interpolation.cc.

Function Documentation

◆ fractional_gp()

Numeric fractional_gp ( const GridPos gp)

fractional_gp

Returns the complete fractional grid position.

The fractional grid position is the sum of grid index and fraction distance, and is not an integer value.

Returns
Fractional grid position.
Parameters
gpInput: Grid position structure.
Author
Patrick Eriksson
Date
2004-09-28

Definition at line 492 of file interpolation.cc.

References GridPos::fd, and GridPos::idx.

Referenced by is_gp_inside_cloudbox(), iyInterpCloudboxField(), mcPathTraceRadar(), ppath_calc(), and ppath_start_stepping().

◆ gp4length1grid()

void gp4length1grid ( ArrayOfGridPos gp)

Grid position matching a grid of length 1.

The function sets gp to the expected values if there would exist a grid of length 1.

Grids of length 1 are normally not allowed, but the jacobian part makes use of such grids to flag a completely flat field in the diemsnion of concern.

Parameters
[in/out]gp A grid positions.
Author
Patrick Eriksson
Date
2015-09-10

Definition at line 636 of file interpolation.cc.

References Array< base >::nelem().

Referenced by diy_from_path_to_rgrids(), diy_from_pos_to_rgrids(), get_gp_rq_to_atmgrids(), and SurfaceFlatScalarReflectivity().

◆ gridpos() [1/2]

void gridpos ( ArrayOfGridPos gp,
ConstVectorView  old_grid,
ConstVectorView  new_grid,
const Numeric extpolfac 
)

Set up a grid position Array.

This is the function to find the position in the original grid and set the fd for the linear interpolation case.

The old grid has to be strictly sorted. It can be in ascending or descending order. But there must not be any duplicate values. Furthermore, the old grid must contain at least two points.

The new grid doesn't have to be sorted, but the function will be faster if it is sorted or mostly sorted. It is ok if the new grid contains only 1 point.

The beauty is, that this is all it needs to do also interpolation in higher dimensions: You just have to call gridpos for all the dimensions that you want to interpolate.

Note also, that for this step you do not need the field itself at all!

The new grid has basically to be inside the range covered by old grid, but some margins are given for practical reasons. For higher flexibility, a selectable extrapolation is allowed. The allowed extrapolation is given in fractions of the distance between the lowermost two points for extrapolation beyond the lower grid limit and the distance between the uppermost two points for extrapolation beyond the upper grid limit, respectively. For example, if extpolfac is set to 0.5 an extrapolation of half the distance between two outermost points at the respective edge of the grid is allowed. In this case, if the old grid is given as [0, 1, ... , 3, 3.4] the new grid can be extended down to -0.5 and up to 3.6.

0.5 is the default value for extpolfac. Normally, you should just use the function with 3 arguments, which means that the default value will be used.

If a new grid point is exactly on top of an original grid point, then the returned gp.idx is guaranteed to point exactly at this point, so that gp.fd[0] = 0. The only exception from this rule is if the point happens to be the last point in the original grid. In that case gp.idx will point to the original grid point below.

Furthermore, you are guaranteed that for the ascending old grid case: old_grid[tgp.idx]<=tng || tgp.idx==0 And for the descending old grid case: old_grid[tgp.idx]>=tng || tgp.idx==0

Return values
gpGrid position Array.
Parameters
old_gridThe original grid.
new_gridThe new grid where we want to have the interpolated values.
extpolfacExtrapolation factor. Has a default value of 0.5. You should normally not specify this parameter!
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 156 of file interpolation.cc.

References ARTS_ASSERT, GridPos::fd, GridPos::idx, is_decreasing(), is_increasing(), is_size(), and ConstVectorView::nelem().

Referenced by abs_lookupSetup(), abs_vecTransform(), antenna1d_matrix(), antenna2d_interp_response(), AntennaConstantGaussian1D(), atm_fields_compactAddSpecies(), cloud_ppath_update3D(), cloudbox_field_monoOptimizeReverse(), cloudbox_fieldSetClearsky(), complex_n_interp(), defocusing_general_sub(), diy_from_path_to_rgrids(), diy_from_pos_to_rgrids(), doit_scat_fieldCalcLimb(), ext_matTransform(), FouComp_1ScatElem(), get_gp_atmgrids_to_rq(), get_gp_atmsurf_to_rq(), get_gp_rq_to_atmgrids(), get_refr_index_1d(), get_refr_index_2d(), get_refr_index_3d(), gridpos(), interp_cloud_coeff1D(), InterpGriddedField2ToPosition(), interpolate_scat_angle(), InterpSurfaceFieldToPosition(), jacobianCalcPointingZaInterp(), opt_prop_1ScatElem(), opt_prop_sptFromData(), opt_prop_sptFromMonoData(), opt_prop_sptFromScat_data(), p2gridpos(), particle_bulkpropRadarOnionPeeling(), pha_mat_1ScatElem(), pha_mat_sptFromData(), pha_mat_sptFromDataDOITOpt(), pha_mat_sptFromMonoData(), pha_mat_sptFromScat_data(), pha_matTransform(), pnd_fieldCalcFrompnd_field_raw(), pos2refell_r(), pos2true_latlon(), ppath_calc(), ppath_start_3d(), ppath_start_stepping(), rte_pos2gridpos(), ScatSpeciesMerge(), specular_losCalc(), surf_radius_at_l(), surface_complex_refr_indexFromGriddedField5(), surface_reflectivityFromGriddedField6(), surface_scalar_reflectivityFromGriddedField4(), surface_typeInterpTypeMask(), SurfaceFlatScalarReflectivity(), test01(), test04(), test05(), test06(), test09(), z_at_lat_2d(), z_at_latlon(), and za_gridOpt().

◆ gridpos() [2/2]

void gridpos ( GridPos gp,
ConstVectorView  old_grid,
const Numeric new_grid,
const Numeric extpolfac 
)

gridpos

Creates a grid position structure.

This is a gateway to the function for arrays of grid positions, to be used for e.g. "red interpolation".

Return values
gpThe GridPos structure.
Parameters
old_gridThe original grid.
new_gridThe position where we want to have the interpolated value.
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
2002-12-31
Author
Stefan Buehler
Date
2008-03-03

Definition at line 424 of file interpolation.cc.

References gridpos(), gridpos_copy(), and v.

◆ gridpos2gridrange()

Index gridpos2gridrange ( const GridPos gp,
const bool &  upwards 
)

gridpos2gridrange

Determines which grid range that is of interest for a given grid position.

The purpose of the function is to determine which two grid values that surround the given point. The index of the lower grid value is returned.

For a point exactly on a grid value it is not clear if it is the range below or above that is of interest. The input argument upward is used to resolve such cases, where upward == 1 means that it is the range above that is of interest.

Parameters
gpGrid position structure.
upwardsDirection of interest, see above.
Returns
The index of the lower end of the grid range.
Author
Patrick Eriksson
Date
2002-05-20

Definition at line 697 of file interpolation.cc.

References ARTS_ASSERT, GridPos::fd, and GridPos::idx.

Referenced by plevel_slope_2d(), plevel_slope_3d(), ppath_start_1d(), ppath_start_2d(), and ppath_start_3d().

◆ gridpos_1to1()

void gridpos_1to1 ( ArrayOfGridPos gp,
ConstVectorView  grid 
)

gridpos_1to1

Creates a position array for a 1-to-1 mapping.

This function treats interpolaton back to the same grid. The function matches: gridpos( gp, grid, grid ), but is faster.

The function gives gp correct size.

Return values
gpArray of GridPos structure.
Parameters
old_gridThe grid.
Author
Patrick Eriksson
Date
2012-06-22

Definition at line 449 of file interpolation.cc.

References ConstVectorView::nelem().

Referenced by rte_pos2gridpos().

◆ gridpos_check_fd()

void gridpos_check_fd ( GridPos gp)

gridpos_check_fd

Checks that the fractional distances have a value in the range [0,1].

This function can be used when you are sure that the fractional distances have been calculated correctly, but the limited numerical precision can give values below 0 or above 1.

Return values
gpGrid position structure.
Author
Patrick Eriksson
Date
2002-05-21

Definition at line 509 of file interpolation.cc.

References ARTS_ASSERT, GridPos::fd, and FD_TOL.

Referenced by ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), and ppath_start_stepping().

◆ gridpos_copy()

void gridpos_copy ( GridPos gp_new,
const GridPos gp_old 
)

gridpos_copy

Copies the content of a GridPos structure.

Return values
gp_newThe GridPos structure to be filled.
Parameters
gp_oldThe GridPos structure to be copied.
Author
Patrick Eriksson
Date
2002-09-17

Definition at line 473 of file interpolation.cc.

References GridPos::fd, and GridPos::idx.

Referenced by get_ppath_cloudvars(), get_stepwise_scattersky_source(), gridpos(), interp_atmfield_by_gp(), interp_atmsurface_by_gp(), interp_cloudfield_gp2itw(), pha_mat_sptFromMonoData(), ppath_append(), ppath_copy(), ppath_start_stepping(), ppathFromRtePos2(), z_at_lat_2d(), and z_at_latlon().

◆ gridpos_force_end_fd()

void gridpos_force_end_fd ( GridPos gp,
const Index n 
)

gridpos_force_end_fd

Forces that the fractional distances is set to OK with respect to interpolation.

This function can be called when it is known that a position is exactly on a grid point. The fractional distance of the grid position is then 0 or 1, but rounding errors can give a slightly deviating value.

The fractional distance is set to 0, beside for end point of the complete grid range where is set to 1.

The difference between this function and gridpos_check_fd is that this function is only applicable for end points, while the other function can be called for every point.

Return values
gpGrid position structure.
Parameters
nNumber of points of the grid.
Author
Patrick Eriksson
Date
2002-05-22

Definition at line 555 of file interpolation.cc.

References ARTS_ASSERT, GridPos::fd, and GridPos::idx.

Referenced by ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), and ppath_start_2d().

◆ gridpos_upperend_check() [1/2]

void gridpos_upperend_check ( ArrayOfGridPos gp,
const Index ie 
)

gridpos_upperend_check

A function to handle the upper end after shifts of grid positions

The function ensures that a shift of grid positions not results in a too high gp.idx. That happens for positions exactly at the upper cloudbox boundaries.

Return values
gpArray of grid position structure.
Parameters
ieIndex of upper limit, shifted
Author
Patrick Eriksson
Date
2011-02-28

Definition at line 612 of file interpolation.cc.

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

◆ gridpos_upperend_check() [2/2]

void gridpos_upperend_check ( GridPos gp,
const Index ie 
)

gridpos_upperend_check

A function to handle the upper end after shifts of grid positions

The function ensures that a shift of grid positions not results in a too high gp.idx. That happens for positions exactly at the upper cloudbox boundaries.

Return values
gpGrid position structure.
Parameters
ieIndex of upper limit, shifted
Author
Patrick Eriksson
Date
2010-11-18

Definition at line 589 of file interpolation.cc.

References ARTS_ASSERT, GridPos::fd, and GridPos::idx.

Referenced by cloud_atm_vars_by_gp(), cloud_ppath_update3D(), interp_cloud_coeff1D(), interp_cloudfield_gp2itw(), and iyInterpCloudboxField().

◆ interp() [1/17]

Numeric interp ( ConstVectorView  itw,
ConstMatrixView  a,
const GridPos tr,
const GridPos tc 
)

Red 2D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 1007 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), and ConstVectorView::sum().

◆ interp() [2/17]

Numeric interp ( ConstVectorView  itw,
ConstTensor3View  a,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 3D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 1049 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), and ConstVectorView::sum().

◆ interp() [3/17]

Numeric interp ( ConstVectorView  itw,
ConstTensor4View  a,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 4D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 1094 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), and ConstVectorView::sum().

◆ interp() [4/17]

Numeric interp ( ConstVectorView  itw,
ConstTensor5View  a,
const GridPos ts,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 5D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
tsThe grid position for the shelf dimension.
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 1143 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), and ConstVectorView::sum().

◆ interp() [5/17]

Numeric interp ( ConstVectorView  itw,
ConstTensor6View  a,
const GridPos tv,
const GridPos ts,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 6D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
tvThe grid position for the vitrine dimension.
tsThe grid position for the shelf dimension.
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 1199 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), ConstVectorView::sum(), and v.

◆ interp() [6/17]

Numeric interp ( ConstVectorView  itw,
ConstVectorView  a,
const GridPos tc 
)

Red 1D Interpolate.

"Red" interpolation returns just a scalar.

The dimension of itw must be consistent with the dimension of the interpolation (2^n).

Parameters
itwInterpolation weights.
aThe field to interpolate.
tcThe grid position for the column dimension.
Returns
Interpolated value.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 970 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstVectorView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), and ConstVectorView::sum().

Referenced by abs_lookupSetup(), abs_vecTransform(), antenna1d_matrix(), antenna2d_interp_response(), AntennaConstantGaussian1D(), atm_fields_compactAddSpecies(), cloud_ppath_update3D(), cloudbox_field_monoOptimizeReverse(), cloudbox_fieldSetClearsky(), complex_n_interp(), defocusing_general_sub(), doit_scat_fieldCalcLimb(), ext_matTransform(), FouComp_1ScatElem(), get_refr_index_1d(), get_refr_index_2d(), get_refr_index_3d(), get_stepwise_scattersky_source(), interp_atmfield_by_itw(), interp_atmsurface_by_itw(), interp_cloud_coeff1D(), InterpGriddedField2ToPosition(), interpolate_scat_angle(), itw2p(), iyIndependentBeamApproximation(), iyInterpCloudboxField(), jacobianCalcPointingZaInterp(), opt_prop_1ScatElem(), opt_prop_sptFromData(), opt_prop_sptFromMonoData(), opt_prop_sptFromScat_data(), particle_bulkpropRadarOnionPeeling(), pha_mat_1ScatElem(), pha_mat_sptFromData(), pha_mat_sptFromDataDOITOpt(), pha_mat_sptFromMonoData(), pha_mat_sptFromScat_data(), pha_matTransform(), plevel_slope_3d(), pnd_fieldCalcFrompnd_field_raw(), pos2true_latlon(), ppath_start_stepping(), regrid_atmfield_by_gp(), regrid_atmfield_by_gp_oem(), regrid_atmsurf_by_gp(), regrid_atmsurf_by_gp_oem(), rte_pos2gridpos(), scat_dataReduceT(), ScatSpeciesMerge(), specular_losCalc(), surf_radius_at_l(), surface_complex_refr_indexFromGriddedField5(), surface_reflectivityFromGriddedField6(), surface_scalar_reflectivityFromGriddedField4(), SurfaceFlatScalarReflectivity(), test01(), test04(), test05(), test06(), test09(), test12(), test17(), test18(), test19(), test20(), test21(), test22(), test23(), test25(), test26(), z_at_lat_2d(), z_at_latlon(), and za_gridOpt().

◆ interp() [7/17]

void interp ( MatrixView  ia,
ConstTensor3View  itw,
ConstMatrixView  a,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 2D field to another 2D field.

This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.

The size of ia and itw in all dimensions must be consistent with the grid position Arrays.

Return values
iaInterpolated field.
Parameters
itwInterpolation weights.
aThe field to interpolate.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2338 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstTensor3View::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [8/17]

void interp ( Tensor3View  ia,
ConstTensor4View  itw,
ConstTensor3View  a,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 3D field to another 3D field.

This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.

The size of ia and itw in all dimensions must be consistent with the grid position Arrays.

Return values
iaInterpolated field.
Parameters
itwInterpolation weights.
aThe field to interpolate.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2404 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstTensor4View::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [9/17]

void interp ( Tensor4View  ia,
ConstTensor5View  itw,
ConstTensor4View  a,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 4D field to another 4D field.

This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.

The size of ia and itw in all dimensions must be consistent with the grid position Arrays.

Return values
iaInterpolated field.
Parameters
itwInterpolation weights.
aThe field to interpolate.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2476 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstTensor5View::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [10/17]

void interp ( Tensor5View  ia,
ConstTensor6View  itw,
ConstTensor5View  a,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 5D field to another 5D field.

This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.

The size of ia and itw in all dimensions must be consistent with the grid position Arrays.

Return values
iaInterpolated field.
Parameters
itwInterpolation weights.
aThe field to interpolate.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2552 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstTensor6View::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), ns, and Zeeman::sum().

◆ interp() [11/17]

void interp ( Tensor6View  ia,
ConstTensor7View  itw,
ConstTensor6View  a,
const ArrayOfGridPos vgp,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 6D field to another 6D field.

This performs a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

This function can be easily distinguished from the other interpolation function (that creates a sequence of interpolated values), because of the dimension of ia and itw.

The size of ia and itw in all dimensions must be consistent with the grid position Arrays.

Return values
iaInterpolated field.
Parameters
itwInterpolation weights.
aThe field to interpolate.
vgpThe grid position Array for the vitrine dimension.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2639 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstTensor7View::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), ns, Zeeman::sum(), and v.

◆ interp() [12/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstMatrixView  a,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 2D field to a sequence of positions.

This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The output vector ia also must have the same length. And the dimension of itw must be consistent with this.

This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1660 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [13/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstTensor3View  a,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 3D field to a sequence of positions.

This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The output vector ia also must have the same length. And the dimension of itw must be consistent with this.

This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1720 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [14/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstTensor4View  a,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 4D field to a sequence of positions.

This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The output vector ia also must have the same length. And the dimension of itw must be consistent with this.

This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1785 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [15/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstTensor5View  a,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 5D field to a sequence of positions.

This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The output vector ia also must have the same length. And the dimension of itw must be consistent with this.

This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1856 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp() [16/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstTensor6View  a,
const ArrayOfGridPos vgp,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Interpolate 6D field to a sequence of positions.

This performs a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The output vector ia also must have the same length. And the dimension of itw must be consistent with this.

This function can be easily distinguished from the other interpolation function (that creates an entire field of interpolated values), because of the dimension of ia and itw.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
vgpThe grid position Array for the vitrine dimension.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1936 of file interpolation.cc.

References a, ARTS_ASSERT, b, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), Zeeman::sum(), and v.

◆ interp() [17/17]

void interp ( VectorView  ia,
ConstMatrixView  itw,
ConstVectorView  a,
const ArrayOfGridPos cgp 
)

Interpolate 1D field.

For this 1D case there is no distinction between "blue" and "green" type interpolation.

The output vector ia must have the same length as the grid position vector cgp. And the dimension of itw must be consistent with this.

Return values
iaVector containing the interpolated field values.
Parameters
itwInterpolation weights.
aThe field to interpolate.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1604 of file interpolation.cc.

References a, ARTS_ASSERT, c, ConstMatrixView::get(), GridPos::idx, is_same_within_epsilon(), is_size(), joker, Array< base >::nelem(), and Zeeman::sum().

◆ interp_poly()

Numeric interp_poly ( ConstVectorView  x,
ConstVectorView  y,
const Numeric x_i,
const GridPos gp 
)

Polynomial interpolation.

This function performs a polynomial interpolation. Given two vectors x, y the value of y corresponding to x_i is returned. The function uses the common gridpositions (which are also used for linear interpolation).

Parameters
xoriginal grid
yvalues corresponding to x-values
x_ia value x, for which the corresponding y value is requested
gpgrid position of x_i in relation to x
Returns
interpolated value
Author
Claudia Emde
Date
2004-03-17

Definition at line 2787 of file interpolation.cc.

References ARTS_ASSERT, arts_exit(), GridPos::fd, GridPos::idx, ConstVectorView::nelem(), and polint().

Referenced by doit_scat_fieldCalcLimb(), interp_cloud_coeff1D(), and za_gridOpt().

◆ interpweights() [1/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 4D interpolation weights for a sequence of positions.

Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The dimensions of itw must be also consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.

Return values
itwInterpolation weights.
Parameters
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1431 of file interpolation.cc.

References ARTS_ASSERT, b, c, MatrixView::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [2/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos cgp 
)

Compute 1D interpolation weights.

For this 1D case there is no distinction between "blue" and "green" type interpolation.

The dimensions of itw must be consistent with cgp.

Note that we still do not need the actual field for this step.

Return values
itwInterpolation weights.
Parameters
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1257 of file interpolation.cc.

References ARTS_ASSERT, c, MatrixView::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [3/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 3D interpolation weights for a sequence of positions.

Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The dimensions of itw must be also consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.

Return values
itwInterpolation weights.
Parameters
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1380 of file interpolation.cc.

References ARTS_ASSERT, c, MatrixView::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [4/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 2D interpolation weights for a sequence of positions.

Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The dimensions of itw must be also consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.

Return values
itwInterpolation weights.
Parameters
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1326 of file interpolation.cc.

References ARTS_ASSERT, c, MatrixView::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [5/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 5D interpolation weights for a sequence of positions.

Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The dimensions of itw must be also consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.

Return values
itwInterpolation weights.
Parameters
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1487 of file interpolation.cc.

References ARTS_ASSERT, b, c, MatrixView::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [6/17]

void interpweights ( MatrixView  itw,
const ArrayOfGridPos vgp,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 6D interpolation weights for a sequence of positions.

Compute the weights for a "blue" type interpolation of the field, that means that the grid position Arrays are interpreted as defining a sequence of positions. ALL GRID POSITION ARRAYS MUST HAVE THE SAME LENGTH!

The dimensions of itw must be also consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Matrix, whereas in the other case it is a Tensor with one more dimension than there are input grid position Arrays.

Return values
itwInterpolation weights.
Parameters
vgpThe grid position Array for the vitrine dimension.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 1548 of file interpolation.cc.

References ARTS_ASSERT, b, c, MatrixView::get(), is_size(), LOOPIT, Array< base >::nelem(), and v.

◆ interpweights() [7/17]

void interpweights ( Tensor3View  itw,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 2D interpolation weights for an entire field.

Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

The dimensions of itw must be consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.

Return values
itwInterpolation weights
Parameters
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2021 of file interpolation.cc.

References ARTS_ASSERT, c, Tensor3View::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [8/17]

void interpweights ( Tensor4View  itw,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 3D interpolation weights for an entire field.

Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

The dimensions of itw must be consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.

Return values
itwInterpolation weights
Parameters
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2079 of file interpolation.cc.

References ARTS_ASSERT, c, Tensor4View::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [9/17]

void interpweights ( Tensor5View  itw,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 4D interpolation weights for an entire field.

Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

The dimensions of itw must be consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.

Return values
itwInterpolation weights
Parameters
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2134 of file interpolation.cc.

References ARTS_ASSERT, b, c, Tensor5View::get(), is_size(), LOOPIT, and Array< base >::nelem().

◆ interpweights() [10/17]

void interpweights ( Tensor6View  itw,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 5D interpolation weights for an entire field.

Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

The dimensions of itw must be consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.

Return values
itwInterpolation weights
Parameters
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2196 of file interpolation.cc.

References ARTS_ASSERT, b, c, Tensor6View::get(), is_size(), LOOPIT, Array< base >::nelem(), and ns.

◆ interpweights() [11/17]

void interpweights ( Tensor7View  itw,
const ArrayOfGridPos vgp,
const ArrayOfGridPos sgp,
const ArrayOfGridPos bgp,
const ArrayOfGridPos pgp,
const ArrayOfGridPos rgp,
const ArrayOfGridPos cgp 
)

Compute 6D interpolation weights for an entire field.

Compute the weights for a "green" type interpolation of the field, that means that the grid position Arrays are interpreted as defining the grids for the interpolated field.

The dimensions of itw must be consistent with this.

Note that we still do not need the actual field for this step.

This function can be easily distinguished from the other interpweights function (for "green" interpolation), because the output is a Tensor with one more dimension than the number of grid position Arrays.

Return values
itwInterpolation weights
Parameters
vgpThe grid position Array for the vitrine dimension.
sgpThe grid position Array for the shelf dimension.
bgpThe grid position Array for the book dimension.
pgpThe grid position Array for the page dimension.
rgpThe grid position Array for the row dimension.
cgpThe grid position Array for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri May 3 08:55:51 2002

Definition at line 2266 of file interpolation.cc.

References ARTS_ASSERT, b, c, Tensor7View::get(), is_size(), LOOPIT, Array< base >::nelem(), ns, and v.

◆ interpweights() [12/17]

void interpweights ( VectorView  itw,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 4D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 857 of file interpolation.cc.

References ARTS_ASSERT, b, c, VectorView::get(), is_size(), and LOOPIT.

◆ interpweights() [13/17]

void interpweights ( VectorView  itw,
const GridPos tc 
)

Red 1D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 741 of file interpolation.cc.

References ARTS_ASSERT, c, VectorView::get(), is_size(), and LOOPIT.

Referenced by abs_lookupSetup(), abs_vecTransform(), antenna1d_matrix(), antenna2d_interp_response(), AntennaConstantGaussian1D(), atm_fields_compactAddSpecies(), AtmFieldPRegridHelper(), clear_rt_vars_at_gp(), cloud_atm_vars_by_gp(), cloud_ppath_update3D(), cloudbox_field_monoOptimizeReverse(), cloudbox_fieldSetClearsky(), complex_n_interp(), defocusing_general_sub(), doit_scat_fieldCalcLimb(), ext_matTransform(), GasAbsLookup::Extract(), XsecRecord::Extract(), FouComp_1ScatElem(), get_ppath_atmvars(), get_refr_index_1d(), get_refr_index_2d(), get_refr_index_3d(), get_stepwise_scattersky_source(), GriddedFieldLatLonRegridHelper(), GriddedFieldPRegridHelper(), GriddedFieldZToPRegridHelper(), interp_atmfield_gp2itw(), interp_atmsurface_gp2itw(), interp_cloud_coeff1D(), interp_cloudfield_gp2itw(), InterpGriddedField2ToPosition(), interpolate_scat_angle(), iyInterpCloudboxField(), jacobianCalcFreqShift(), jacobianCalcFreqStretch(), jacobianCalcPointingZaInterp(), MagFieldsCalc(), MagFieldsFromAltitudeRawCalc(), opt_prop_1ScatElem(), opt_prop_sptFromData(), opt_prop_sptFromMonoData(), opt_prop_sptFromScat_data(), particle_bulkpropRadarOnionPeeling(), pha_mat_1ScatElem(), pha_mat_sptFromData(), pha_mat_sptFromDataDOITOpt(), pha_mat_sptFromMonoData(), pha_mat_sptFromScat_data(), pha_matTransform(), plevel_slope_3d(), pnd_fieldCalcFrompnd_field_raw(), pos2true_latlon(), ppath_start_stepping(), regrid_atmfield_by_gp(), regrid_atmfield_by_gp_oem(), regrid_atmsurf_by_gp(), regrid_atmsurf_by_gp_oem(), rte_pos2gridpos(), scat_dataCalc(), scat_dataReduceT(), ScatSpeciesMerge(), specular_losCalc(), surf_radius_at_l(), surface_complex_refr_indexFromGriddedField5(), surface_reflectivityFromGriddedField6(), surface_scalar_reflectivityFromGriddedField4(), surface_typeInterpTypeMask(), SurfaceFlatScalarReflectivity(), test01(), test04(), test05(), test06(), test09(), test11(), test12(), test14(), test17(), test18(), test19(), test20(), test21(), test22(), test23(), test25(), test26(), WindFieldsCalc(), z_at_lat_2d(), z_at_latlon(), and za_gridOpt().

◆ interpweights() [14/17]

void interpweights ( VectorView  itw,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 3D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 824 of file interpolation.cc.

References ARTS_ASSERT, c, VectorView::get(), is_size(), and LOOPIT.

◆ interpweights() [15/17]

void interpweights ( VectorView  itw,
const GridPos tr,
const GridPos tc 
)

Red 2D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 796 of file interpolation.cc.

References ARTS_ASSERT, c, VectorView::get(), is_size(), and LOOPIT.

◆ interpweights() [16/17]

void interpweights ( VectorView  itw,
const GridPos ts,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 5D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
tsThe grid position for the shelf dimension.
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 893 of file interpolation.cc.

References ARTS_ASSERT, b, c, VectorView::get(), is_size(), and LOOPIT.

◆ interpweights() [17/17]

void interpweights ( VectorView  itw,
const GridPos tv,
const GridPos ts,
const GridPos tb,
const GridPos tp,
const GridPos tr,
const GridPos tc 
)

Red 6D interpolation weights.

"Red" interpolation returns just a scalar, so the weights are stored in a Vector.

The length of itw must be consistent with the dimension of the field to be interpolated (2^n).

Return values
itwInterpolation weights.
Parameters
tvThe grid position for the vitrine dimension.
tsThe grid position for the shelf dimension.
tbThe grid position for the book dimension.
tpThe grid position for the page dimension.
trThe grid position for the row dimension.
tcThe grid position for the column dimension.
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Fri Jun 28 10:53:32 2002

Definition at line 932 of file interpolation.cc.

References ARTS_ASSERT, b, c, VectorView::get(), is_size(), LOOPIT, and v.

◆ is_gridpos_at_index_i()

bool is_gridpos_at_index_i ( const GridPos gp,
const Index i,
const bool &  strict 
)

is_gridpos_at_index_i

Determines if a grid position is at a given grid index.

Returns
True if at index i, else false.
Parameters
gpGrid position structure.
iThe grid index of interest.
strictIf true, fractional distances are demanded to be exactly 0 or 1. Otherwise FD_TOL is considered.
Author
Patrick Eriksson
Date
2002-05-22

Definition at line 657 of file interpolation.cc.

References GridPos::fd, FD_TOL, and GridPos::idx.

Referenced by iyInterpCloudboxField(), ppath_calc(), ppath_start_2d(), and ppath_start_3d().

◆ operator<<()

ostream & operator<< ( ostream &  os,
const GridPos gp 
)

Output operator for GridPos.

This is just intended for testing and debugging.

Parameters
osOutput stream.
gpGrid position.
Returns
The output stream.

Definition at line 96 of file interpolation.cc.

References GridPos::fd, and GridPos::idx.

◆ polint()

void polint ( Numeric y_int,
Numeric dy_int,
ConstVectorView  xa,
ConstVectorView  ya,
const Index n,
const Numeric x 
)

Polynomial interpolation.

This function performs a polinomial interpolation. Given arrays xa(n) and ya(n), and a given value x, this function returns a value y and an error estimate dy. This function is (almost) copied from: Numerical Recipies in C, pages 108-110.

Parameters
y_intinterpolated value
dy_interror estimate
xaoriginal grid (n elements)
yacorresponding values (n elements)
norder of polynom
xrequested grid point
Returns
interpolated value
Author
Claudia Emde
Date
2004-03-12

Definition at line 2728 of file interpolation.cc.

References abs, ARTS_ASSERT, c, d, ns, and w.

Referenced by interp_poly().

Variable Documentation

◆ FD_TOL

const Numeric FD_TOL = 1.5e-3

The maximum difference from 1 that we allow for a sum check.

The sum check makes sure that the sum of all weights is approximately 1.

We cannot use a sharp comparison there, due to numerical noise. The value of 1e-6 is an ad-hoc value.

This shold be ok, the main point of the test is to make sure that what we have really are interpolation weights, and not something else. Allowed tolerance for fractional distance values

Fractional distances are not allowed to be negative or exceed 1 above the set tolerance. Values deviating less than the tolerance from 0 and 1 will be treated as end points, if such a check is performed.

We cannot use a sharp comparison there, due to numerical noise. The value of 1e-3 is an ad-hoc value.

Definition at line 73 of file interpolation.cc.

Referenced by gridpos_check_fd(), and is_gridpos_at_index_i().