C+ C NAME: C Read_fft.f C PURPOSE: C Read fft-spectral values and power into arrays C CATEGORY: C I/O C CALLING SEQUENCE: C call Read_fft(cfile,specval,power,Nspec,iRead_fft) C C INPUTS: C Read_fft: C cfile character The fft power spectrum input file C C OUTPUTS: C specval real the input spectral frequencies C power real the input spectral power C Nspec integer the number of input powers C iRead_fft integer if 0 the file has been read C C MODIFICATION HISTORY: C October-2013, Bernard Jackson (UCSD) C- subroutine read_fft(cFile,specval,power,Nspectry,Nspec,iRead_fft) character cFile*25 ! The fft power spectrum input file character cFmt8*8 /'(2F15.8)'/ ! the spectral input format real specval (Nspec), ! The input spectral frequencies & power (Nspec) ! The input spectral power C open (iU, file=cFile,status='old',recl=120,access='sequential',form='formatted',iostat=iRead_fft) if(iRead_fft.ne.0) then print *, 'No fft file of this name exists in the directory ', cfile close(iU) return ! No file exists end if print *, ' ' write (*,'(A25)') 'inside read fft',cFile i = 1 do II=1,Nspectry read (iU,cFmt8,iostat=iRead_fftd) specval(i),power(i) if(iRead_fftd.eq.0) then i = i + 1 if(i.eq.Nspectry+1) then Nspec = i - 1 print *, ' ' write(*,'(A,I4)') ' Not all spectrum read. The number of spectral values is =',Nspec write(*,'(A,F10.4,F15.10)') ' The last spectral value and power is =',specval(Nspec),power(Nspec) close(iU) return end if else Nspec = i - 1 print *, ' ' write(*,'(A,I4)') ' The number of spectral values is =',Nspec write(*,'(A,F10.4,F15.10)') ' The last spectral value and power is =',specval(Nspec),power(Nspec) close(iU) return end if end do Nspec = i print *, ' ' write(*,'(A,I4)') ' Not all spectrum read. The number of spectral values is =',Nspec write(*,'(A,F10.4,F15.10)') ' The last spectral value and power is =',specval(Nspec),power(Nspec) close(iU) C return end