```
IPOLATEV

The IPOLATEV routine interpolates vector fields
from any grid to any grid.  Only horizontal
interpolation is performed.

The following interpolation methods are possible:
(IP=0) BILINEAR
(IP=1) BICUBIC
(IP=2) NEIGHBOR
(IP=3) BUDGET
(IP=4) SPECTRAL
(IP=6) NEIGHBOR-BUDGET

Some of these methods have interpolation options and/or
restrictions on the input or output grids, both of which
are documented more fully in their respective subprograms.
The grids are defined by their grid description sections
(passed in integer form as decoded by subprogram w3fi63).

The current code recognizes the following projections:
(KGDS(1)=000) EQUIDISTANT CYLINDRICAL
(KGDS(1)=001) MERCATOR CYLINDRICAL
(KGDS(1)=003) LAMBERT CONFORMAL CONICAL
(KGDS(1)=004) GAUSSIAN CYLINDRICAL
(KGDS(1)=005) POLAR STEREOGRAPHIC AZIMUTHAL
(KGDS(1)=201) ROTATED EQUIDISTANT CYLINDRICAL
(KGDS(1)=202) ROTATED EQUIDISTANT CYLINDRICAL

Where KGDS could be either input KGDSI or output KGDSO.
As an added bonus the number of output grid points
and their latitudes and longitudes are also returned.
On the other hand, the output can be a set of station points
If KGDSO(1)<0, in which case the number of points
and their latitudes and longitudes must be input.
input bitmaps will be interpolated to output bitmaps.
output bitmaps will also be created when the output grid
extends outside of the domain of the input grid.
The output field is set to 0 where the output bitmap is off.

USAGE:    CALL IPOLATEV(IP,IPOPT,KGDSI,KGDSO,MI,MO,KM,IBI,LI,UI,VI,
NO,RLAT,RLON,CROT,SROT,IBO,LO,UO,VO,IRET)

Input argument list:
IP       - INTEGER INTERPOLATION METHOD
(IP=0 FOR BILINEAR;
IP=1 FOR BICUBIC;
IP=2 FOR NEIGHBOR;
IP=3 FOR BUDGET;
IP=4 FOR SPECTRAL;
IP=6 FOR NEIGHBOR-BUDGET)
IPOPT    - INTEGER (20) INTERPOLATION OPTIONS
(IP=0: (NO OPTIONS)
IP=1: CONSTRAINT OPTION
IP=2: (NO OPTIONS)
IP=3: NUMBER IN RADIUS, RADIUS WEIGHTS ...
IP=4: SPECTRAL SHAPE, SPECTRAL TRUNCATION
IP=6: NUMBER IN RADIUS, RADIUS WEIGHTS ...)
KGDSI    - INTEGER (200) INPUT GDS PARAMETERS AS DECODED BY W3FI63
NOTE: IF KGDSI(201)=1 THEN THE 9TH BIT OF KGDSI(11)
IS TEMPORARILY SET TO 1 TO ALERT THE GDS WIZARD
THAT THESE FIELDS ARE STAGGERED ETA WINDS.
KGDSO    - INTEGER (200) OUTPUT GDS PARAMETERS
NOTE: IF KGDSO(201)=1 THEN THE 9TH BIT OF KGDSO(11)
IS TEMPORARILY SET TO 1 TO ALERT THE GDS WIZARD
THAT THESE FIELDS ARE STAGGERED ETA WINDS.
MI       - INTEGER SKIP NUMBER BETWEEN INPUT GRID FIELDS IF KM>1
OR DIMENSION OF INPUT GRID FIELDS IF KM=1
MO       - INTEGER SKIP NUMBER BETWEEN OUTPUT GRID FIELDS IF KM>1
OR DIMENSION OF OUTPUT GRID FIELDS IF KM=1
KM       - INTEGER NUMBER OF FIELDS TO INTERPOLATE
IBI      - INTEGER (KM) INPUT BITMAP FLAGS
LI       - LOGICAL*1 (MI,KM) INPUT BITMAPS (IF RESPECTIVE IBI(K)=1)
UI       - REAL (MI,KM) INPUT U-COMPONENT FIELDS TO INTERPOLATE
VI       - REAL (MI,KM) INPUT V-COMPONENT FIELDS TO INTERPOLATE
NO       - INTEGER NUMBER OF OUTPUT POINTS (IF KGDSO(1)<0)
RLAT     - REAL (NO) OUTPUT LATITUDES IN DEGREES (IF KGDSO(1)<0)
RLON     - REAL (NO) OUTPUT LONGITUDES IN DEGREES (IF KGDSO(1)<0)
CROT     - REAL (NO) VECTOR ROTATION COSINES (IF KGDSO(1)<0)
SROT     - REAL (NO) VECTOR ROTATION SINES (IF KGDSO(1)<0)
(UGRID=CROT*UEARTH-SROT*VEARTH;
VGRID=SROT*UEARTH+CROT*VEARTH)

Output argument list:
NO       - INTEGER NUMBER OF OUTPUT POINTS (ONLY IF KGDSO(1)>=0)
RLAT     - REAL (MO) OUTPUT LATITUDES IN DEGREES (IF KGDSO(1)>=0)
RLON     - REAL (MO) OUTPUT LONGITUDES IN DEGREES (IF KGDSO(1)>=0)
CROT     - REAL (MO) VECTOR ROTATION COSINES (IF KGDSO(1)>=0)
SROT     - REAL (MO) VECTOR ROTATION SINES (IF KGDSO(1)>=0)
(UGRID=CROT*UEARTH-SROT*VEARTH;
VGRID=SROT*UEARTH+CROT*VEARTH)
IBO      - INTEGER (KM) OUTPUT BITMAP FLAGS
LO       - LOGICAL*1 (MO,KM) OUTPUT BITMAPS (ALWAYS OUTPUT)
UO       - REAL (MO,KM) OUTPUT U-COMPONENT FIELDS INTERPOLATED
VO       - REAL (MO,KM) OUTPUT V-COMPONENT FIELDS INTERPOLATED
IRET     - INTEGER RETURN CODE
0    SUCCESSFUL INTERPOLATION
1    UNRECOGNIZED INTERPOLATION METHOD
2    UNRECOGNIZED INPUT GRID OR NO GRID OVERLAP
3    UNRECOGNIZED OUTPUT GRID
1X   INVALID BICUBIC METHOD PARAMETERS
3X   INVALID BUDGET METHOD PARAMETERS
4X   INVALID SPECTRAL METHOD PARAMETERS

REMARKS:
EXAMPLES DEMONSTRATING RELATIVE CPU COSTS.
THIS EXAMPLE IS INTERPOLATING 12 LEVELS OF WINDS
FROM THE 360 X 181 GLOBAL GRID (NCEP GRID 3)
TO THE 93 X 68 HAWAIIAN MERCATOR GRID (NCEP GRID 204).
THE EXAMPLE TIMES ARE FOR THE C90.  AS A REFERENCE, THE CP TIME
FOR UNPACKING THE GLOBAL 12 PAIRS OF WIND FIELDS IS 0.07 SECONDS.

BILINEAR    0                   0.05
BICUBIC     1   0               0.16
BICUBIC     1   1               0.17
NEIGHBOR    2                   0.02
BUDGET      3   -1,-1           0.94
SPECTRAL    4   0,40            0.31
SPECTRAL    4   1,40            0.33
SPECTRAL    4   0,-1            0.59
N-BUDGET    6   0,-1            0.31

THE SPECTRAL INTERPOLATION IS FAST FOR THE MERCATOR GRID.
HOWEVER, FOR SOME GRIDS THE SPECTRAL INTERPOLATION IS SLOW.
THE FOLLOWING EXAMPLE IS INTERPOLATING 12 LEVELS OF WINDS
FROM THE 360 X 181 GLOBAL GRID (NCEP GRID 3)
TO THE 93 X 65 CONUS LAMBERT CONFORMAL GRID (NCEP GRID 211).

iplib.tar
Library contains subroutines to be used for
interpolating almost any grids used at NCEP. (Fortran90)
Date posted: 2/22/2007

```