program met_read c c This program reads daily or hourly TAO/TRITON and PIRATA ascii c format met files for example met0n110w_dy.ascii. It creates c real time series arrays which are evenly spaced in time of c zonal and meridional winds (uwnd and vwnd), wind speed, wind c direction, relative humidity (rh), and air temperature (airt), c and Sea Surface Temperature. c c Also created are integer arrays of data quality. c c You can easily adapt this program to your needs. c c Programmed by Dai McClurg, NOAA/PMEL/OCRD, August 1999. c implicit none c integer nt parameter(nt = 1000000) c integer n, m c integer nblock, nn, ntime, n1, n2 c integer idate(nt), ihms(nt) integer iquwnd(nt), iqvwnd(nt), iqspd(nt), iqdir(nt), iqairt(nt) integer iqsst(nt), iqrh(nt) c real uwnd(nt), vwnd(nt), spd(nt), dir(nt) real airt(nt), sst(nt), rh(nt) real flag c real depuwnd, depvwnd, depspd, depdir real depairt, depsst, deprh integer idy, ihr c character infile*80, header*132, line*132 c c ....................................................................... c write(*,*) ' Enter the input met file name ' read(*,'(a)') infile c idy = index(infile, 'dy') ihr = index(infile, 'hr') c open(1,file=infile,status='old',form='formatted') c c Read total number of hours and blocks of data and missing data flag c if(idy .ne. 0) then read(1,10) ntime, nblock 10 format(49x,i5,7x,i3) write(*,*) ntime, nblock read(1,20) flag 20 format(72x,f6.1) write(*,*) flag else read(1,11) ntime, nblock 11 format(59x,i7,7x,i3) write(*,*) ntime, nblock read(1,21) flag 21 format(72x,f6.1) write(*,*) flag endif c read(1,'(a)') header c c Initialize data arrays to flag and quality arrays to 5. c do n = 1, nt uwnd(n) = flag vwnd(n) = flag spd(n) = flag dir(n) = flag airt(n) = flag sst(n) = flag rh(n) = flag iquwnd(n) = 5 iqvwnd(n) = 5 iqspd(n) = 5 iqdir(n) = 5 iqairt(n) = 5 iqsst(n) = 5 iqrh(n) = 5 enddo c c Read the data. c do m = 1, nblock if(idy .ne. 0) then read(1,30) n1, n2, nn else read(1,31) n1, n2, nn endif read(1,'(a)') line read(line(15:56),*) depuwnd, depvwnd, depspd, depdir, . depairt, depsst, deprh read(1,'(a)') header do n = n1, n2 read(1,60) idate(n), ihms(n), uwnd(n), vwnd(n), spd(n), . dir(n), airt(n), sst(n), rh(n), iquwnd(n), . iqvwnd(n), iqspd(n), iqdir(n), iqairt(n), . iqsst(n), iqrh(n) enddo enddo c 30 format(50x,i5,3x,i5,x,i5) 31 format(50x,i7,3x,i7,x,i7) 50 format(14x,7i6) 60 format(x,i8,x,i4,4f6.1,2f6.2,f6.1,x,7i1) c close(1) c c Now write out the data and quality arrays to the standard output. c write(*,*) depuwnd, depvwnd, depspd, depdir, depairt, . depsst, deprh c do n = 1, ntime write(*,60) idate(n), ihms(n), uwnd(n), vwnd(n), spd(n), . dir(n), airt(n), sst(n), rh(n), iquwnd(n), . iqvwnd(n), iqspd(n), iqdir(n), iqairt(n), . iqsst(n), iqrh(n) enddo c end