      SUBROUTINE READ4(ISP,IX,IY,ISVE,ISH,ITYP,HMAX,X3,Y,TITX,
     1 TITY,TYPE,TITL,SANG,EANG,LBL,IHDR,IHEM)
C READ4 IS A SUBROUTINE TO INITIALIZE ALL OF THE NEW PLOT AND CONTOUR
C CONTROLLING PARAMETERS.  THESE ARE EITHER READ FROM FT04F001 OR
C CALCULATED.
      CHARACTER*1 TITL(80)
      CHARACTER*16 TITX,TITY,TITLES(13),TYPE
C COMMON /OPTION/ IS A COMMON BLOCK USED BY THE WOLFPLOT CONTOUR PACKAGE
      COMMON /OPTION/IMIN,IMAX,JMIN,JMAX,FINTER,NUMV,CONTUR(50)
      SAVE
C TITLES HOLDS THE VARIOUS TITLES ASSOCIATED WITH DIFFERENT CHOICES OF
C INPUT PARAMETERS.
      DATA TITLES/' LATITUDE (DEG) ',' TIME (MINUTES) ',
     1' TIME (SECONDS) ',' LONGITUDE (DEG)',' ALTITUDE (KM)  ',
     2' DISTANCE (KM)  ','ELECTRON DENSITY','PLASMA FREQUENCY',
     3'     FN/FH      ',' X-MODE CUTOFF  ',' Z-MODE CUTOFF  ',
     4'  UPPER HYBRID  ','      FH        '/
C HMAX IS THE MAXIMUM ALTITUDE SHOWN ON THE ELECTRON DENSITY PROFILES
C AND THE CONTOURS.  IT DEFAULTS TO 4000 KM, AND SHOULD BE A MULTIPLE OF
C 500 KM, NO LARGER THAN 4000 KM.
                                                                        
C FOR VAX OPEN FILE
C      OPEN(UNIT=4,NAME='NH2.DAT',TYPE='OLD',FORM='FORMATTED',READONLY)
      HMAX=4000.
      FINTER=0.
      NUMV=8
      IMIN=1
      IMAX=80
      JMIN=1
      JMAX=80
C THE FOLLOWING DEFAULT CONTOUR LEVELS ARE USED ONLY FOR ELECTRON
C DENSITY CONTOURS.
      CONTUR(1)=1.E2
      CONTUR(2)=3.E2
      CONTUR(3)=1.E3
      CONTUR(4)=3.E3
      CONTUR(5)=1.E4
      CONTUR(6)=3.E4
      CONTUR(7)=1.E5
      CONTUR(8)=3.E5
C WE NOW READ IN THE MAXIMUM ALTITUDE, AND NUMBER OF CONTOUR LEVELS.
      READ(4,1100) HMAX1,NUMV1
 1100 FORMAT(F6.0,I2)
C WE NOW CHECK FOR NEW CONTOUR LEVELS, IF THE DEFAULT IS NOT BEING USED.
      IF(NUMV1.LE.0) GO TO 1
      NUMV=NUMV1
      READ(4,1200) (CONTUR(I),I=1,NUMV)
 1200 FORMAT(8E10.3)
C WE NOW SET THE MAXIMUM ALTITUDE, IF THE DEFAULT IS NOT BEING USED.
    1 IF(HMAX1.LE.0) GO TO 2
      HMAX=HMAX1
    2 CONTINUE
C WE NOW READ IN A SERIES OF FLAGS:
C          ISP CONTROLS THE USE OF SATELLITE AND F-PEAK POINTS ON THE
C               CONTOURS(0=NONE,1=SATELLITE,2=F-PEAK,3=BOTH).
C          IX CONTROLS THE X AXIS ON CONTOURS (0=LATITUDE, 1=TIME(SECS),
C               2=TIME(MINS), 3=LONGITUDE).
C          IY CONTROLS Y AXIS(0=ALTITUDE, 1=DISTANCE FROM SATELLITE).
C          ISVE IS NOT YET IMPLEMENTED.
C          IHDR CONTROLS THE PLOTTING OF TITLES(0=YES, 1=NO).
C          ISH CONTROLS THE CONTOUR SHAPE(0=NONE, 1=FLAT EARTH,
C               2=CURVED EARTH, 3=PLOT BOTH CONTOURS).
C          ITYP CONTROLS THE VALUE BEING CONTOURED (0=ELECTRON
C               DENSITY, 1=FN, 2=FN/FH, 3=FX, 4=FZ, 5=FT, 6=FH).
C          LBL CONTROLS THE LABELING OF CONTOUR LINES (SEE WOLFPLOT
C               CONTOURING MANUAL FOR DETAILS).
      READ(4,1000) ISP,IX,IY,ISVE,IHDR,ISH,ITYP,LBL
 1000 FORMAT(7I1,I2)
C FOR CONTOURS OTHER THAN ELECTRON DENSITY FOR WHICH NON-DEFAULT
C CONTOUR LEVELS HAVE NOT BEEN SET, SET NEW DEFAULTS.
      IF(ITYP.EQ.0.OR.NUMV1.NE.0) GO TO 3
      CONTUR(1)=.1
      CONTUR(2)=.5
      CONTUR(3)=1.
      CONTUR(4)=2.
      CONTUR(5)=3.
      CONTUR(6)=4.
      CONTUR(7)=5.
      CONTUR(8)=6.
C IF HEADERS ARE TO BE USED, READ IN A USER SPECIFIED TITLE.
    3 IF(IHDR.EQ.0) READ(4,2000) (TITL(I),I=1,80)
 2000 FORMAT(80A1)
      TITX=TITLES(IX+1)
      TITY=TITLES(IY+5)
      TYPE=TITLES(ITYP+7)
C NOW THAT THE TITLES HAVE BEEN SELCTED, CHECK FOR CURVED-EARTH CONTOURS
C IF THEY ARE PRESENT, READ IN THE START AND END ANGLES DESIRED FOR THE
C CONTOURS (IN DEGREES).
      IF(ISH.GT.1) READ(4,3000) SANG,EANG
 3000 FORMAT(2F6.2)
C
C  SET NORTH-SOUTH HEMISHERE FLAG,IHEM
C  IHEM=1 - SOUTHERN HEMISPHERE
C  IHEM=-1 - NORTHERN HEMISPHERE
C
      IF(ISH .GT. 1 .AND. SANG .LT. 0.) IHEM=1
      IF(ISH .GT. 1 .AND. SANG .GT. 0.) IHEM=-1
C
C
C PRINT OUT CONTROLLING VALUES
C
       WRITE(6,4000)
 4000  FORMAT(1X,'INITIAL CONDITIONS:')
      WRITE(6,4002)HMAX
 4002 FORMAT(1X,'MAX ALTITUDE(KM) ',F6.0)
      WRITE(6,4003)
 4003 FORMAT(1X,'CONTOUR LEVELS ')
      WRITE(6,4004) (CONTUR(I),I=1,NUMV)
 4004 FORMAT(1X,E10.3)
       JUMP=ISP+1
       GOTO (4010,4020,4030,4040),JUMP
 4010  WRITE(6,4015)
 4015  FORMAT(1X,'NO CONTOUR CONTROLS')
       GOTO 4100
 4020  WRITE(6,4025)
 4025  FORMAT(1X,'SATELLITE CONTOUR CONTROLS')
       GOTO 4100
 4030  WRITE(6,4035)
 4035  FORMAT(1X,'F-PEAK  CONTOUR CONTROLS')
       GOTO 4100
 4040  WRITE(6,4045)
 4045  FORMAT(1X,'BOTH SATELLITE AND F-PEAK CONTOUR CONTROLS')
 4100  JUMP=IX+1
       GOTO(4110,4120,4130,4140),JUMP
 4110  WRITE(6,4115)
 4115  FORMAT(1X,'X-AXIS - LATITUDE')
       GOTO 4200
 4120  WRITE(6,4125)
 4125  FORMAT(1X,'X-AXIS - TIME(SECS)')
       GOTO 4200
 4130  WRITE(6,4135)
 4135  FORMAT(1X,'X-AXIS - TIME(MINS)')
      GOTO 4200
 4140 WRITE(6,4145)
 4145 FORMAT(1X,'X-AXIS - LONGITUDE')
 4200 JUMP=IY+1
      GOTO(4210,4220),JUMP
 4210 WRITE(6,4215)
 4215 FORMAT(1X,'Y-AXIS - ALTITUDE')
      GOTO 4300
 4220 WRITE(6,4225)
 4225 FORMAT(1X,'Y-AXIS - DISTANCE FROM SATELLITE')
 4300 JUMP=ISH+1
      GOTO(4310,4320,4330,4340),JUMP
 4310 WRITE(6,4315)
 4315 FORMAT(1X,'NO CONTOURS')
      GOTO 4400
 4320 WRITE(6,4325)
 4325 FORMAT(1X,'FLAT EARTH CONTOURS')
      GOTO 4400
 4330 WRITE(6,4335)
 4335 FORMAT(1X,'CURVED EARTH CONTOURS')
      GOTO 4400
 4340 WRITE(6,4345)
 4345 FORMAT(1X,'BOTH CONTOURS PLOTTED')
 4400 JUMP=ITYP+1
      GOTO(4410,4420,4430,4440,4450,4460,4470),JUMP
 4410 WRITE(6,4415)
 4415 FORMAT(1X,'ELECTRON DENSITY CONTOURED')
      GOTO 4500
 4420 WRITE(6,4425)
 4425 FORMAT(1X,'FN CONTOURED')
      GOTO 4500
 4430 WRITE(6,4435)
 4435 FORMAT(1X,'FN/FH CONTOURED')
      GOTO 4500
 4440 WRITE(6,4445)
 4445 FORMAT(1X,'FX CONTOURED')
      GOTO 4500
 4450 WRITE(6,4455)
 4455 FORMAT(1X,'FZ CONTOURED')
      GOTO 4500
 4460 WRITE(6,4465)
 4465 FORMAT(1X,'FT CONTOURED')
       GO TO 4500
 4470  WRITE(6,4475)
 4475  FORMAT(1X,'FH CONTOURED')
 4500 WRITE(6,4510)SANG,EANG
 4510 FORMAT(1X,'START ANGLE ',F6.2,4X,'END ANGLE ',F6.2)
C NOW CALCULATE THE MAXIMUM SCALING FACTOR AND CORRESPONDING CENTER
C OF EARTH POINT. THIS WILL GIVE THE LARGEST POSSIBLE CURVED EARTH
C CONTOUR WITH X AND Y SCALES EQUAL.
      X1=1793.5/((6371.2+HMAX)*SIN(ABS(EANG-SANG)/(2*57.29578)))
      X2=2525.5/((6371.2+HMAX)-6371.2*COS((EANG-SANG)/(2*57.29578)))
      X3=AMIN1(X1,X2)*0.9
      Y=355.-X3*6371.2*COS((EANG-SANG)/(2*57.29578))
      RETURN
      END
