Rich Selin's question.

From: Dave Kennison (kennison AT unknown)
Date: Thu Aug 29 1996 - 11:12:29 MDT


Rich Selin writes:

> I have a program with old NCAR Graphics calls that I am trying
> to update. The old program calls conrec and produces contours
> with every other contour line labeled. However, when I replace
> it with cpcnrc, I only get 1 or 2 contours labeled. How can I
> set up the Conpack parameters so it will label every other contour
> line again?
        
I have attached a little example that shows how to do this. It generates
some dummy data and then contours it (using CPCNRC) four times:

  1) All defaults are used. CPCNRC decides to use a contour interval
     of 25 and only every fifth contour level is labelled.

  2) I reset the contents of the internal parameter array 'LIT' to
     contain 1's instead of 5's. CPCNRC still decides to use a contour
     interval of 25 but, this time, every contour line is labelled.

  3) I tell CPCNRC to use a specific contour interval (20). This
     bypasses the use of the table 'LIT'; instead, the value of the
     internal parameter 'LIS' is used and, because of its default
     value, only every fifth contour level is labelled.

  4) I reset the value of 'LIS' to 1 and then tell CPCNRC to use the
     contour interval 20. This time, it labels every contour level.

(I guess, for your purposes, you want to use 2's instead of 1's, but you
get the idea ... )

All this should work independently of any calls to EZMAP routines that
you may have.

Let me know if this doesn't work for you ...

Dave Kennison

----------

Program follows:

      PROGRAM EXMPL9
C
C Define an array for the data.
C
        DIMENSION ZDAT(40,40)
C
C Generate dummy data.
C
        CALL GENDAT (ZDAT,40,40,40,14,14,-145.6,389.7)
C
C Open GKS.
C
        CALL OPNGKS
C
C Turn off clipping by GKS.
C
        CALL GSCLIP (0)
C
C Contour the data using the CONREC simulator and advance the frame.
C
        CALL CPCNRC (ZDAT,40,40,40,0.,0.,0.,3,0,-682)
        CALL FRAME
C
C Now, reset the contents of the parameter array 'LIT' (the "Label
C Interval Table") and contour the data again. Because of the changes
C in the contents of 'LIT', every contour interval will be labelled.
C
        DO 101 I=1,5
          CALL CPSETI ('PAI',I)
          CALL CPSETI ('LIT',1)
  101 CONTINUE
C
        CALL CPCNRC (ZDAT,40,40,40,0.,0.,0.,3,0,-682)
        CALL FRAME
C
C Contour the data using the CONREC simulator, but force the use of a
C particular contour interval. Because the contents of the table 'LIT'
C are not used, only every fifth interval will be labelled.
C
        CALL CPCNRC (ZDAT,40,40,40,0.,0.,20.,3,0,-682)
        CALL FRAME
C
C In order to get every level labelled, we have to reset the value of
C the parameter 'LIS', as follows:
C
        CALL CPSETI ('LIS',1)
C
        CALL CPCNRC (ZDAT,40,40,40,0.,0.,20.,3,0,-682)
        CALL FRAME
C
C Close GKS.
C
        CALL CLSGKS
C
C Done.
C
        STOP
C
      END

      SUBROUTINE GENDAT (DATA,IDIM,M,N,MLOW,MHGH,DLOW,DHGH)
C
C This is a routine to generate test data for two-dimensional graphics
C routines. Given an array "DATA", dimensioned "IDIM x 1", it fills
C the sub-array ((DATA(I,J),I=1,M),J=1,N) with a two-dimensional field
C of data having approximately "MLOW" lows and "MHGH" highs, a minimum
C value of exactly "DLOW" and a maximum value of exactly "DHGH".
C
C "MLOW" and "MHGH" are each forced to be greater than or equal to 1
C and less than or equal to 25.
C
C The function used is a sum of exponentials.
C
        DIMENSION DATA(IDIM,1),CCNT(3,50)
C
        FOVM=9./FLOAT(M)
        FOVN=9./FLOAT(N)
C
        NLOW=MAX0(1,MIN0(25,MLOW))
        NHGH=MAX0(1,MIN0(25,MHGH))
        NCNT=NLOW+NHGH
C
        DO 101 K=1,NCNT
          CCNT(1,K)=1.+(FLOAT(M)-1.)*FRAN()
          CCNT(2,K)=1.+(FLOAT(N)-1.)*FRAN()
          IF (K.LE.NLOW) THEN
            CCNT(3,K)=-1.
          ELSE
            CCNT(3,K)=+1.
          END IF
  101 CONTINUE
C
        DMIN=+1.E36
        DMAX=-1.E36
        DO 104 J=1,N
          DO 103 I=1,M
            DATA(I,J)=.5*(DLOW+DHGH)
            DO 102 K=1,NCNT
              TEMP=-((FOVM*(FLOAT(I)-CCNT(1,K)))**2+
     + (FOVN*(FLOAT(J)-CCNT(2,K)))**2)
              IF (TEMP.GE.-20.) DATA(I,J)=DATA(I,J)+
     + .5*(DHGH-DLOW)*CCNT(3,K)*EXP(TEMP)
  102 CONTINUE
            DMIN=AMIN1(DMIN,DATA(I,J))
            DMAX=AMAX1(DMAX,DATA(I,J))
  103 CONTINUE
  104 CONTINUE
C
        DO 106 J=1,N
          DO 105 I=1,M
            DATA(I,J)=(DATA(I,J)-DMIN)/(DMAX-DMIN)*(DHGH-DLOW)+DLOW
  105 CONTINUE
  106 CONTINUE
C
        RETURN
C
      END

      FUNCTION FRAN()
C
C Pseudo-random-number generator.
C
        DOUBLE PRECISION X
        SAVE X
        DATA X / 2.718281828459045 /
C
        X=MOD(9821.D0*X+.211327D0,1.D0)
        FRAN=REAL(X)
C
        RETURN
C
      END



This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 09:44:55 MDT