C
C      EXAMPLE MS-FORTRAN PROGRAM WRITTEN BY ROBERT WEBB
C
       integer*4  sstmod(92,182),sst18k(92,182)
       real*4     sstano(92,182),rsst18(92,182),rsstmo(92,182)
       integer*4  ilat,ilong,datam(15),datao(15),lats(91),lons(180)
C
C**********************************
       OPEN(20,FILE='sst1.dat')
       OPEN(21,FILE='sst11.dat')
        OPEN(25,FILE='climanom.aug')
        OPEN(26,FILE='clima18k.aug')
        OPEN(27,FILE='climamod.aug')
        OPEN(99,FILE='gissclim.bug')
C**********************************
C
            dumnum = 90
         do 10 i=1,91
           lats(i) = dumnum
           dumnum  = dumnum - 2
   10 continue
c
         dumnum = -180
         do 20 i=1,180
           lons(i) = dumnum
           dumnum  = dumnum + 2
   20 continue
         negten = -10
        do 100 i=1,1092
           write(*,'(a1,i5)')'+',i
                read(20,'(4x,17i4)') lat,long,(datam(j),j=1,15)
                read(21,'(4x,17i4)') lat,long,(datao(j),j=1,15)
c
               ilat = (lat + 92) / 2
        do 200 j=1,15
          ilong = (long + 182) / 2
c              write(99,'(6i8)') i,j,ilat,ilong,lat,long
               sstmod(ilat,ilong) = datam(j)
               sst18k(ilat,ilong) = datao(j)
          rsst18(ilat,ilong) = real(datao(j)) / 10.0
          rsstmo(ilat,ilong) = real(datam(j)) / 10.0
        if((datam(j).gt.negten).and.(datao(j).gt.negten)) then
          ivalue  = sst18k(ilat,ilong) - sstmod(ilat,ilong)
          sstano(ilat,ilong) = real(ivalue) / 10.0
        else if (datao(j).lt.negten) then
          sstano(ilat,ilong) = real(datao(j)) / 10.0
        else
          sstano(ilat,ilong) = real(datam(j)) / 10.0
        endif
c           write(99,'(2i8,2i5,f8.1)') lat,long,
c    *sstmod(ilat,ilong),sst18k(ilat,ilong),sstano(ilat,ilong)
                   long = long + 2
  200  continue
  100  continue
c
           write(25,'(a50)')' CLIMAP August SST Anomalies, Deg. C.'
           write(25,'(a8/a6)')' 91 180','  0  0'
           write(25,'(1x,12i8)') (lats(i),i=1,91)
           write(25,'(1x,12i8)') (lons(i),i=1,180)
c
          do 1492 i=91,1,-1
           write(*,'(a1,2i5)') '+',i
                write(25,1776) (sstano(i,j),j=1,180)
 1776    format(12f8.1)
 1492     CONTINUE
c
               write(26,'(a50)')' CLIMAP 18 August SST, Deg. C.'
               write(26,'(a8/a6)')' 91 180','  0  0'
               write(26,'(1x,12i8)') (lats(i),i=1,91)
               write(26,'(1x,12i8)') (lons(i),i=1,180)
c
          do 1592 i=91,1,-1
           write(*,'(a1,2i5)') '+',i
                write(26,1776) (rsst18(i,j),j=1,180)
 1592     CONTINUE
c
               write(27,'(a50)')' CLIMAP Modern August SST, Deg. C.'
               write(27,'(a8/a6)')' 91 180','  0  0'
               write(27,'(1x,12i8)') (lats(i),i=1,91)
               write(27,'(1x,12i8)') (lons(i),i=1,180)
c
          do 1692 i=91,1,-1
           write(*,'(a1,2i5)') '+',i
                write(27,1776) (rsstmo(i,j),j=1,180)
 1692     CONTINUE
c
         STOP
         END
