program s_hr_read c c This program reads TAO/TRITON and PIRATA ascii-format salinity c files, for example s0n110w_hr.ascii. It creates an array called c s, which is evenly spaced in time, an array called iqual c which contains the data quality for each depth, an array c called isrc which contains the source codes, and an c array called inst which contains the instrument ID codes. c c For definitions of these codes, see the readme file which c came with your data. 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 nz, nt parameter(nz = 20, nt = 200000) c integer k, n, m c integer nblock, nk, ndep, nn, ntime, n1, n2 c integer kdep(nz) integer iqual(nz,nt), isrc(nz,nt), inst(nz,nt) integer idate(nt), ihms(nt) c real flag, depth(nz), s(nz,nt) c character infile*80, header*132, depline*256 c c ....................................................................... c write(*,*) ' Enter the input salinity file name' read(*,'(a)') infile c open(1,file=infile,status='old',form='formatted') c c Read total number of days, depths and blocks of data. c read(1,10) ntime, ndep, nblock 10 format(59x,i7,7x,i3,8x,i3) c write(*,*) ntime, ndep, nblock c c Read the missing data flag c read(1,20) flag c 20 format(40x,f7.3) c write(*,*) flag c c Initialize t array to flag and iqual array to 5. c do k = 1, nz do n = 1, nt s(k,n) = flag iqual(k,n) = 5 isrc(k,n) = 5 inst(k,n) = 5 enddo enddo c c Read the data c do m = 1, nblock read(1,30) n1, n2, nn, nk read(1,140) (kdep(k),k=1,nk) read(1,'(a)') depline read(depline(15:),*) (depth(kdep(k)),k=1,nk) read(1,'(a)') header do n = n1, n2 read(1,160) idate(n), ihms(n), . (s(kdep(k),n),k=1,nk), . (inst(kdep(k),n),k=1,nk), . (iqual(kdep(k),n),k=1,nk), . (isrc(kdep(k),n),k=1,nk) enddo enddo c 30 format(50x,i8,3x,i8,x,i8,7x,i3) 140 format(15x,i7) 160 format(x,i8,x,i4,x,f7.3,x,i2,x,i1,x,i1) c close(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 nk = ndep c do n = 1, ntime write(*,70) idate(n), ihms(n), (s(k,n),k=1,ndep), . (inst(k,n),k=1,ndep) . (iqual(k,n),k=1,ndep), . (isrc(k,n),k=1,ndep), n enddo c 70 format(x,i8,x,i4,x,f7.3,x,i2,x,i1,x,i1,i7) c end