C
C *** FOURIER TRANSFORM FROM WAVE TO FOURIER COEFFICIENTS
C *** USE SUBROUTINE WVFAST
C
      SUBROUTINE WVFOUR(WV,NWV,MWV,FOUR,NFAST)
C
C INPUT DATA
C *** WV(I)   : WAVE DATA
C *** NWV     : WAVE DATA NUMBER
C *** MWV     : NWV IN MAIN PROGRAM DIMENDION
C             : IF MWV > 2**13(=8192), CAN NOT USE !!!
C OUTPUT DATA
C *** FOUR(I) : FOUREIR COEFFICIENTS
C    ( FOURIER SPECTRUM = FOURIER COEFFICIENTS * DURATION/2.0 )
C *** NFAST   : DATA NUMBER OF FOURIER SPECTRUM ( 2**N ) > NWV
C
      DIMENSION WV(32800)
      COMPLEX*8 FOUR(32800)
C
C *** MWV CHECK ***
C
      IF(MWV.NE.32800)THEN
      WRITE(*,*)' FROM SUBROUTINE WVFOUR :'
      WRITE(*,*)' MWV.NE.32800 !!!!, THEN STOP !!!!'
      STOP
      END IF
C
C *** SEARCH OF FOURIER SPECTRUM DATA NUMBER ( = 2**IFAST ) > NWN ***
C
      NFAST=2
      DO 100 I=2,15
        NFAST=2*NFAST
        IF(NFAST.GE.NWV)GOTO 10
  100 CONTINUE
      WRITE(*,*)
      WRITE(*,*)' FROM SUBROUTINE WVFOUR :'
      WRITE(*,*)' WAVE DATA NUMBER > 2**15(=32768), THUS STOP !!!'
      STOP
   10 IFAST=I
C
C *** DATA ECHO ***
C
      WRITE(*,*)
      WRITE(*,*)'FROM SUBROUTINE WVFOUR :'
      WRITE(*,1000)NFAST,IFAST
 1000 FORMAT(' TOTAL WAVE DATA NUMBER IN FFT ( 2**N ) =',I6,',  N =',I3)
      WRITE(*,*)
C
C *** INITIALIZE OF WAVE DATA
C
      DO 200 I=1,NWV
        FOUR(I)=CMPLX(WV(I),0.0)
  200 CONTINUE
      DO 300 I=NWV+1,NFAST
        FOUR(I)=(0.0,0.0)
  300 CONTINUE
C
C *** FOURIER TRANSFORM FROM WAVE TO SPECTRUM ***
C
      CALL WVFAST(NFAST,FOUR,MWV,-1)
C
      DFAST=FLOAT(NFAST)
      DO 400 I=1,NFAST
        FOUR(I)=FOUR(I)/DFAST
  400 CONTINUE
C
      RETURN
      END
       