      SUBROUTINE readhamontable1(maxyear,ntyp,toff)
c     readhamontable1 reads data from Hamon et al 2012
c     table 1 (temperture bias)

      parameter (icmax=10)
      character*80 text, filename

      dimension toff(maxyear,ntyp)
      dimension icomma(icmax,2)

      call extraname('sys.inf'//CHAR(0),
     *  'hamon_table1.txt'//CHAR(0),filename)
      open(9,file=filename,status='old')

c     read in headers
      
      read(9,'(a)') text
      read(9,'(a)') text
      read(9,'(a)') text
      nyearmin=maxyear
      nyearmax=0

      do 50 ny=1,maxyear
      
       call clearstring(text,80)
       read(9,'(a)',end=4) text
       call findlastchar(nsp,text,80)

       call commafindx(nsp,icmax,ncomma,icomma,text)
       if ( ncomma .lt. 2 ) goto 50
       read(text(icomma(1,1):icomma(1,1)+icomma(1,2)-1),*)
     * nyear
      if (nyear .lt. nyearmin ) nyearmin=nyear
      if (nyear .gt. nyearmax ) nyearmax=nyear
 
c      write(6,*) nyear,icomma(1,1),icomma(1,2),text(icomma(1,1):
c     *  icomma(1,1)+icomma(1,2)-1)
 
       read(text(icomma(2,1):icomma(2,1)+icomma(2,2)-1),*)
     * toff(nyear,1)
       read(text(icomma(3,1):icomma(3,1)+icomma(3,2)-1),*)
     * toff(nyear,3)
       if (icomma(4,2) .gt. 0) then
       if (ncomma .ge. 4) then
       read(text(icomma(4,1):icomma(4,1)+icomma(4,2)-1),*)
     * toff(nyear,5)
       
       toff(nyear,2)=toff(nyear,1)
       toff(nyear,4)=toff(nyear,3)
       toff(nyear,6)=toff(nyear,5)

c       write(6,*) nyear,toff(nyear,1),toff(nyear,2),toff(nyear,3),
c     *  toff(nyear,4),toff(nyear,5),toff(nyear,6)
       endif
       endif
50     continue
4      continue
       close(9)

       return
       end

