c subroutine rdshuttl(flnm,lu,iseclim,mxpts, + satut,satlat,satlon,satalt,npts,iydsat,ier) c c Read shuttle sat attitude file from file flnm on unit lu, limited to times c between iseclim(1) and iseclim(2). c (adapted 3/29/94 from rduars.f) c These files are on mss in /FOSTER/shuttle -- they were received 6/93 c from John Wise and Brian Sullivan (see also ~/jwise and /d/foster/jwise) c (note the original files obtained from John were altered by c ~/jwise/shuttle/fixfiles.f before being written to mss) c As of 6/93, these files are 1991 data. Julian day read is in this year c (JD 119 = Apr 29, 1991) c c On input: c flnm = mss path to sat file c lu = fort logical unit to which flnm may be attached c iseclim(2) = ut limits within which to read sat data (seconds) c mxpts = dimension of sat data c On output: c satut,satlat,satlon,satalt have been defined up to npts c npts = number of points read c iydsat = year-day of sat data c ier = 0 if no errors c character*(*) flnm character*80 rec80,errmsg,flnm1,disk logical isopen,exists dimension satut(mxpts),satlat(mxpts),satlon(mxpts),satalt(mxpts), + iseclim(2) data iyr/91/, irw/1/ save irw c c Get sat attitude file from mss: c (if not already obtained in previous call) c (also make sure opened file is the one requested) c ier = 0 len = lenstr(flnm) inquire(lu,opened=isopen) if (isopen) then inquire(lu,name=flnm1) if (flnm1(1:lenstr(flnm1)).ne.flnm(1:lenstr(flnm))) then close(lu) isopen = .false. endif endif if (.not.isopen) then call getvol(flnm,"/usr/tmp/TIGCM",lu,isopen,iier) if (iier.ne.0) then write(6,"('>>> rdshuttl: error ',i3,' from getms')") iier ier = 1 return endif endif c c 38 line header c if (irw.gt.0) then do ii=1,38 read(lu,"(a)",end=901) rec80 c write(6,"(a)") rec80 enddo endif c c Read data between times iseclim(1) and iseclim(2): c (Time limits from input are in seconds (iseclim)) c npts = 0 irec = 0 lim = 1 if (iseclim(1).eq.iseclim(2)) lim = 0 do ii=1,100000 read(lu,"(i4,2i3,f7.3,51x,f8.2,2f7.2)",end=901) + jd,ihr,min,sec,rlat,rlon,ralt irec = irec+1 c write(6,"('rdshuttl irec=',i5,' ihr=',i3,' min=',i3,' sec=', c + f7.3)") irec,ihr,min,sec iydsat = iyr*1000+jd isatsec = ihr*3600+min*60+ifix(sec) if (lim.gt.0.and.isatsec.lt.iseclim(1)) goto 100 if (lim.gt.0.and.isatsec.gt.iseclim(2)) goto 200 npts = npts+1 if (npts.eq.1) irec0 = irec if (npts.gt.mxpts) then write(6,"('>>> rdshuttl: reached mxpts=',i6, + ' -- returning')") mxpts ier = 1 return endif satlat(npts) = rlat satlon(npts) = rlon if (satlon(npts).ge.180.) satlon(npts) = satlon(npts) - 360. satalt(npts) = ralt satut(npts) = float(isatsec)/3600. 100 continue enddo 901 write(6,"('rdshuttl: EOF on file ',a,' npts = ',i5)") + flnm(1:len),npts rewind lu irw = 1 return 200 continue write(6,"(' ')") write(6,"('rdshuttl returning with npts=',i4)") npts write(6,"(' iseclim=',2i10,' satut(1),(npts)=',2f8.4)") + iseclim,satut(1),satut(npts) write(6,"(' satlat,lon (1st)=',f6.2,f7.2, + ' satlat,lon (last)=',f6.2,f7.2)") satlat(1),satlon(1), + satlat(npts),satlon(npts) write(6,"(' irec0=',i5,' irecn=',i5)") irec0,irec-1 irw = 0 return end