      program dipinterp
C............................................................Feb 2023
C
      DIMENSION DIPS(2,96)
	CHARACTER*64 infile,outfile
C
      infile='dip.txt'
	outfile='dip180.txt'
	OPEN(10,file=infile,action='READ')
	do kk=1,96
	read(10,*,end=51) DIPS(1,kk),DIPS(2,kk)
	enddo
   51	close(10)
      OPEN(11,file=outfile)
C
       glon=-180.5
	DO 40 ii=1,360
	glon=glon+1.0
	do kk=1,94
	if ((glon.ge.DIPS(1,kk)).and.(glon.lt.DIPS(1,kk+1))) then
	k1=kk
	k2=kk+1
	exit
	endif
	enddo
C	
C Interpolate DIP(glon)
C 
      glatx=DIPS(2,k1)+(DIPS(2,k2)-DIPS(2,k1))/(DIPS(1,k2)-DIPS(1,k1))*
	+(glon-DIPS(1,k1))
	write(*,30) glon,glatx
      write(11,30) glon,glatx
   40 CONTINUE
   30 FORMAT(1X,F6.1,1X,F7.2)
      pause ' '
	STOP
	END
