|
FORTRAN integer ier, gdxysval ier = gdxysval(gdid, zvals, zin, x, y, n) integer gdid,n real zout(n), zin(*), x(n), y(n) |
|
C int gdxysval(int gdid, float *zvals, float *zin, float *x, float *y, int n) |
Routine description
|
gdxysval interpolates values, located at points x(1..n), y(1..n), in grid coordinates, from the source field zin. The degree of interpolation is the one currently defined by the last call to ezsetopt (set to cubic (3) by default). |
Description of parameters
|
gdid |
a valid grid identifier (returned by ezqkdef or ezgdef) that will be used as the source (input) grid. |
|
zvals |
Output interpolated values. There is 1:1 relationship with zvals and x/y; that is, interpolated values at point x(1), y(1) is zvals(1). |
|
zin |
Input (source) field. zin is assumed to have the dimensions referred by gdid (the input grid). |
|
x |
Stream of grid positions |
|
y |
Stream of grid positions |
|
n |
Number of points |
?
Sample FORTRAN code :
We want to interpolate data from a GEM grid to selected x-y points. Assume necessary memory space has been allocated.
datev = -1
etiket = ' '
typvar = ' '
nomvar = 'GZ'
ip1 = 500
ip2 = 0
ip3 = -1
iun = 13
*** read fld info and data
key = FSTINF(iun, NI, NJ, NK, datev, etiket, ip1, ip2, ip3, typvar,
$ nomvar)
ier = FSTPRM(key, DATEO, DEET, NPAS, NI, NJ, NK, NBITS, DATYP, IP1,
$ IP2, IP3, TYPVAR, NOMVAR, ETIKET, GRTYP, IG1, IG2, IG3,
$ IG4, SWA, LNG, DLTF, UBC, EX1, EX2, EX3)
ier = FSTLUK(zgem, key, NI, NJ, NK)
*** Define input grid
gdgem = ezqkdef(nigem,njgem ,'Z',ig1, ig2, ig3, ig4, iun)
*** Define x-y values
*** Define latlon values
lat(1) = 45.73
lon(1) = -73.75
lat(2) = 43.40
lon(2) = -79.38
lat(3) = 49.18
lon(3) = -123.18
*** Convert the latlon values to x-y coordinates
ier = gdxyfll(gdgem, x, y, lat, lon, 3)
*** Do scalar interpolation at the x-y points
call gdxysval(gdgem, zval, zgem, x, y, 3)
do i=1,3
print *, i, x(i), y(i), zval(i)
enddo
*** Note: in this example
*** ier = gdxyfll(gdgem, x, y, lat, lon, 3)
*** ier = gdxysval(gdgem, zval, zgem, x, y, 3)
*** is equivalent to
*** ier = gdllsval(gdgem, zval, zgem, lat, lon, 3)
***
Go to the list of functions, or the general index.