IGSCINT |
Interpolation routines |
IGSCINT |
IGSCINT - Scalar interpolation routine of cartesian irregular grids
integer li, lj | Destination grid dimension |
real ZOUT(li,lj) | Destination field |
real xlat(li,lj) | Latitudes of grid points on destination grid |
real xlon(li,lj) | Longitudes of grid points on destination grid |
integer ni, nj | Source grid dimension |
real zin(ni,nj) | Source field |
character*1 grtyp | Type of the source grid ('Z'-only allowed value) |
character*1 grref | Type of Reference grid ('A','B','E','G','L','N','S') |
integer ig1ref, ig2ref, ig3ref, ig4ref | Grid parameters of the reference grid |
logical sym |
Logical flag indicating if the field is treated treated symetrically or antisymetrically on the other hemisphere. if .true., the field is processed symetrically if .false., the field is processed antisymetrically This flag is used only on 'A', 'B' and 'G'grids; it is used to extend hemispherical grids when points ont the target grid lie outside the source grid. |
real ax(ni),ay(nj) |
Vector of coordinates describing the deformation of the Z grid w/r to the target grid. In RPN standard files, "ax" is normally contained in ">>" records, and "ay" in "^^" records. |
This routine interpolates on a (li,lj) grid the values contained in an irregular cartesian (ni,nj) grid. Lat-lon coordinates of the points (in degrees) have to be provided in the fields xlat(li,lj) and xlon(li,lj)
The interpolation method is one of bicubic lagrangian, bilinear or nearest neighbor. The default method is bicubic; it can be set to the other methods by a call to the "rgoptc" or "rgoptr" routines. A call to the same routines can also set the way the package handles extrapolation.
Suppose we have a standard file with the following configuration: Fields on a Z grid referenced on a latlon grid.
------ -- -- ---- ---- ---- ----- ---- ---- ---- ---- NOMVAR NI NJ IP1 IP2 IP3 GRTYP IG1 IG2 IG3 IG4 ------ -- -- ---- ---- ---- ----- ---- ---- ---- ---- ^^ 50 10 1001 1002 1003 L 100 100 9000 0 >> 50 10 1001 1002 1003 L 100 100 9000 0 GZ 50 10 1000 12 0 Z 1001 1002 1003 0 TT 50 10 1000 12 0 Z 1001 1002 1003 0 ES 50 10 1000 12 0 Z 1001 1002 1003 0 ------ -- -- ---- ---- ---- ----- ---- ---- ---- ---- The following figure shows the link between data records and positional records. NOMVAR NI NJ IP1 IP2 IP3 GRTYP IG1 IG2 IG3 IG4 ------ -- -- ---- ---- ---- ----- ---- ---- ---- ---- -------------------- ^^ 50 10 | 1001 1002 1003 | L 100 100 9000 0 >> 50 10 | 1001 1002 1003 | L 100 100 9000 0 -------------------- | ---------------------------- | |------------------| TT 50 10 1000 12 0 Z | 1001 1002 1003 | 0 |------------------| ------ -- -- ---- ---- ---- ----- ---- ---- ---- ----
To call igscint, the following steps should be followed: Notice that this is only demonstration code. It is assumed that all the fields are in a sample standard file. There is no error checking for the presence of fields or consistency. The most important variables have been underlined.
*** 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, EXTRA1, EXTRA2, EXTRA3) ier = FSTLUK(zin, key, NI, NJ, NK) *** read associated deformation axes ikeyx = fstinf(iun, nix, njx, nkx, -1,' ', ig1, ig2, ig3,' ','>>') ier = fstluk(xaxis, ikeyx, nix, njx, nkx) ikeyy = fstinf(iun, niy, njy, nky, -1,' ', ig1, ig2, ig3,' ','>>') ier = fstluk(yaxis, ikeyy, niy, njy, nky) *** read reference grid parameters ier = fstprm(ikeyx,idatex,ideetx,npasx,nix,njx,nkx, nbitsx,datypx, $ ip1x,ip2x,ip3x,typvarx,nomvarx,etikx, $ grref, ig1ref,ig2ref,ig3ref,ig4ref, swax, lngx, dltfx, ubcx, $ extra1x, extra2x, extra3x) *** Now call igscint call igscint(ZOUT, li, lj, xlat, xlon, zin, ni, nj, grtyp, grref, ig1ref, ig2ref, ig3ref, ig4ref, sym, xaxis, yaxis)
The code is part of rmnlib, in "$ARMNLIB/lib/librmn32stack.a"
Yves Chartier, RPN, (514) 421-4736
February 26th, 1997