Helper routine: Initialize linear interpolation coefficients
The routine computes the coefficients for linear interpolation in 1, 2, or 3 dimensions. The computation is done for one observation given the observation coordinates (OC) as well as the coordinates of the grid points (GPC). In GPC each row contains the coordinates for one grid point.
Setup of GPC: The first index is specifies the grid point, while the second the coordinate * For n_dim=X only the first X coordinate values are used * The ordering of the coordinates and coefficient is the following:
(7)------(8)
/| /| with
(5)+-----(6)| - column 1
| | | | / column 2
|(3)-----+(4) | column 3
|/ |/
(1) ---- (2)
thus gpc(1,1)/=gpc(2,1), gpc(1,2)/=gpc(3,2), gpc(1,3)/=gpc(5,3) but gpc(1,1)=gpc(3,1)=gpc(5,1), gpc(1,2)=gpc(2,2)=gpc(5,2), gpc(1,3)=gpc(2,3)=gpc(3,3) * For bi-linear interpolation only the coordinates for grid points 1, 2, and 3 are used to compute the coefficients * For tri-linear interpolation only the coordinates for grid points 1, 2, 3, and 5 are used to compute the coefficients * (for bi-linear interpolation gpc only needs to have length 3 for tri-linear the length 5) * num_gp=2 for n_dim=1; num_gp=4 for n_dim=2; num_gp=8 for n_dim=3 is required
Revision history: * 2019-12 - Lars Nerger - Initial code * Later revisions - see repository log
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | num_gp | |||
integer, | intent(in) | :: | n_dim | |||
real, | intent(in) | :: | gpc(:,:) | |||
real, | intent(in) | :: | oc(:) | |||
real, | intent(inout) | :: | icoeff(:) |