c Simple program to read Geosat Wind/Wave binary-integer data files to c produce a text listing. With the optional "-s" switch on the command line c the program will internally perform the necessary byte-swapping for a PC c or VAX system. c c John L. Lillibridge c NOAA Lab. for Satellite Altimetry c 11/10/99 c program dump_ww implicit none integer*4 nargs,iargc integer*4 lat,lon,sec,ios,irec integer*2 usec,swh,sig0,att,flag,wind_cw,wind_br real*8 rlat,rlon,rsec character*80 fn logical swap c c iagrc() and getarg(n,string) are Fortran library functions c which return the number of command line arguments, and the character c string of the nth argument, respectively. c nargs=iargc() if(nargs.lt.1.or.nargs.gt.2)then write(6,*)'Usage: dump_ww [-s] ww_file' write(6,*)' -s to do [optional] byte-swapping (PC/Vax)' stop endif c c Process command line arguments, and check for the "-s" switch. c call getarg(1,fn) if(fn.eq.'-s')then swap=.True. call getarg(2,fn) else swap=.False. endif c c File format is direct-access, integer-binary, 26-byte record length. c open(10,file=fn,access='direct',recl=26,iostat=ios,err=10) irec=1 do while(ios.eq.0) read(10,rec=irec,iostat=ios,err=10)lat,lon,sec, & usec,swh,sig0,att,flag,wind_cw,wind_br c c Do byte-swapping if needed c if(swap)then call swap4(lat) call swap4(lon) call swap4(sec) call swap2(usec) call swap2(swh) call swap2(sig0) call swap2(att) call swap2(flag) call swap2(wind_cw) call swap2(wind_br) endif c c Convert lat/lon/time to real numbers c rlat=lat*1d-6 rlon=lon*1d-6 rsec=sec+usec*1d-6 write(6,'(2(f10.6,x),f15.6,5i7,x,o6)') & rlat,rlon,rsec,swh,sig0,att,wind_cw,wind_br,flag irec=irec+1 enddo stop c c HP-UX f77 returns error code 922 for end-of-file... c 10 if(ios.ne.922)then write(6,*)'I/O error:',ios stop endif end c----------------------------------------------------------------- subroutine swap4(in) implicit none byte in(4),b b=in(1) in(1)=in(4) in(4)=b b=in(2) in(2)=in(3) in(3)=b return end c----------------------------------------------------------------- subroutine swap2(in) implicit none byte in(2),b b=in(1) in(1)=in(2) in(2)=b return en