subroutine reader_cs(fndata,datath,ms,dt,npts,ier) c c read 3d recording from datafile in City Shark format c (readercs.f v.1.3) c implicit none character fndata*200 integer ms, npts, ier real datath, dt dimension datath(ms,3) c integer ckesfi, nw, i, j, nunit, igain, iconv character row*200, argout(20)*200, sep2*1 parameter (sep2 = ':') real gain, sfre, dura, conv c ier = 0 call glun(nunit, ier) if ( ier .ne. 0 ) then ier = 1 return endif c if ( ckesfi(fndata) .ne. 0 ) then ier = 1 return endif c open(nunit,file=fndata,status='old',err=98) c c---------------------- READ CITYSHARK HEADER -------- dura=-100.0 dt = -1.0e+15 npts = -100000 gain = 1.0 igain = 0 iconv = 0 conv = 1.0 do 17 i = 1, 1000 c read(nunit,200,err=97,end=96)row call split3(row,argout,sep2,nw) if ( argout(1) .eq. 'Maximum' ) goto 13 if ( argout(1) .eq. 'Sample' ) then if ( argout(2) .eq. 'rate' ) then read(argout(3),*,err=96)sfre dt = 1.0/sfre elseif ( argout(2) .eq. 'number' ) then read(argout(3),*,err=96)npts endif elseif ( argout(1) .eq. 'Gain' ) then read(argout(2),*,err=96)gain igain = 1 elseif ( argout(1) .eq. 'Conversion' ) then iconv = 1 read(argout(3),*,err=96)conv elseif ( argout(1) .eq. 'Recording' ) then read(argout(3),*,err=96)dura dura = dura * 60.0 endif c 17 continue goto 96 13 continue if ( dt .lt. 0.0 ) goto 96 if ( npts .lt. 0 ) then if ( dura .lt. 0.0 ) goto 96 npts = int(sfre * dura + 0.5) endif c if ( npts .gt. ms ) then ier = 1 return endif c---------------------------------------------------------- do 1 i = 1, npts read(nunit,*,err=97,end=95)(datath(i,j),j=1,3) 1 continue c close(nunit) c if ( igain .eq. 1 ) then do 24 j = 1, 3 do 23 i = 1, npts datath(i,j) = datath(i,j) / gain 23 continue 24 continue endif c if ( iconv .eq. 1 ) then do 34 j = 1, 3 do 33 i = 1, npts datath(i,j) = datath(i,j) / conv 33 continue 34 continue endif c return c 98 ier = 1 close(nunit) return c 97 ier = 1 close(nunit) return c 96 ier = 2 close(nunit) return c 95 ier = 1 close(nunit) return c 200 format(a200) end