program ligdr c c Program to dump contents of GEOSAT JGM-3 GDR (direct-access Unix version) files. c c J.L. Lillibridge: NOAA Laboratory for Satellite Altimetry c implicit none c integer*4 lwrd(5),filesize,nbytes,gdr_size parameter (gdr_size=78) integer*4 stdout,stderr,first_arg,min_rec,max_rec c parameter (stdout=6, stderr=0, first_arg=1) integer*2 swrd(39),nwrd,i,land equivalence (lwrd,swrd) logical dump c real*4 lat,lon,h,stide,otide,wet,dry,iono,orbit,nvap,mssh integer*2 day,hr,mn,sec integer ios,nrec,nargs,iargc,iarg character*80 gdr,opt c c Check the argument list c nargs=iargc() if(nargs.lt.first_arg)then write(stderr,*)'Usage: ligdr [-a] [-min_rec +max_rec]', & ' gdr_file' write(stderr,*)' -a = long listing' stop endif c c Pick up GDR filename, regardless of options, as the last argument. c call getarg(nargs,gdr) nbytes=filesize(gdr) nwrd=gdr_size/2 nrec=nbytes/gdr_size open(10,file=gdr,status='old',form='unformatted', & readonly,access='direct',recl=gdr_size,iostat=ios,err=100) c c Get any option strings: -a for complete integer dump; -nnn -> +nnn rec. range c dump=.False. min_rec=1 max_rec=nrec do iarg=first_arg,nargs-1 call getarg(iarg,opt) if(opt.eq.'-a')then dump=.True. elseif(opt(1:1).eq.'-')then read(opt(2:),*)min_rec elseif(opt(1:1).eq.'+')then read(opt(2:),*)max_rec else write(stderr,*)'ligdr: unknown option: ',opt endif enddo c write(stdout,*)'Filesize:',nbytes,' Min_rec:',min_rec, & ' Max_rec:',max_rec if(.not.dump)then write(stdout,3) write(stdout,4) endif do nrec=min_rec,max_rec read(10,rec=nrec,iostat=ios,err=10)(swrd(i),i=1,nwrd) c c Days from seconds, lat & long in degrees, orbit in km c ht & mssh in m , solid & ocean tides, and wet tropo, dry tropo, c & iono corrections in cm. c c Integer land based on flag bits 0 & 1: c land=0 (over land), land=1 (shallow sea), land=3 (deep ocean) c if(dump)then write(stdout,'(5(i11,x),18(i6,x),o6,10(x,i6))') & (lwrd(i),i=1,5),(swrd(i),i=11,39) else day=lwrd(1)/86400 hr=(lwrd(1)-day*86400)/3600 mn=(lwrd(1)-day*86400-hr*3600)/60 sec=(lwrd(1)-day*86400-hr*3600-mn*60) lat=lwrd(3)/1e6 lon=lwrd(4)/1e6 orbit=lwrd(5)/1e6 h=swrd(11)/100. mssh=swrd(13)/100. stide=swrd(31)/10. otide=swrd(32)/10. wet=swrd(33)/10. dry=swrd(35)/10. iono=swrd(36)/10. nvap=swrd(34)/10. land=iand(3,swrd(29)) write(stdout,5)day,hr,mn,sec,lat,lon,orbit,h,mssh,int(stide), & int(otide),int(wet),int(nvap),int(dry),int(iono),land endif 3 format(t1,"Day",t8,"Time",t16,"Lat",t22,"Lon",t28,"Orbit", & t37,"Ht",t42,"Mssh",t48,"Stid",t53,"Otid",t59,"Wet", & t63,"Nvap",t70,"Dry",t74,"Iono",t79,"L") 4 format(t1,"(85)",t5,"(hh:mm:ss)",t16,"(N)",t22,"(W)",t29,"(km)", & t37,"(m)",t43,"(m)",t48,"(cm)",t53,"(cm)",t58,"(cm)", & t63,"(cm)",t69,"(cm)",t74,"(cm)") 5 format(i4,x,2(i2.2,":"),i2.2,2(x,f5.1),3(x,f6.1),4(x,i4), & x,i5,x,i4,x,i1) enddo c c Error on read: "EOF"? c 10 if(ios.ne.0) write(stderr,*)'Error on read:',ios close(10) stop c c Error on open c 100 write(stderr,*)'Error on open:',ios end