!=====================================================================
! NGCP: Conpack, A Contouring Package
!=====================================================================
!
! CONPACK provides a sort of tool kit of FORTRAN subroutines that can
! be called in various combinations to draw different kinds of contour
! plots from rectangular arrays of data.
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
! set/Get internal parameters
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_CPRSET to reset all parameters to their default values.
!
! NG_CPSETC to give a value of type CHARACTER to a parameter.
! NG_CPSETI to give a value of type INTEGER to a parameter.
! NG_CPSETR to give a value of type REAL to a parameter.
!
! NG_CPGETC to get a value of type CHARACTER.
! NG_CPGETI to get a value of type INTEGER.
! NG_CPGETR to get a value of type REAL.
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Transition CONREC & CONPACK (single call)
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_CPEZCT simulates the behavior of the old routine EZCNTR.
!
! NG_CPCNRC simulates the behavior of the old routine CONREC.
!
! ~~~~~~~~~~~~~~
! Initialization
! ~~~~~~~~~~~~~~
!
! NG_CPRECT is called if one has an acceptably "dense" rectangular
!           array.
!
! NG_CPSPS1 is called if one has a "sparse" rectangular array and
!           the grid is regularly spaced in X and Y; it returns a
!           "dense" rectangular array, generated by interpolation
!           from the original data, using bicubic splines under
!           tension. This may be viewed as a sort of 3D smoothing.
!           Calls to "CPSPRS" will be treated as calls to CPSPS1.
!
! NG_CPSPS2 is called if one has a "sparse" rectangular array and
!           the grid is irregularly spaced; otherwise, it acts just
!           like CPSPS1.
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
! Parameterize contour levels
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_CPPKCL is called to have CONPACK pick a set of contour levels.
!
! NG_CPPKLB is called to pick labels to be associated with those
!           levels for which the contour lines are to be labelled
!           and for which no labels have yet been specified.
!
! ~~~~~~~~~~~~~~~~
! Drawing Routines
! ~~~~~~~~~~~~~~~~
!
! NG_CPCLDR is called to draw a set of contour lines.
!
! NG_CPLBDR is called to draw labels for the contour plot.
!
! NG_CPCLAM is called to add a set of contour lines to an area map.
!           Most likely, the user will then call the AREAS routine
!           NG_ARSCAM to create, from the area map, a solid-filled
!           contour plot.
!
! NG_CPLBAM is called to add label boxes to an area map. Such an area
!           map will most likely be used to prevent contour lines
!           from passing through the labels.
!
! NG_CPCLDM is called to draw a set of contour lines, as masked by
!           an existing area map. (draw by user passed routine)
!
! NG_CPDRPL is the default version of contour-line drawing routine which
!           will draw contour lines but avoid drawing them through labels
!           (an example of subprogram argument "RTPL" of NG_CPCLDM)
!
!-----------
!
! NG_CPBACK is called to draw a background (draw perimeter).
!
! NG_CPCLTR is called to trace all of the contour lines at a given
!           level and return them to the caller.
!
! NG_CPCICA is called to add color indices to a user's cell array.
!           Most likely, the user will then call the GKS routine GCA
!           to display the cell array, thereby creating a solid-filled
!           contour plot.
!
! ~~~~~~~~~~~~~~~~~~~~~~~
! Error-Recovery Routines
! ~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_CPMVIW may be called to transfer the current contents of
!           an integer workspace array to a new array.
!
! NG_CPMVRW may be called to transfer the current contents of
!           a real workspace array to a new array.
!
!---------------------------------------
!
! Note: CNCARG adding seven "optional dummy subprogram arguments",
!         CPMPXY, CPCHHL, CPCHLL, CPCHCF, CPCHCL, CPCHIL, and CPSCAE
!       to following CONPACK routines.
!
! SUBROUTINE NG_CPEZCT( ZDAT, MZDT, NZDT, CPMPXY, CPCHHL, CPCHLL )
!
! SUBROUTINE NG_CPCNRC( ZDAT, KZDT, MZDT, NZDT, FLOW, FHGH, FINC,&
!                       KSET, NHGH, NDSH, CPMPXY, CPCHHL, CPCHLL )
!
! SUBROUTINE NG_CPRECT( ZDAT, KZDT, MZDT, NZDT, RWRK, KRWK, IWRK,&
!                       KIWK, CPMPXY )
!
! SUBROUTINE NG_CPSPS1( ZSPS, KSPS, MSPS, NSPS, RWRK, KRWK, IWRK,&
!                       KIWK, ZDAT ,KZDT, CPMPXY )
!
! SUBROUTINE NG_CPSPS2( XSPS, YSPS, ZSPS, KSPS, MSPS, NSPS, RWRK,&
!                       KRWK, IWRK, KIWK, ZDAT, KZDT, CPMPXY )
!
! SUBROUTINE NG_CPCLDM( ZDAT, RWRK, IWRK, IAMA, RTPL, CPMPXY, CPCHLL, CPCHCF, CPCHCL )
!
! SUBROUTINE NG_CPCLDR( ZDAT, RWRK, IWRK,             CPMPXY, CPCHLL, CPCHCF, CPCHCL )
!
! SUBROUTINE NG_CPCLAM( ZDAT, RWRK, IWRK, IAMA, CPMPXY, CPCHLL )
!
! SUBROUTINE NG_CPLBAM( ZDAT, RWRK, IWRK, IAMA, CPMPXY, CPCHHL, CPCHLL, CPCHCF, CPCHIL )
!
! SUBROUTINE NG_CPLBDR( ZDAT, RWRK, IWRK,       CPMPXY, CPCHHL, CPCHLL, CPCHCF, CPCHIL )
!
! SUBROUTINE NG_CPCLTR( ZDAT, RWRK, IWRK, CLVL, IJMP, IRW1, IRW2,&
!                       NRWK, CPMPXY, CPCHLL )
!
! SUBROUTINE NG_CPCICA( ZDAT, RWRK, IWRK, ICRA, ICA1, ICAM, ICAN,&
!                       XCPF, YCPF, XCQF, YCQF, CPMPXY, CPSCAE )
!
!=====================================================================
! Internal parameters:
!=====================================================================
!
! ---------------------------------------------------------------
! Parameter  Brief description               Fortran type
! ---------------------------------------------------------------
! AIA        Area Identifier Above           Integer array
! AIB        Area Identifier Below           Integer array
! CAF        Cell Array Flag                 Integer
! CFA        Constant Field label Angle      Real
! CFB        Constant Field label Box flag   Integer
! CFC        Constant Field label Color      Integer
!            index
! CFF        Constant Field Found flag       Integer
! CFL        Constant Field label Line       Real
!            width
! CFP        Constant Field label            Integer
!            Positioning flag
! CFS        Constant Field label Size       Real
! CFT        Constant Field label Text       Character
!            string
! CFW        Constant Field label White      Real
!            space width
! CFX        Constant Field label X          Real
!            coordinate
! CFY        Constant Field label Y          Real
!            coordinate
! CIS        Contour Interval Specifier      Real
! CIT        Contour Interval Table          Real array
! CIU        Contour Interval Used           Real
! CLC        Contour Line Color index        Integer array
! CLD        Contour Line Dash pattern       Character array or
!                                            Integer array
! CLL        Contour Line Line width         Real array
! CLS        Contour Level Selection flag    Integer
! CLU        Contour Level Use flags         Integer array
! CLV        Contour Level Values            Real array
! CMN        Contour MiNimum                 Real
! CMX        Contour MaXimum                 Real
! CTM        Character TeMporary             Character
! CWM        Character Width Multiplier      Real
! DPS        Dash Pattern Size               Real
! DPU        Dash Pattern Use flag           Integer
! DPV        Dash Pattern Vector length      Real
! GIC        Group Identifier for Contour    Integer
!            lines
! GIL        Group Identifier for Label      Integer
!            boxes
! GIS        Group Identifier for Strips     Integer
! HIC        HIgh label Color index          Integer
! HIT        HIgh label Text string          Character
! HCF        HaChure Flag                    Integer
! HCL        HaChure Length                  Real
! HCS        HaChure Spacing                 Real
! HLA        High/Low label Angle            Real
! HLB        High/Low label Box flag         Integer
! HLC        High/Low label Color index      Integer
! HLL        High/Low label Line width       Real
! HLO        High/Low label Overlap flag     Integer
! HLS        High/Low label Size             Real
! HLT        High/Low label Text strings     Character
! HLW        High/Low label White space      Real
!            width
! HLX        High/Low search radius in X     Integer
! HLY        High/Low search radius in Y     Integer
! ILA        Information Label Angle         Real
! ILB        Information Label Box flag      Integer
! ILC        Information Label Color         Integer
!            index
! ILL        Information Label Line width    Real
! ILP        Information Label Positioning   Integer
!            flag
! ILS        Information Label Size          Real
! ILT        Information Label Text string   Character
! ILW        Information Label White space   Real
!            width
! ILX        Information Label X             Real
!            coordinate
! ILY        Information Label Y             Real
!            coordinate
! IWM        Integer Workspace for           Integer
!            Masking
! IWU        Integer Workspace Usage         Integer
! LBC        Label Box Color index           Integer
! LBX        Label Box X coordinate          Real
! LBY        Label Box Y coordinate          Real
! LIS        Label Interval Specifier        Integer
! LIT        Label Interval Table            Integer array
! LIU        Label Interval Used             Integer
! LLA        Line Label Angle                Real
! LLB        Line Label Box flag             Integer
! LLC        Line Label Color index          Integer array
! LLL        Line Label Line width           Real
! LLO        Line Label Orientation          Integer
! LLP        Line Label Positioning          Integer
! LLS        Line Label Size                 Real
! LLT        Line Label Text string          Character array
! LLW        Line Label White space          Real
! LOC        LOw label Color index           Integer
! LOT        LOw label Text string           Character
! MAP        MAPping flag                    Integer
! NCL        Number of Contour Levels        Integer
! NEL        Numeric Exponent Length         Integer
! NET        Numeric Exponent Type           Integer
! NEU        Numeric Exponent Use flag       Integer
! NLS        Numeric Leftmost Significant    Integer
!            digit flag
! NLZ        Numeric Leading Zero flag       Integer
! NOF        Numeric Omission Flags          Integer
! NSD        Number of Significant Digits    Integer
! NVS        Number of Vertical Strips       Integer
! ORV        Out-of-Range Value              Real
! PAI        Parameter Array Index           Integer
! PC1        Penalty scheme Constant 1       Real
! PC2        Penalty scheme Constant 2       Real
! PC3        Penalty scheme Constant 3       Real
! PC4        Penalty scheme Constant 4       Real
! PC5        Penalty scheme Constant 5       Real
! PC6        Penalty scheme Constant 6       Real
! PIC        Point Interpolation flag for    Integer
!            Contours
! PIE        Point Interpolation flag for    Integer
!            Edges
! PW1        Penalty scheme Weight 1         Real
! PW2        Penalty scheme Weight 2         Real
! PW3        Penalty scheme Weight 3         Real
! PW4        Penalty scheme Weight 4         Real
! RC1        Regular scheme Constant 1       Real
! RC2        Regular scheme Constant 2       Real
! RC3        Regular scheme Constant 3       Real
! RWC        Real Workspace for Contours     Integer
! RWG        Real Workspace for Gradients    Integer
! RWM        Real Workspace for Masking      Integer
! RWU        Real Workspace Usage            Integer
! SET        do-SET-call flag                Integer
! SFS        Scale Factor Selector           Real
! SFU        Scale Factor Used               Real
! SPV        SPecial Value                   Real
! SSL        Smoothed Segment Length         Real
! T2D        Tension on 2-Dimensional        Real
!            splines
! T3D        Tension on 3-Dimensional        Real
!            splines
! VPB        ViewPort Bottom                 Real
! VPL        ViewPort Left                   Real
! VPR        ViewPort Right                  Real
! VPS        ViewPort Shape                  Real
! VPT        ViewPort Top                    Real
! WDB        WinDow Bottom                   Real
! WDL        WinDow Left                     Real
! WDR        WinDow Right                    Real
! WDT        WinDow Top                      Real
! WSO        WorkSpace Overflow flag         Integer
! XC1        X Coordinate at index 1         Real
! XCM        X Coordinate at index M         Real
! YC1        Y Coordinate at index 1         Real
! YCN        Y Coordinate at index N         Real
! ZD1        Z data array Dimension 1        Integer
! ZDM        Z data array Dimension M        Integer
! ZDN        Z data array Dimension N        Integer
! ZDS        Z data array Dimension          Integer
!            Selector
! ZDU        Z Data value, Unscaled          Real
! ZDV        Z Data Value                    Real
! ZMN        Z MiNimum value                 Real
! ZMX        Z MaXimum value                 Real
!
!---------------------------------------------------------------------
!
!  ***** Internal parameters added by CNCARG *****
!
!  Parameters 'LC1', 'LC2', and LC3', which specify the default (if
!  parameter arrays' parameters 'CLC' and/or 'LLC' not active) color
!  indeices for unlabeled line, labeled line, and line label respectively.
!  All the default values are -1.
!
!  Parameter 'DPC', which specifies the color index for the
!  data point labels.
!  The default value is -1.
!
!  Parameter 'BKC', which specifies the color index for the
!  background perimeter
!  The default value is -1.
!
!---------------------------------------
!
!  ***** Internal parameters changed by CNCARG *****
!
!  change default value of parameter 'NLZ' (Numeric Leading Zero Flag)
!  from "0" to " 1"
!
!  change default value of parameter 'LBC' (Label Box Color Index)
!  from "0" to "-1"
!
!---------------------------------------------------------------------
!
!  ***** Set CONPACK Colors *****
!
!  CALL NG_CPSETI( 'LC1 - Default Color of Unlabeled Contour Lines', color )
!  CALL NG_CPSETI( 'LC2 - Default Color of Labeled Contour Lines'  , color )
!  CALL NG_CPSETI( 'LC3 - Default Color of Contour Line Labels'    , color )
!  Note: used for Parameter Array 'CLC' and/or 'LLC' not active
!
!  CALL NG_CPSETI( 'CFC - Color of Constant-Field Label' , color )
!  CALL NG_CPSETI( 'ILC - Color of Informational Label'  , color )
!  CALL NG_CPSETI( 'HLC - Color of Local High/Low Labels', color )
!  CALL NG_CPSETI( 'HIC - Color of Local High Labels'    , color )
!  CALL NG_CPSETI( 'LOC - Color of Local Low Labels'     , color )
!  CALL NG_CPSETI( 'LBC - Color of Label Box Area Fill'  , color )
!
!  CALL NG_CPSETI( 'DPC - Color of Data Point Labels', color )
!
!  CALL NG_CPSETI( 'BKC - Color of Background Grids' , color )
!
!=====================================================================
! Refer "NCAR menu" for interfacing CONPACK in detail
!=====================================================================