C
C *** WAVE READ, FOURIER TRANS., AMPLITUDE OF LOVE WAVE
C     SPECTRUM PLOT, INVERSE FOURIER TRANS., AND WAVE PLOT
C
      PROGRAM MWV
C
C ** PARAMETER **
C MWVN : WAVE NUMBER
C ** INPUT DATA **
C TITL  : TITLE OF EACH CHANNEL
C WV    : WAVE AMPLITUDE DATA
C NWV   : WAVE DATA NUMBER
C DT    : DELTA TIME ( SEC )
C ** CALCURATED DATA **
C FOUR(I)  : FOURIER COEFFICIENTS OR SPECTRUM
C          : FOURIER SPECTRUM = FOURIER COEFFICIENTS * DURATION/2.0
C
      PARAMETER(MWVN=9000)
      IMPLICIT REAL*8(A-H,O-Z)
      CHARACTER TITL*50,FNAME*30
      DIMENSION WV1(MWVN),WV2(MWVN)
      COMPLEX*16 FOUR(MWVN)
C
C *** HEAD ***
C
      WRITE(*,1000)
      WRITE(*,1010)MWVN
 1000 FORMAT(/' From MWV (main): multiple wave data1 and data2'
     *    /'    Delta time of data1 must be shorter than that of data2')
 1010 FORMAT( '   MWVN =',I5)  
C
C *** FIRST WAVE DATA INPUT ***
C
      CALL WVIN(WV1,NFAST1,MWVN,DT1)
C
   10 WRITE(*,1100)
      READ(*,*)IYES
      IF(IYES.NE.0)GOTO 20
 1100 FORMAT(/' From MWV : Multiple other wave data (yes=0)? : ',\)
C
C *** OTHER WAVE DATA INPUT AND CHECK ***
C
      CALL WVIN(WV2,NFAST2,MWVN,DT2)
C
      N21=IDINT(DT2/DT1)
      IF(N21.NE.1)THEN
        WRITE(*,*)' DT2/DT1.NE.1 !!!!, thus stop !!!, use MWVA.FOR !!'
        STOP
      END IF
C
C *** MULTIPLE DATA1 AND DATA2 ***
C
      DO 100 I=1,NFAST2
        WV1(I)=WV1(I)+WV2(I)
  100 CONTINUE
C
      GOTO 10
C
C *** WAVE DATA PLOT ***
C
   20 CALL WVPT(TITL,WV1,NFAST1,MWVN,DT1)
      NWV=NFAST1
      CALL WVFR(WV1,NWV,MWVN,FOUR,NFAST1,DT1)
C
      DUR=DFLOAT(NFAST1)*DT1
      FOM=0.0D0
      DOM=6.2831853070D0/DUR
      NOM=NFAST1/2+1
C
C *** OUTPUT OF SPEC DATA TO FILE FOR LAZER SHOT ***
C
      WRITE(*,*)
   11 WRITE(*,1001)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 11
 1001 FORMAT( ' From MLVWV : '
     *       /' Enter spec file name for Lazer Shot : ',\)
C      
      OPEN(8,FILE=FNAME)
        WRITE(8,1101)DOM,NOM-1
        WRITE(8,1111)
        DO 101 K=2,NOM,5
          WRITE(8,1121)(FOUR(K+J)*DUR,J=0,4)
  101   CONTINUE
      CLOSE(8)
C
 1101 FORMAT(F15.8,I15)
 1111 FORMAT(///)
 1121 FORMAT(10F8.2)
C
C *** TRANS. FROM FOURIER COEFF. TO AMPLITUDE SPECTRUM ***
C
      DO 150 I=1,NOM
        WV1(I)=CDABS(FOUR(I))*DUR
  150 CONTINUE
C
C *** SPECTRUM DATA PLOT ***
C
      CALL SPPT(FOM,DOM,NOM,MWVN,WV1)
C
      STOP
      END
