program ReadEnvi cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c R E A D E N V I c c Reads Envisat SGDR data c Input: c ENVISAT file name c outfile c c c output in gravsoft format with average h,hmin/geoid,avruf c ldos must be set false for unix systems c c (c) Henriette Skourup, Danish National Space Center, Feb 2006 c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc implicit double precision(a-h,o-z) double precision lat,lon character*72 ifile,ofile integer*1 b(6769253) integer recno,irec,count,mdsl,j0 logical ldos common /rec/ b,ldos integer*4 int_four integer*2 d(2) equivalence(int_four,d) read(*,*) ifile read(*,*) ofile read(*,*) tjd1,tjd2,rlat1,rlat2,rlon1,rlon2 write(*,*) 'READENVI ',ifile open(10,file=ifile,access='direct',form='unformatted', .recl=6769253) open(20,file=ofile,status='unknown') c ldos: true for windows, reverse byte order c ldos = .true. irec=18425 mdsl=2492 recno=25 count=1 10 if (irec.lt.6769253) then read(10,rec=1,err=80) b rlat = i4(16+irec)*1.d-6 rlon = i4(20+irec)*1.d-6 j0=0 do j=1,20 k1 = i2(1308+irec+j0) dlat = ineg(k1)*1.d-5 lat = rlat + dlat k2 = i2(1348+irec+j0) dlon = ineg(k2)*1.d-5 lon = rlon + dlon c output all recs write(20,20) lat,lon 20 format(f12.7,f13.7) j0=j0+2 end do c write(*,*) count,rlat,rlon,dlat,dlon count=count+1 irec=irec+mdsl goto 10 else goto 80 end if 80 continue close(10) close(20) end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc integer*4 function i4(i0) c --------------------------- c reads integer*4 at adress i0 c integer*1 b(6769253),b1(4) logical ldos equivalence(b1,k) common /rec/ b,ldos if (ldos) then b1(4) = b(i0+1) b1(3) = b(i0+2) b1(2) = b(i0+3) b1(1) = b(i0+4) else b1(1) = b(i0+1) b1(2) = b(i0+2) b1(3) = b(i0+3) b1(4) = b(i0+4) endif i4 = k return end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc integer*2 function i2(i0) c --------------------------- c reads integer*4 at adress i0 c integer*1 b(6769253),b1(2) logical ldos equivalence(b1,k) common /rec/ b,ldos if (ldos) then b1(2) = b(i0+1) b1(1) = b(i0+2) else b1(1) = b(i0+1) b1(2) = b(i0+2) endif i2 = k return end cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc integer*4 function ineg(k) c --------------------------- c reads integer*4 at adress i0 c integer*4 int_four integer*2 d(2) equivalence(int_four,d) d(1) = k d(2) = 0 if (int_four.gt.32767) then ineg = int_four - 65536 else ineg = int_four endif return end