anchor.diff:  c Convert line of sight displacement to phase difference from satellite
   c----
      13 read (10,*,end=14) stlo,stla,ulos
  -          ulos = 100.0*ulos
  -          phase = 2.0*(2.0*pi)*ulos/wvl
  -          phase = mod(phase,2.0*pi)
  -          if (phase.lt.-pi) phase = phase + 2.0*pi
  -          if (phase.gt.pi) phase = phase - 2.0*pi
  +          ulos = 100.0d0*ulos
  +          phase = 2.0d0*tpi*ulos/wvl
  +          phase = dmod(phase,tpi)
  +          if (phase.lt.-pi) phase = phase + tpi
  +          if (phase.gt.pi) phase = phase - tpi
             write (20,*) stlo,stla, phase
             goto 13
      14 continue
  
positive.code: C======================================================================C
  
        SUBROUTINE gcmdln(wvl,ifile,ofile)
  
        IMPLICIT none
        REAL wvl
        CHARACTER*30 tag,ifile,ofile
        INTEGER i,narg
  
        wvl = 23.6
        ifile = 'nez2los.out'
        ofile = 'wraplos.out'
  
        narg = iargc()
        if (narg.eq.0) call usage()
  
        i = 0
     11 i = i + 1
        if (i.gt.narg) goto 12
  
negative.code: c the wavelength of the InSAR satellite.
  c----
        IMPLICIT NONE
        REAL*8 pi,d2r,tpi
        PARAMETER (pi=4.0d0*datan(1.0d0),d2r=pi/180.0d0,tpi=2.0d0*pi)
        REAL*8 stlo,stla,ulos,wvl,phase
        INTEGER narg,i
        CHARACTER*40 ifile,ofile
        LOGICAL ex
  
        call gcmdln(wvl,ifile,ofile)
        if (wvl.le.0.0d0) then
            write(*,*) '!! Error: wavelength is undefined'
            call usage('!! Use -w WVLNTH')
        endif
        if (ifile.eq.'none') then
            write(*,*) '!! Error: Input LOS vector file unspecified'
            call usage('!! Use -f IFILE to specify input file')
        else
            inquire(file=ifile,EXIST=ex)
            if (.not.ex) call usage('!! Error: no input file: '//ifile)
        endif
        if (ofile.eq.'none') then
            write(*,*) '!! Error: No output file specified'
            call usage('!! Use -o OFILE to specify phase output file')
        endif
  
        open (unit=10,file=ifile,status='old')
        open (unit=20,file=ofile,status='unknown')
  