program rain_hr_read c c This program reads anonymous FTP ascii format hourly rain files, c for example 0n156e_hr.rain. It creates real time series arrays c which are evenly spaced in time. c c Also created is an integer array of quality c c You can easily adapt this program to your needs. c c Programmed by Dai McClurg, NOAA/PMEL/OCRD, April 1999 c implicit none c integer nt parameter(nt = 6000 * 24) c integer n, m c integer nblock, nn, nhour, n1, n2 c integer idate(nt), ihour(nt) integer iqrain(nt) c c perc: percent of the hour when rain rate was above threshold (1 mm/hr) c mean: mean rainfall rate (mm/hr) c std: rainfall standard deviation during the hour (mm/hr) c peak: maximum rainfall rate during the hour (mm/hr) c real perc(nt), mean(nt), std(nt), peak(nt), flag c integer iperc, imean, istd, ipeak c real depperc, depmean, depstd, deppeak c character infile*80, header*132 c c ....................................................................... c write(*,*) ' Enter the input hourly Rain file name ' read(*,'(a)') infile c open(1,file=infile,status='old',form='formatted') c c Read total number of hours and blocks of data. c read(1,10) nhour, nblock 10 format(63x,i7,7x,i3) c write(*,*) nhour, nblock c c Read the missing data flag c read(1,20) flag 20 format(55x,f6.1) c write(*,*) flag c c Initialize data arrays to flag and quality arrays to 5. c do n = 1, nt perc(n) = flag mean(n) = flag std(n) = flag peak(n) = flag iqrain(n) = 5 enddo c c Read the data. c do m = 1, nblock read(1,30) n1, n2, nn read(1,50) depperc, depmean, depstd, deppeak read(1,'(a)') header do n = n1, n2 read(1,60) idate(n), ihour(n), iperc, imean, . istd, ipeak, iqrain(n) perc(n) = real(iperc) mean(n) = real(imean) std(n) = real(istd) peak(n) = real(ipeak) enddo enddo c 30 format(54x,i7,3x,i7,x,i7) 50 format(16x,4f7.1) 60 format(x,i8,x,i6,4i7,x,i1) c close(1) c c Now write out the data and quality arrays to the standard output. c write(*,*) depperc, depmean, depstd, deppeak c do n = 1, nhour write(*,60) idate(n), ihour(n), nint(perc(n)), nint(mean(n)), . nint(std(n)), nint(peak(n)), iqrain(n) enddo c end