C
C *** INCIDENT WAVE = ROCK SURFACE WAVE / ROCK AMP FACTOR ***
C *** SEDIMENT SURFACE WAVE = SEDIMENT AMP FACTOR * INCIDENT WAVE ***
C
      PROGRAM MWVRS
C
C PARAMETER
C *** MWV    : WAVE AMPLITUDE DATA IN MAIN PROGRAM DIMENSION
C            : IF MWV > 2**13(=8192), CAN NOT USE IN SUBROUTINE !!!
C READ DATA FROM FILE
C *** TITL   : TITLE OF EACH CHANNEL
C *** WV     : WAVE AMPLITUDE DATA
C *** NWV    : WAVE DATA NUMBER
C *** DT     : DELTA TIME ( SEC )
C DATA FOT PLOTTER
C *** FOUR(I): FOURIER COEFFICIENTS OR SPECTRUM
C            : FOURIER SPECTRUM = FOURIER COEFFICIENTS * DURATION/2.0
C
      PARAMETER(ML=30,MWV=9000)
      CHARACTER TITL*50,FNAME*30
      DIMENSION DNS(ML),DEP(ML),VS(ML),QF(ML),WV(MWV)
      COMPLEX*8 FOUR(MWV)
C
      WRITE(*,*)
      WRITE(*,*)'MWVRS;'
      WRITE(*,*)'SEDIMENT SURF WAVE = SEDIMENT AMP FAC * INCIDENT WAVE'
      WRITE(*,*)'INCIDENT WAVE = ROCK SURFACE WAVE / ROCK AMP FACTOR'
C
C *** INCIDENT WAVE = ROCK SURFACE WAVE / ROCK AMP FACTOR ***
C
      WRITE(*,*)
      WRITE(*,*)' INPUT OF THE ROCK SURFACE WAVE DATA;' 
      WRITE(*,*)
      CALL WVREAD(TITL,WV,NWV,MWV,DT)
      WRITE(*,*)
      WRITE(*,*)' INPUT OF ROCK SOIL DATA;' 
      WRITE(*,*)
      CALL SOILIN(FOM,DOM,NOM,DNS,VS,DEP,QF,NQF,NL,ML,THETA,NSF)
      CALL WVFOUR(WV,NWV,MWV,FOUR,NFAST)
C
      DUR=FLOAT(NFAST)*DT
      FOM=0.0
      DOM=6.2831853070/DUR
      NOM=NFAST/2+1
      CALL WVSHMR(FOM,DOM,NOM,MWV,DNS,VS,DEP,QF,NQF
     *           ,NL,ML,THETA,NSF,FOUR)
C
C *** SEDIMENT SURFACE WAVE = SEDIMENT AMP FACTOR * INCIDENT WAVE ***
C
      WRITE(*,*)
      WRITE(*,*)' INPUT OF SEDIMENT SOIL DATA;' 
      WRITE(*,*)
      CALL SOILIN(FM,DM,NM,DNS,VS,DEP,QF,NQF,NL,ML,THETA,NSF)
      CALL WVSHML(FOM,DOM,NOM,MWV,DNS,VS,DEP,QF,NQF
     *           ,NL,ML,THETA,NSF,FOUR)
C
C *** OUTPUT OF SPEC DATA TO FILE FOR LAZER SHOT ***
C
      WRITE(*,*)
   10 WRITE(*,1000)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 10
      WRITE(*,1010)
      READ(*,*)IWS
 1000 FORMAT( ' From MWVRS : '
     *       /' Enter spec file name for Lazer Shot : ',\)
 1010 FORMAT(/' Enter Weak(=0) or Strong(=1) Data   : ',\)
C      
      OPEN(8,FILE=FNAME)
        WRITE(8,1100)DOM,NOM-1
        WRITE(8,1110)
        IF(IWS.EQ.1)THEN
          DO 100 K=2,NOM,5
            WRITE(8,1120)(FOUR(K+J)*DUR,J=0,4)
  100     CONTINUE
        ELSE
          DO 200 K=2,NOM,5
            WRITE(8,1130)(FOUR(K+J)*DUR,J=0,4)
  200     CONTINUE
        END IF
      CLOSE(8)
C
 1100 FORMAT(F15.8,I15)
 1110 FORMAT(///)
 1120 FORMAT(10F8.2)
 1130 FORMAT(10F8.5)
C
      STOP
      END
