      subroutine setup (root, lenrot, exfile)

      character*(*) root, exfile
      integer*2 lenrot

      character*60 word, value, timran/' '/
      integer limmo (2)/2*0/
      integer*2 lenwrd, lenval, nop, lenex
      integer*2 lentim /0/

      include 'basics.inc'

      nop = 1
      root = ' '
      lenrot = 0
      exfile = ' '

c set up default values for area and level of detail to be shown

      level = 1
      elalim(1) = -90.
      elalim(2) = 90.
      elolim(1) = -180.
      elolim(2) = 180.
      call getarg (nop, word, lenwrd)
      do while (lenwrd. gt. 0)
        if (jmatch(word(:lenwrd),'ROOT') .eq. lenwrd) then
          call getval (nop, word(:lenwrd), root, lenrot)
          call getrot (limmo, root, lenrot)
        else if (jmatch(word(:lenwrd),'TIME') .eq. lenwrd) then
          call getval (nop, word(:lenwrd), timran, lentim)
        else if (jmatch(word(:lenwrd),'LATITUDE') .eq. lenwrd
     2          .and. lenwrd .ge. 2) then
          call getval (nop, word(:lenwrd), value, lenval)
          call cosset (value(:lenval), 'SN', elalim)
        else if (jmatch(word(:lenwrd),'LONGITUDE') .eq. lenwrd
     2          .and. lenwrd .ge. 2) then
          call getval (nop, word(:lenwrd), value, lenval)
          call cosset (value(:lenval), 'WE', elolim)
        else if (jmatch(word(:lenwrd),'OUTPUT') .eq. lenwrd) then
          call getval (nop, word(:lenwrd), exfile, lenex)
          mout = 11
        else if (jmatch(word(:lenwrd),'SHOW') .eq. lenwrd) then
          call getval (nop, word(:lenwrd), value, lenval)
          level = itch (value(:lenval), ier)
          if (ier .ne. lenval) call abort ('SHOW must be a number')
          if (level .lt. 1 .or. level .gt. 6) then
            call shelp (nout, 0)
            call abort ('SHOW keyword has unsuitable value')
          end if
        else
          call abort ('Keyword '//word(:lenwrd)//' unidentified')
        end if
        nop = nop + 1
        call getarg (nop, word, lenwrd)
      end do
      if (nop .eq. 1) then
        call explain
      else
        if (root .eq. ' ') call getrot (limmo, root, lenrot)
        call timset (timran, lentim, limmo, timlim)
        call allin
      end if
      return
      end

