gdllvval

FORTRAN

integer gdllvval, ier
ier = gdllvval(gdid, uuvals, vvals, uuin, vvin, lat, lon, n)
integer gdid, n
float uuvals(n), vvvals(in), uuin(*), vvin(*), lat(n), lon(n)

C

int c_gdllsval(int gdid, float *uuvals, float *vvvals, float *uuin, float *vvin, 
               float *lat, float *lon, int n)

 

Routine description

gdllvval does a bi-dimensional vector interpolation on the values contained in uuin and vvin, themselves defined on grid gdid, at selected lat/lon points. Interpolated values are returned in uuvals and vvvals, in grid coordinates consistent with grid gdid.

Description of parameters

gdid

a valid grid identifier (returned by ezqkdef or ezgdef) that will be used as the source (input) grid.

uuvals, vvals

Output interpolated winds, in grid coordinates based on gdid. There is 1:1 relationship with uuvals,vvals, lat and lon; that is, interpolated values at point lat(1), lon(1) are uuvals(1), vvals(1).

uuin, vvin

Input (source) winds. uuin and vvin are assumed to have the dimensions referred by gdid (the input grid).

lat

Stream of latitude points

lon

Stream of longitude points

n

Number of points

?

Sample FORTRAN code :

We want to interpolate data from a GEM grid to selected lat-lon points. Assume necessary memory space has been allocated.

      datev = -1
      etiket = '        '
      typvar = ' '
      nomuu = 'UU'
      nomvv = 'VV'
      
      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,
     $     nomuu) 
      ier = FSTPRM(uukey, 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(uugem, key, NI, NJ, NK)
      key = FSTINF(iun, NI, NJ, NK, datev, etiket, ip1, ip2, ip3, typvar,
     $     nomvar) 
      ier = FSTPRM(vvkey, 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(vvgem, key, NI, NJ, NK)
      
***   Define input grid         
      
      gdgem = ezqkdef(nigem,njgem ,'Z',ig1, ig2, ig3, ig4, iun)
***   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
***   Do scalar interpolation at the latlon points
      do i=1,3
         print *, i,lat(i),lon(i),zval(i)
      enddo
***   Do vector interpolation, returned values are in x,y coordinates,
***   uval is x-component (east-west) of the wind
***   vval is y-component (north-south) of the wind
      call gdllvval(gdgem, uuvals, vvals, uugem, vvgem, lat, lon, 3)

***   Do vector interpolation, returned values are in wind-speed coordinates.
***   sdval is wind speed.
***   wdval is meteorological wind direction
      call gdllwdval(gdgem, sdvals, wdvals, uugem, vvgem, lat, lon, 3)
      do i=1,3
         print *, lat(i),lon(i), uval(i),vval(i)
         print *, lat(i),lon(i), wdval(i), sdval(i)
         print *
      enddo

Go to the list of functions, or the general index.