 
      CALL SEQUENCES...
       makezg  GIN ZOUT OUTPUT \ 
                   or 
       makezgv UIN VIN ZUOUT ZVOUT OUTPUT \ 
                   + 
               [ -dlon1 VAL0  -dlat1   VAL1    \ 
                 -dlon2 VAL2  -dlat2   VAL3    \ 
                 -i     VAL5  [VAL6   [VAL7]]  \ 
                 -j     VAL8  [VAL9   [VAL10]] \ 
                 -m     VAL9  [VAL11  [VAL12]] \ 
                 -n     VAL13 [VAL14  [VAL15]] \ 
                 -kind  VAL16 [VAL17  [VAL18]] \ 
                 -d60   VAL19 -dgrw    VAL20   \ 
                 -pi    VAL21 -pj      VAL22   \ 
                 -a     VAL23 -def     VAL24   ] 
 
       makeyy  GIN YYOUT OUTPUT -i VAL1 -j VAL2 -def [VAL3]
       makezgv UIN VIN YYUOUT YYVOUT OUTPUT -i VAL1 -j VAL2 -def [VAL3]
 
 
      DESCRIPTION...
       makezg  - INTERPOLATE SCALAR FIELDS ONTO A GEM/DM Z-GRID
       makezgv - INTERPOLATE VECTOR FIELDS ONTO A GEM/DM Z-GRID
       makeyy  - INTERPOLATE SCALAR FIELDS ONTO A GEM/DM YinYang-GRID
       makeyyv - INTERPOLATE VECTOR FIELDS ONTO A GEM/DM YinYang-GRID
 
 
      AUTHORS  - B.Dugas, MARCH 2002.
      LAST REVISION: $Header: /home/cvs/RMNLIB/utils/rdiag/lspgm/makezg.ptn,v 4.25 2014/10/10 19:53:43 dugas Exp $
 
 
      PURPOSE...
       GIVEN A SET OF FIELDS DEFINED ON CMC/RPN GRIDS,
       INTERPOLATE THEM TO THE GEM/DM Z-GRID. THE CODE IS
       BORROWED FROM THE V2.3.1. MODEL LIBRARY AND HAS
       THE SAME GRID DEFINITION INPUT PARAMETRES AS
       THE MODEL ITSELF.
 
 
      INPUT FILE...
       GIN   = ANY FILE OF SCALAR VARIABLES ON CMC/RPN GRIDS (MAKEZG)
       UIN   = ANY FILE OF U-COMPONENT VARIABLES ON CMC/RPN GRIDS (MAKEZGV)
       VIN   = ANY FILE OF V-COMPONENT VARIABLES ON CMC/RPN GRIDS (MAKEZGV)
 
      OUTPUT FILE...
       ZOUT   = RESULTING FILE OF Z-GRID INTERPOLATED SCALAR ARRAYS (MAKEZG)
       YYOUT  = RESULTING FILE OF YY-GRID INTERPOLATED SCALAR ARRAYS (MAKEYY)
       ZUOUT  = RESULTING FILE OF Z-GRID INTERPOLATED U-COMPONENT ARRAYS (MAKEZGV)
       ZVOUT  = RESULTING FILE OF Z-GRID INTERPOLATED V-COMPONENT ARRAYS (MAKEZGV)
       YYUOUT = RESULTING FILE OF YY-GRID INTERPOLATED U-COMPONENT ARRAYS (MAKEYYV)
       YYVOUT = RESULTING FILE OF YY-GRID INTERPOLATED V-COMPONENT ARRAYS (MAKEYYV)
 
 
      COMMAND-LINE INPUT PARAMETER...
 
       kind(1)         POSITIVE OR NULL VALUES INDICATE THAT THE OUTPUT IS ON
                       A NON-ROTATED GRID (DEFAULT). NEGATIVES FOR A ROTATED ONE.
                       THE ABSOLUTE VALUE DEFINES THE INTERPOLATION TYPE:
                       = 1, LINEAR
                       = 2, NEAREST NEIGHBOR
                       = OTHERWISE, CUBIC
       kind(2)         SPECIFIES THE PARTICULAR MODEL GRID WE WANT
                       KNOWN VALUES ARE 'PHI' (DEFAULT), 'U' AND 'V'.
       kind(3)         SPECIFIES GAUSSIAN ('G'), LIMITED AREA ('L') OR
                       POLAR STEREOGRAPHIC ('N' OR 'S') GRID OPTIONS.
                       DEFAULT IS A GLOBAL LAT-LON/NON-GAUSSIAN GRID.
       spval (a)       VALUE USED FOR EXTRAPOLATIONS. NO DEFAULT IS PROVIDED.
 
      If kind(3) is not equal to 'N' and not equal to 'S' ...
   
      (dlon1,dlat1)    FIRST POINT ON THE GREAT CIRCLE DEFINING THE
                       ROTATED MODEL EQUATOR'S. REQUIRED WHEN KIND=1.
      (dlon2,dlat2)    AS (dlon1,dlat1) BUT FOR THE SECOND POINT.
       i(1),j(1)       NUMBER OF DISTINCT POINTS IN X AND Y FOR THE GRID.
       i(2),j(2)       (OPTIONAL) # OF POINTS IN THE X AND Y DIRECTIONS
                       OF THE HIGH RESOLUTION DOMAIN. THEY DEFAULT TO
                       THE VALUES OF i(1) AND j(1).
       m(1),n(1)       RESOLUTION OF THE HIGH RESOLUTION (CONSTANT)
                       DOMAIN IN X and Y, RESPECTIVELY (IN DEGREES).
                       THE DEFAULTS VALUES ARE 360/i(1) AND 180/j(1).
       m(2),n(2)       (OPTIONAL) MAXIMUM GRID POINT SPACING ALONG
                       X AND Y, RESPECTIVELY (IN DEGREES).
 
      And if in addition to the above, kind(3) = 'L' ...
 
       i(3),j(3)       POSITION OF THE LAM REFERENCE POINT IN THE GRID
       m(3),n(3)       (LONGITUDE,LATITUDE) OF THE LAM REFERENCE POINT
 
      However, if kind(3) is equal to 'N' or is equal to 'S'. the
      following parametres will instead be considered... 
 
       i(1),j(1)       NUMBER OF DISTINCT POINTS IN X AND Y FOR THE GRID.
 
       i(2),j(2)       GRID COORDINATES OF THE POLE. 
       i(3),j(3)       DX AND DY INCREMENTS FROM THE LOWER-LEFT CORNER,
                       AGAIN IN UNITS OF THE ps REFERENCE (DEFAULT=1.0)
       D60             GRID LENGTH AT 60 DEGREES (METERS) 
                       (DEFAULT VALUE 3.81E5 = 381 KM).
       DGRW            ORIENTATION IN THE GRID WITH RESPECT TO
                       THE GREENWICH MERIDIAN (DEG) (DEFAULT 350.).
 
      GENERAL NOTES :
              1) Specifying "-def APPEND" indicates that the program should
                 attempt to check to output file in order to find a TicTac
                 ( >> and ^^ ) set of variables or a TocToc (!!) variable,
                 for Z-grid or YinYang-grids outputs, respectively, to fully
                 specify the horizontal grid description of the output data.
                 In this mode, a new set of descriptors will no be created. If
                 the horizontal dimensions are specified as well (see above),
                 this will constrain the choice of the TicTac set or of the
                 TocToc variables. Otherwise, the first set or variable found
                 is retained. The resulting newly interpolated data will then
                 be APPENDED to the file. Note that this is the only option
                 available for MAKEYY and MAKEYYV and not other parametre
                 is supported at this time for these commands. 
 
      NOTES FOR THE NON-PS GRID OPTIONS :
              2) In non-APPEND mode (which is the default), the only two
                 required parametres are i(1) and j(1). They will them
                 define a non-rotated uniform-resolution Z-grid.
              3) Non-uniform resolution limited area grids are not supported.
              4) The gaussian and lam options are mutually exclusive.
 
      NOTES FOR THE PS GRID OPTION :
              5) Only the absolute value of kind(1) is relevant.
              6) All values of kind(2) are irrelevant.
 
 
      EXIT CONDITIONS...
        0 NO PROBLEMS
        1 ROTATED GRID COORDINATES ARE MISSING
        2 NO COMMAND-LINE PARAMETRES
        3 UNSUPPORTED GRID TYPE IN GIN
        4 SOME OF THE i AND/OR j VALUES ARE WRONG
        5 INCONSISTENT i,j AND m,n VALUES
        6 GIN IS NOT A CMC/RPN FILE
        8 INPUT PARAMETRE ERROR
        9 PROBLEM READING GIN
       10 LV GRID NOT SUPPORTED
       11 PS GRID DESCRIPTORS ARE MISSING
       12 NO TICTAC FOUND IN APPEND MODE
       13 NOT THE RIGHT NUMBER OF I/O FILES
       14 IN APPEND-MODE, INCONSISTENT ZUOUT,ZVOUT FILES
       15 PROBLEM ALLOCATION WORKING MEMORY
       16 FEWER RECORDS IN VIN THAN IN UIN
       17 INCONSISTENT UIN,VIN RECORD SIZES/TIMES/LEVELS
