CFPRIME SCALES                                                          SCALES      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*               Output Analysis Program for ETMSP (OAP)               *RIGHTE      4
C*               =======================================               *RIGHTE      5
C*                                                                     *RIGHTE     11
C*        copyright @(1993) Electric Power Research Institute          *RIGHTE     12
C*                                                                     *RIGHTE     13
C* EPRI reserves all rights in the software and associated             *RIGHTE     14
C* documentation as delivered. The software and its associated         *RIGHTE     15
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     16
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     17
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     18
C* of any changes or modifications to the software within two (2)      *RIGHTE     19
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     20
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     21
C* new designation sufficiently different from its then current        *RIGHTE     22
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     23
C* the current software as changed or modified.                        *RIGHTE     24
C*                                                                     *RIGHTE     25
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     26
C* directly from EPRI.                                                 *RIGHTE     27
C*                                                                     *RIGHTE     28
C* This program and supporting materials may be independently available*RIGHTE     29
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     30
C* distribution fee. The EPSC is a service of                          *RIGHTE     31
C*                                                                     *RIGHTE     32
C*                    Power Computing Company                          *RIGHTE     33
C*                    1930 Hi Line                                     *RIGHTE     34
C*                    Dallas, Tx 75207                                 *RIGHTE     35
C*                                                                     *RIGHTE     36
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     37
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     38
C*                                                                     *RIGHTE     39
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     40
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     41
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     42
C*    DOCUMENTATION; OR                                                *RIGHTE     43
C*                                                                     *RIGHTE     44
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     45
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     46
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     47
C*                                                                     *RIGHTE     48
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     49
C* THEREOF.                                                            *RIGHTE     50
C*                                                                     *RIGHTE     51
C***********************************************************************RIGHTE     52
      SUBROUTINE SCALES(N1,N2,XX)                                       SCALES      3
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES      4
CD                                                                      SCALES      5
CD          THIS ROUTINE PARSE X-SCALE AND Y-SCALE AND USE THE          SCALES      6
CD          SPECIFIED SCALE FOR PLOTS                                   SCALES      7
CD                                                                      SCALES      8
CD          CALLING PARAMETERS :                                        SCALES      9
CD                                                                      SCALES     10
CD                        N1   - INDEX FOR THE START OF THE ARRAY       SCALES     11
CD                        N2   - INDEX FOR THE END OF THE ARRAY         SCALES     12
CD                        XX   - ARRAY CONTAINING THE POINTS TO BE      SCALES     13
CD                               SCALED                                 SCALES     14
CD                                                                      SCALES     15
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES     16
C                                                                       SCALES     17
      INCLUDE 'SOAPC1.INS'                                              SCALES     18
      INCLUDE 'PARAM.INS'                                               SCALES     19
      INCLUDE 'XYARAY.INS'                                              SCALES     20
      INCLUDE 'GPINFO.INS'                                              SCALES     21
      CHARACTER*80 STRING,MSG,STR                                       SCALES     22
      REAL XX(MXPT,MXPLOT)                                              SCALES     23
C      INTEGER IDX1(MXPLOT),IDX2(MXPLOT)                                SCALES     24
      REAL PREVX1(6),PREVX2(6),PREVY1(6),PREVY2(6)                      SCALES     25
C      SAVE IDX1,IDX2,PREVX1,PREVX2,PREVY1,PREVY2                       SCALES     26
      SAVE PREVX1,PREVX2,PREVY1,PREVY2                                  SCALES     27
      COMMON /SCFLAG/ IFLG                                              SCALES     28
C                                                                       SCALES     29
      IF(.NOT.FILLED)THEN                                               SCALES     30
         WRITE(LOUT,3200)                                               SCALES     31
         RETURN                                                         SCALES     32
      ENDIF                                                             SCALES     33
C                                                                       SCALES     34
      IF(SCALX)THEN                                                     SCALES     35
         CALL XRANGE(XX,X1,X2,Y1,Y2,N1,N2)                              SCALES     36
         IF(HTIME) WRITE(LOUT,1233) X1,X2                               SCALES     37
         IF(IFLG.GE.1)THEN                                              SCALES     38
            CALL XRANGE(XARAY,XC1,XC2,Y1,Y2,N1,N2)                      SCALES     39
            WRITE(LOUT,1235) XC1,XC2                                    SCALES     40
         ENDIF                                                          SCALES     41
         JPREV=1                                                        SCALES     42
         DO 100 J=1,6                                                   SCALES     43
            PREVX1(J)=0.0                                               SCALES     44
            PREVX2(J)=0.0                                               SCALES     45
            PREVY1(J)=0.0                                               SCALES     46
            PREVY2(J)=0.0                                               SCALES     47
 100     CONTINUE                                                       SCALES     48
C                                                                       SCALES     49
 200     CONTINUE                                                       SCALES     50
         IF(HTIME)THEN                                                  SCALES     51
            MSG='Enter START and END time values.(M)in,max'             SCALES     52
            CALL PMTRED(LOUT,LIN,JERR,ISLEN(MSG),MSG,'SCA',STRING)      SCALES     53
            IF(RECORD) WRITE(IREC,'(A)') STRING                         SCALES     54
            IF(JERR.LT.0) GOTO 200                                      SCALES     55
         ELSE                                                           SCALES     56
            STRING='M'                                                  SCALES     57
         ENDIF                                                          SCALES     58
          IF(STRING(1:1).EQ.'M'.OR.STRING(1:1).EQ.'m')THEN              SCALES     59
            XX1=X1                                                      SCALES     60
            XX2=X2                                                      SCALES     61
          ELSE                                                          SCALES     62
            READ(STRING,*,IOSTAT=IOS) XX1,XX2                           SCALES     63
            IF(IOS.NE.0) GOTO 200                                       SCALES     64
          ENDIF                                                         SCALES     65
          XXX1=XX1                                                      SCALES     66
          XXX2=XX2                                                      SCALES     67
          IF(IFLG.GE.1)THEN                                             SCALES     68
            WRITE(LOUT,*)                                               SCALES     69
            WRITE(LOUT,*)'        ***   SCALE X-AXIS   ***'             SCALES     70
            CALL RANGE(XX,XX1,XX2,D1,D2,IDX1,IDX2,1,N1,N2)              SCALES     71
C            IDX1(1)=IDX1(1)-1                                          SCALES     72
C            IDX2(1)=IDX2(1)+1                                          SCALES     73
            IF(IDX1(1).LT.1)IDX1(1)=1                                   SCALES     74
            IF(IDX2(1).GT.MAXPT(1))IDX2(1)=MAXPT(1)                     SCALES     75
            IF(XX(IDX2(1),1).GT.XS2) IDX2(1)=IDX2(1)-1                  SCALES     76
            IF(XX(IDX1(1),1).LT.XS1) IDX1(1)=IDX1(1)+1                  SCALES     77
            CALL RANGE(XARAY,D1,D2,XS1,XS2,IDX1,IDX2,2,N1,N2)           SCALES     78
            IF(IFLG.EQ.1)THEN                                           SCALES     79
              CALL YSCALE(XS1,XS2,XST1,XST2)                            SCALES     80
            ELSE                                                        SCALES     81
              YY=(Y2-Y1)*5/4                                            SCALES     82
              IF(YY.GT.(XS2-XS1))THEN                                   SCALES     83
                 XST1=XS1                                               SCALES     84
                 XST2=XS1+YY                                            SCALES     85
                 YYY1=Y1                                                SCALES     86
                 YYY2=Y2                                                SCALES     87
              ELSE                                                      SCALES     88
                 XST1=XS1                                               SCALES     89
                 XST2=XS2                                               SCALES     90
                 YYY1=Y1                                                SCALES     91
                 YYY2=Y1+(XS2-XS1)*4/5                                  SCALES     92
              ENDIF                                                     SCALES     93
            ENDIF                                                       SCALES     94
            IF(HTIME) WRITE(LOUT,1300)XXX1,XXX2                         SCALES     95
            WRITE(LOUT,1301) XS1,XST1,XS2,XST2                          SCALES     96
  300       STR=' '                                                     SCALES     97
            MSG='Enter X-Axis START and END. (D)efault (M)in,max'       SCALES     98
            CALL PMTRED(LOUT,LIN,JERR,47,MSG,'SCB',STR)                 SCALES     99
            IF(RECORD) WRITE(IREC,'(A)') STR                            SCALES    100
            IF(STR(1:1).EQ.'D'.OR.STR(1:1).EQ.'d') THEN                 SCALES    101
              XS1=XST1                                                  SCALES    102
              XS2=XST2                                                  SCALES    103
            ELSE IF(STR(1:1).NE.'M' .AND.STR(1:1).NE.'m' ) THEN         SCALES    104
              READ(STR,*,IOSTAT=IOS) XS1,XS2                            SCALES    105
              IF(IOS.NE.0) GOTO 300                                     SCALES    106
              IF(IFLG.EQ.2)THEN                                         SCALES    107
                YYY1=Y1                                                 SCALES    108
                YYY2=Y1+(XS2-XS1)*4/5                                   SCALES    109
              ENDIF                                                     SCALES    110
            ENDIF                                                       SCALES    111
          ELSE                                                          SCALES    112
            XS1=XXX1                                                    SCALES    113
            XS2=XXX2                                                    SCALES    114
          ENDIF                                                         SCALES    115
        ENDIF                                                           SCALES    116
        CALL RANGE(XX,XX1,XX2,D1,D2,IDX1,IDX2,1,N1,N2)                  SCALES    117
        DO 400 J=N1,N2                                                  SCALES    118
C          IDX1(J)=IDX1(J)-1                                            SCALES    119
C          IDX2(J)=IDX2(J)+1                                            SCALES    120
          IF(IDX1(J).LT.1)IDX1(J)=1                                     SCALES    121
          IF(IDX2(J).GT.MAXPT(J))IDX2(J)=MAXPT(J)                       SCALES    122
          IF(XX(IDX2(J),1).GT.XS2) IDX2(J)=IDX2(J)-1                    SCALES    123
          IF(XX(IDX1(J),1).LT.XS1) IDX1(J)=IDX1(J)+1                    SCALES    124
  400   CONTINUE                                                        SCALES    125
        CALL RANGE(XX,D1,D2,Y1,Y2,IDX1,IDX2,3,N1,N2)                    SCALES    126
        IF(IFLG.NE.2) CALL YSCALE(Y1,Y2,YYY1,YYY2)                      SCALES    127
        IF(.NOT.SCALX)THEN                                              SCALES    128
          WRITE(LOUT,1227)                                              SCALES    129
          DO 500 J1=1,JPREV                                             SCALES    130
            WRITE(LOUT,1228)PREVY1(J1),PREVY2(J1)                       SCALES    131
 500      CONTINUE                                                      SCALES    132
        ENDIF                                                           SCALES    133
        IF(SCALX.AND.(IFLG.GE.1))THEN                                   SCALES    134
          WRITE(LOUT,1310)Y1,YYY1,Y2,YYY2                               SCALES    135
        ELSE                                                            SCALES    136
          IF(HTIME) WRITE(LOUT,1320) XXX1,XXX2                          SCALES    137
          WRITE(LOUT,1321) Y1,YYY1,Y2,YYY2                              SCALES    138
        ENDIF                                                           SCALES    139
  600   STR=' '                                                         SCALES    140
        MSG='Enter Y-Axis START and END. (D)efault (M)in,max'           SCALES    141
        CALL PMTRED(LOUT,LIN,JERR,47,MSG,'SCB',STR)                     SCALES    142
        IF(RECORD) WRITE(IREC,'(A)') STR                                SCALES    143
        IF(STR(1:1).EQ.'M'.OR.STR(1:1).EQ.'m' ) THEN                    SCALES    144
          YYY1=Y1                                                       SCALES    145
          YYY2=Y2                                                       SCALES    146
        ELSE IF(STR(1:1).NE.'D'.AND.STR(1:1).NE.'d' ) THEN              SCALES    147
          READ(STR,*,IOSTAT=IOS) YYY1,YYY2                              SCALES    148
          IF(IOS.NE.0) GOTO 600                                         SCALES    149
        ENDIF                                                           SCALES    150
        DO 700 I=N1,N2                                                  SCALES    151
          IF(.NOT.SCALX)THEN                                            SCALES    152
            JPREV=JPREV+1                                               SCALES    153
            IF(JPREV.GT.6)JPREV=6                                       SCALES    154
          ENDIF                                                         SCALES    155
          PREVX1(JPREV)=XXX1                                            SCALES    156
          PREVX2(JPREV)=XXX2                                            SCALES    157
          PREVY1(JPREV)=YYY1                                            SCALES    158
          PREVY2(JPREV)=YYY2                                            SCALES    159
          CALL SCALEV(XS1,XS2,YYY1,YYY2,I)                              SCALES    160
          CALL SCALED(XS1,XS2,YYY1,YYY2,I)                              SCALES    161
          USCALE=.TRUE.                                                 SCALES    162
          SCALX=.FALSE.                                                 SCALES    163
  700   CONTINUE                                                        SCALES    164
      RETURN                                                            SCALES    165
 1233 FORMAT(/,16X,'Values read in from Plotting array',/               SCALES    166
     1,'  Minimum T =',F11.4,16X,'Maximum T =',F11.4,/)                 SCALES    167
 1235 FORMAT(/,'  Minimum X =',F11.4,16X,'Maximum X =',F11.4,/)         SCALES    168
 1300 FORMAT(/,16X,'Values based on the T range :',/                    SCALES    169
     1,'   START  T =',F11.4,17X,'ENDING T =',F11.4)                    SCALES    170
 1301 FORMAT(/,T18,'Min,Max',T32,' Default',/,'   START  X =',F11.4     SCALES    171
     1,T30,F10.4,/,'   ENDING X =',F11.4,T30,F10.4,/)                   SCALES    172
 1227     FORMAT(/,T10,'Previous Y Scales Chosen :',/,                  SCALES    173
     1    T10,'Y-Start',T20,'Y-End')                                    SCALES    174
 1228       FORMAT(T5,F10.4,T15,F10.4)                                  SCALES    175
 1310     FORMAT(/,                                                     SCALES    176
     1    T18,'Min,Max ',T32,' Default',                                SCALES    177
     1    /,1X,'  START  Y = ',F10.4,T30,F10.4,                         SCALES    178
     1    /,1X,'  ENDING Y = ',F10.4,T30,F10.4/)                        SCALES    179
 1320     FORMAT(/,15X,' Values based on the T range : ',/,             SCALES    180
     1    1X,'  START  T = ',F10.4,                                     SCALES    181
     1    15X,'  ENDING T = ',F10.4)                                    SCALES    182
 1321     FORMAT(/,T18,'Min,Max ',T32,' Default',                       SCALES    183
     1    /,1X,'  START  Y = ',F10.4,T30,F10.4,                         SCALES    184
     1    /,1X,'  ENDING Y = ',F10.4,T30,F10.4/)                        SCALES    185
 3200 FORMAT(//,1X,'++ Plotting array not filled. Command ABORTED',//)  SCALES    186
      END                                                               SCALES    187
                                                                        SCALES    188
      SUBROUTINE SCALEV(X1,X2,Y1,Y2,N1)                                 SCALES    189
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES    190
CD                                                                      SCALES    191
CD        THIS ROUTINE DETERMINE THE SCALE OF THE AXIS                  SCALES    192
CD                                                                      SCALES    193
CD        CALLING PARAMETERS :                                          SCALES    194
CD                                                                      SCALES    195
CD                    X1,X2  - THE RANGE OF THE X-AXIS                  SCALES    196
CD                    Y1,Y2  - THE RANGE OF THE Y-AXIS                  SCALES    197
CD                    N1     - PLOT NUMBER                              SCALES    198
CD                                                                      SCALES    199
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES    200
C                                                                       SCALES    201
      INCLUDE 'SOAPC1.INS'                                              SCALES    202
      INCLUDE 'GPINFO.INS'                                              SCALES    203
                                                                        SCALES    204
      IF(.NOT.GPINIT) THEN                                              SCALES    205
         ONEONE=.TRUE.                                                  SCALES    206
         CALL GPPAGE                                                    SCALES    207
      ENDIF                                                             SCALES    208
C    .................................................                  SCALES    209
C    :Don't rescale X-axis if part of the same page  :                  SCALES    210
C    :                                               :                  SCALES    211
      IF(SCALX) THEN                                                    SCALES    212
         XSTVAL=X1                                                      SCALES    213
*IF -WSGKS                                                              SCALES    214
*IF -WSX11                                                              SCALES    215
*ENDIF                                                                  SCALES    217
*ENDIF                                                                  SCALES    218
*IF WSX11                                                               SCALES    219
        XEDVAL=X2                                                       SCALES    220
        XDELTA=(X2-X1)/((BXE-BXS)*10.0)                                 SCALES    221
*ENDIF                                                                  SCALES    222
*IF WSGKS                                                               SCALES    223
*ENDIF                                                                  SCALES    226
      ENDIF                                                             SCALES    227
C    :...............................................:                  SCALES    228
      YSTVAL(N1)=Y1                                                     SCALES    229
*IF -WSGKS                                                              SCALES    230
*IF -WSX11                                                              SCALES    231
*ENDIF                                                                  SCALES    233
*ENDIF                                                                  SCALES    234
*IF WSX11                                                               SCALES    235
        YEDVAL(N1)=Y2                                                   SCALES    236
        YDELTA(N1)=(Y2-Y1)/((BYE-BYS)*10.0)                             SCALES    237
*ENDIF                                                                  SCALES    238
*IF WSGKS                                                               SCALES    239
*ENDIF                                                                  SCALES    242
C                                                                       SCALES    243
      RETURN                                                            SCALES    244
      END                                                               SCALES    245
                                                                        SCALES    246
                                                                        SCALES    247
      SUBROUTINE SCALED(X1,X2,Y1,Y2,N1)                                 SCALES    248
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES    249
CD                                                                      SCALES    250
CD       THIS ROUTINE IS THE SCALING ROUTINE FOR DIGITAL PLOTS          SCALES    251
CD                                                                      SCALES    252
CD        CALLING PARAMETERS :                                          SCALES    253
CD                                                                      SCALES    254
CD                    X1,X2  - THE RANGE OF THE X-AXIS                  SCALES    255
CD                    Y1,Y2  - THE RANGE OF THE Y-AXIS                  SCALES    256
CD                    N1     - PLOT NUMBER                              SCALES    257
CD                                                                      SCALES    258
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCSCALES    259
C                                                                       SCALES    260
      INCLUDE 'PARAM.INS'                                               SCALES    261
      INCLUDE 'SOAPC1.INS'                                              SCALES    262
      INCLUDE 'DPPLOT.INS'                                              SCALES    263
                                                                        SCALES    264
C      IF(.NOT.DPINIT) THEN                                             SCALES    265
C         IPR=0                                                         SCALES    266
C         IDPR=LOUT                                                     SCALES    267
C         CALL DPSOAP('SETPAGE ',IPR,IDPR)                              SCALES    268
C         CALL DPSOAP('CLEARPAG',0,0)                                   SCALES    269
C         DPINIT=.TRUE.                                                 SCALES    270
C         SCALX=.FALSE.                                                 SCALES    271
C      ENDIF                                                            SCALES    272
                                                                        SCALES    273
C    .................................................                  SCALES    274
C    :Don't rescale X-axis if part of the same page  :                  SCALES    275
C    :                                               :                  SCALES    276
      IF(SCALX) THEN                                                    SCALES    277
         XSTRT=X1                                                       SCALES    278
         XMIN=X1                                                        SCALES    279
         XMAX=X2                                                        SCALES    280
      ENDIF                                                             SCALES    281
C    :...............................................:                  SCALES    282
      YSTRT(N1)=Y1                                                      SCALES    283
      YMIN(N1)=Y1                                                       SCALES    284
      YMAX(N1)=Y2                                                       SCALES    285
C      PRINT*,' INSIDE SCALED ',X1,X2,Y1,Y2                             SCALES    286
      RETURN                                                            SCALES    287
      END                                                               SCALES    288
                                                                        SCALES    289
      SUBROUTINE XRANGE(XX,XX1,XX2,YY1,YY2,N1,N2)                       SCALES    290
CD                                                                      SCALES    291
CD         THIS ROUTINE PARSE THE RANGE OF THE AXIS FOR SCALING         SCALES    292
CD                                                                      SCALES    293
CD            CALLING PARAMETERS :                                      SCALES    294
CD                                                                      SCALES    295
CD                           XX - ARRAY TO BE SCALED                    SCALES    296
CD                      XX1,XX2 - THE DETERMINED MAX/MIN VALUES FOR     SCALES    297
CD                                X-AXIS                                SCALES    298
CD                      YY1,YY2 - THE DETERMINED MAX/MIN VALUES FOR     SCALES    299
CD                                Y-AXIS                                SCALES    300
CD                          N1  - STARTING CURVE NUMBER                 SCALES    301
CD                         N2T  - ACTUAL NUMBER OF COLUMNS IN YARAY     SCALES    302
CD                                                                      SCALES    303
      INCLUDE 'PARAM.INS'                                               SCALES    304
      INCLUDE 'XYARAY.INS'                                              SCALES    305
      REAL XX(MXPT,MXPLOT)                                              SCALES    306
C      CALL DPXMAM(XX,MXPT,MAXPT,XX1,XX2,N1,N2)                         SCALES    307
      CALL DPYMAM(XX,MXPT,MAXPT,XX1,XX2,MXPLOT,N1,N2)                   SCALES    308
      CALL DPYMAM(YARAY,MXPT,MAXPT,YY1,YY2,MXPLOT,N1,N2)                SCALES    309
      RETURN                                                            SCALES    310
      END                                                               SCALES    311
                                                                        SCALES    312
                                                                        SCALES    313
      SUBROUTINE RANGE(XX,XX1,XX2,YY1,YY2,IDX1,IDX2,IW,N1,N2)           SCALES    314
CD                                                                      SCALES    315
CD      THIS ROUTINE FINDS THE RANGE OF THE XARAY AND TNE YARAY         SCALES    316
CD                                                                      SCALES    317
CD            CALLING PARAMETERS :                                      SCALES    318
CD                                                                      SCALES    319
CD                           XX - ARRAY TO BE SCALED                    SCALES    320
CD                      XX1,XX2 - THE DETERMINED MAX/MIN VALUES FOR     SCALES    321
CD                                X-AXIS                                SCALES    322
CD                      YY1,YY2 - THE DETERMINED MAX/MIN VALUES FOR     SCALES    323
CD                                Y-AXIS                                SCALES    324
CD                           IW - CONTROL FLAG                          SCALES    325
CD                                IW = 1 : SCALE X-AXIS                 SCALES    326
CD                                IW = 2 : SCALE Y-AXIS                 SCALES    327
CD                                IW = 3 : SCALE Y-AXIS                 SCALES    328
CD                    IDX1,IDX2 - INDEX OF START OF X1 AND END OF X2    SCALES    329
CD                           N1 - STARING CURVE NUMBER                  SCALES    330
CD                           N2 - ACTUAL NUMBER OF COLUMNS IN YARAY     SCALES    331
CD                                                                      SCALES    332
CD                                                                      SCALES    333
      INCLUDE 'PARAM.INS'                                               SCALES    334
      INCLUDE 'XYARAY.INS'                                              SCALES    335
      REAL XX(MXPT,MXPLOT)                                              SCALES    336
      INTEGER IDX1(MXPLOT),IDX2(MXPLOT)                                 SCALES    337
      IF(IW.EQ.3)THEN                                                   SCALES    338
        CALL DPYMAZ(YARAY,MXPT,MAXPT,YY1,YY2,IDX1,IDX2,                 SCALES    339
     1  MXPLOT,N1,N2)                                                   SCALES    340
      ELSE IF(IW.EQ.2)THEN                                              SCALES    341
        CALL DPYMAZ(XX,MXPT,MAXPT,YY1,YY2,IDX1,IDX2,                    SCALES    342
     1  MXPLOT,N1,N2)                                                   SCALES    343
      ELSE                                                              SCALES    344
        CALL DPXMAZ(XX,MXPT,MAXPT,XX1,XX2,IDX1,IDX2,                    SCALES    345
     1  MXPLOT,N1,N2)                                                   SCALES    346
      ENDIF                                                             SCALES    347
      RETURN                                                            SCALES    348
      END                                                               SCALES    349
