program adcp_read c c This program reads daily or hourly TAO/TRITON ascii-format c ADCP files, for example adcp0n110w_dy.ascii. It creates arrays c u and v, which are evenly spaced in time. 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 c NOTE: you may want to adjust the parameters nz,nt to match c the dimensions of your file c integer nz, nt parameter(nz = 100, nt = 50000) c real u(nz,nt), v(nz,nt), depth(nz) c integer ndep, ntim c integer k, n, m c integer nblock, nk, ndep, nn, n1, n2, nl c integer kdep(nz), idep(nz) integer idate(nt), ihms(nt) c real flag c character infile*80, header*132 c c ....................................................................... c write(*,*) ' Enter the input file name' read(*,'(a)') infile c open(1,file=infile,status='old',form='formatted') c c Read total number of times, depths and blocks of data. c read(1,'(a)') header read(1,26,end=911) ntim, ndep, nblock 26 format(i8,7x,i3,8x,i3) write(*,*) ntim, ndep, nblock c c Read the missing data flag c read(1,20) flag 20 format(45x,f8.2) write(*,*) flag read(1,'(a)') header c c Initialize arrays. c do k = 1, nz do n = 1, nt u(k,n) = flag v(k,n) = flag enddo enddo c c Read the data c do m = 1, nblock read(1,'(a)') header read(1,30) n1, n2, nn, nk nl = int(real(nk) / 8.0) read(1,140) (kdep(k),k=1,nk) read(1,150) (idep(kdep(k)),k=1,nk) do k = 1, nk depth(kdep(k)) = real(idep(kdep(k))) enddo read(1,'(a)') header do n = n1, n2 nl = int(2*real(nk) / 8.0) read(1,160) idate(n), ihms(n), . (u(kdep(k),n),v(kdep(k),n),k=1,nk) enddo enddo 911 close(1) c 30 format(12x,i8,3x,i8,x,i8,7x,i3) 140 format(13x,8i6,(/,13x,8i6)) 150 format(13x,8i6,(/,13x,8i6)) 160 format(x,i8,x,i4,8f6.1,(/,14x,8f6.1)) c c Write out the depth, data, and quality arrays to the c standard output. c write(*,*) 'depth = ', (depth(k),k=1,ndep) c c For some files this statement may be too long for your max output c record length on your terminal. If so, comment out these lines. c do n = 1, ntim write(*,70) idate(n), ihms(n), (u(k,n),v(k,n),k=1,ndep) enddo c 70 format(x,i8,x,i6,x,<2*ndep>f6.1,x,<2*ndep>i1,i7) c end