Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_GD_INTERPOLATE

# EOS_GD_INTERPOLATE

This function performs bilinear interpolation on a grid field. It assumes that the pixel data values are uniformly spaced which is strictly true only for an infinitesimally small region of the globe but is a good approximation for a sufficiently small region. The default position of the pixel value is pixel center, however if the pixel registration has been set to 1 (with the EOS_GD_DEFPIXREG function) then the value is located at one of the four corners specified by the EOS_GD_DEFORIGIN routine.

All entries along the non-geographic dimensions (i.e., NOT XDim and YDim) are interpolated and all interpolated values are returned as FLOAT64. The reference for the interpolation algorithm is Numerical Recipes in C (2nd ed). (Note for the current version of this routine, the number type of the field to be interpolated is restricted to 22, 24, 5, 6.)

## Examples

To interpolate the Spectra field at two geographic data points:

lonVal[0] = 134.2d

latVal[0] = -20.8d

lonVal[1] = 15.8d

latVal[1] = 84.6d

bufsiz = EOS_GD_INTERPOLATE(gridID, 2, lonVal, latVal, $

"Spectra", interpVal)

## Syntax

Result = EOS_GD_INTERPOLATE(gridID, Interp, lonVal, latVal, fieldname, interpVal)

## Return Value

Returns size in bytes of interpolated data values if successful and FAIL(–1) otherwise.

## Arguments

### gridID

Grid id (long) returned by EOS_GD_CREATE or EOS_GD_ATTACH

### nInterp

Number of interpolation points (long).

### lonVal

Longitude of interpolation points (double array).

### latVal

Latitude of interpolation points (double array).

### fieldname

The field (string) from which to interpolate data values.

### interpVal

A named variable that will contain the (double) interpolated data values.

## Keywords

None

## Version History

5.2 | Introduced