
      subroutine getinp
      include 'timesloc.h'
      dimension htsc(3)
c
      call lexcon(histvol ,8HHISTVOL ,nhvols)
      call lexcon(mtimes  ,8HDDHHMM  ,ntimes)
      call lexcon(iden    ,8HIDEN    ,niden)
      call lexcon(modelhts,8HMODELHTS,nmodhts)
      call lexcon(icolor  ,8HCOLOR   ,ncolor)
      call lexcon(labels  ,8HLABELS  ,nlabels)
      call lexcon(iutvert ,8HPLUTVERT,nutvert)
      call lexcon(gloc    ,8HLOC     ,nloc)
      call lexcon(gloclt  ,8HLOCSLT  ,nloclt)
      call lexcon(locname ,8HLOCNAME ,nlocname)
      call lexcon(ibilin  ,8HBILIN   ,nbilin)
      call lexcon(logloc  ,8HLOGLOC  ,nlogloc)
      call lexcon(zprange ,8HZP_RANGE,nzprang)
      call lexcon(htsc    ,8HHT_SCALE,nhtscale)
      call lexcon(zphtline,8HZPHTLINE,nzphtlin)
      call lexcon(mutline ,8HUTLINE  ,nutline)
      call lexcon(mutlines,8HUTLINES ,nutlines)
      call lexcon(zphtlon ,8HZPHT_LON,nzphtlon)
      call lexcon(zphtslt ,8HZPHT_SLT,nzphtslt)
      call lexcon(logutlat,8HLOGUTLAT,nlgutlat)
      call lexcon(ifplt   ,8HFIELDS  ,npltact)
      call lexcon(ionvel  ,8HIONVEL  ,nionvel)
      call lexcon(iwrascii,8HWRASCII ,nwrascii)
      call lexcon(dirascii,8HDIRASCII,ndirdat)
      call lexcon(dircgm  ,8HDIRCGM  ,ndircgm)
      call lexcon(cmin    ,8HCMIN    ,ncmin)
      call lexcon(cmax    ,8HCMAX    ,ncmax)
      call lexcon(cint    ,8HCINT    ,ncint)
      call readlx(5,ierr)
      if (ierr.ne.1) then
        write(6,"(' ')")
        write(6,"('>>> getinp readlx ierr=',i10)") ierr
        write(6,"(' ')")
        stop 'readlx'
      endif
c
c Iden = 0,1,2 for mass mixing ratios, number densities, or mixing
c ratios of number densities
c
      if (niden.lt.0.or.iden.gt.2) then
        write(6,"(' >>> getinp: no iden -- will default to cm-3')")
        iden = 1
      endif
c
c If MODELHTS is set, get hts directly from history rather than
c calculating with tn, mean mass, and g0. Iden < 0 flags gettimes.a
c to return heights directly from history:
c
      if (nmodhts.le.0) modelhts = 0
c
c Color option:
c
      if (ncolor.le.0) icolor = 0
c
c Log10 plot options
c
      if (nlogloc.le.0) logloc = 0 
      if (nlgutlat.le.0) logutlat = 0 
c
      if (nutvert.le.0) iutvert = 0
      if (nbilin.le.0) ibilin = 0
c
c Labels option (labels=1 for simple, labels=2 for normal (default))
c (use simple if need to translate metacode at 9600 baud)
c
      if (nlabels.le.0) labels = 2
      if (labels.lt.2.and.icolor.gt.0) then
        write(6,"('>>> turning color off, since simple labels ',
     +    'requested')")
        icolor=0
      endif
c
c Histvol(s)
c
      if (mod(nhvols,3).ne.0) then
        write(6,"('>>> getinp: history volumes must be 24-chars each',
     +    /' nhvols=',i3)") nhvols
        stop 'nhvols'
      endif
      nhvols = nhvols/3
      if (nhvols.gt.mxvols) then
        write(6,"(' >>> getinp: nhvols.gt.mxvols: nhvols=',I3,
     +    ' mxvols=',i3)") nhvols,mxvols
        stop 'nhvols'
      endif
c        
c Number of desired times:
c        
      if (ntimes.le.0) then
        write(6,"('>>> getinp: need model times (DDHHMM)')")
        stop 'mtimes'
      endif
      if (mod(ntimes,3).ne.0) then
        write(6,"('>> getinp: model times should come in triplets ',
     +    '(dd,hh,mm): ntimes=',i3)") ntimes
        stop 'ntimes'
      endif
      ntms = ntimes/3
      if (ntms.gt.mxtms) then
        write(6,"('>>> getinp: too many model times (DDHHMM);',
     +    ' ntms=',i3,' mxtms=',i3)") ntms,mxtms
        stop 'mxtms'
      endif
c
c Ut loop:
c (mh,mm=99 means search only)
c
      do it=1,ntms
        if (mtimes(2,it).ne.99.and.
     +     (mtimes(2,it).lt.0.or.mtimes(2,it).gt.23)) then
          write(6,"('>>> getinp: bad model hour: ',i3,' it=',i3)")
     +      mtimes(2,it),it
          stop 'mhour'
        endif
        if (mtimes(3,it).ne.99.and.
     +     (mtimes(3,it).lt.0.or.mtimes(3,it).gt.59)) then
          write(6,"('>>> getinp: bad model minute: ',i3,' it=',i3)")
     +      mtimes(3,it),it
          stop 'mm'
        endif
        ut(it) = float(mtimes(2,it)) + float(mtimes(3,it))/60.
        utinc(it) = float(mtimes(1,it))*24.+
     +    float(mtimes(2,it))+float(mtimes(3,it))/60.
      enddo
      write(6,"('getinp: ntms=',i3,' ut=',/(8f6.2))") ntms,
     +  (ut(i),i=1,ntms)
      write(6,"('getinp: ntms=',i3,' utinc=',/(7f10.2))") ntms,
     +  (utinc(i),i=1,ntms)

c
c ifplt(nftot) = desired fields to plot
c ifget(nftot) = fields needed (ifplt plus others as needed below):
c
      if (npltact.ne.nftot) then
        write(6,"('>>> getinp: need ',i3,' values for FIELDS',
     +    ' -- got ',i3)") nftot,npltact
        stop 'nftot'
      endif
c
c Check ion drift calculation flag:
c (ionvel=1,2,3 for ion drifts without efield, with efield, with epot)
      if (nionvel.le.0) then 
        if (ifplt(ixui).gt.0.or.ifplt(ixvi).gt.0.or.ifplt(ixwi).gt.0)
     +    then
          write(6,"('getinp: setting default IONVEL=1 (calculate ',
     +      'ion drifts without efield)')")
          ionvel = 1
        endif
      endif
      if ((ifplt(ixui).gt.0.or.ifplt(ixvi).gt.0.or.ifplt(ixwi).gt.0)
     +    .and.(ionvel.lt.1.or.ionvel.gt.3)) then
          write(6,"('>>> getinp: bad IONVEL=',i3,' (must be 1, 2, or 3',
     +      ' for ion drifts with efield, without efield, or ',
     +      'from electric potential, respectively)')") ionvel
          stop 'ionvel'
      endif
c
c 8/93: ion drifts from electric potential not yet available:
      if ((ifplt(ixui).gt.0.or.ifplt(ixvi).gt.0.or.ifplt(ixwi).gt.0)
     +    .and.ionvel.eq.3) then
        write(6,"('>>> getinp: sorry, ion drifts from electric ',
     +    'potential (IONVEL=3) not yet available -- turning off ',
     +    'ion drift plots')") 
        ifplt(ixui) = 0
        ifplt(ixvi) = 0
        ifplt(ixwi) = 0
      endif
c
c Calculation of ion drifts without epot requires t,u,v,w,o2,o,n2:
c (also requires z, but that is set unconditionally below)
c     ifdep(nfhist,nftot-nfhist)
c
      if ((ifplt(ixui).gt.0.or.ifplt(ixvi).gt.0.or.ifplt(ixwi).gt.0)
     +    .and.ionvel.le.2) then
        do i=ixui,ixwi
          ifdep(ixt,i) = 1
          ifdep(ixu,i) = 1
          ifdep(ixv,i) = 1
          ifdep(ixw,i) = 1
          ifdep(ixo2,i) = 1
          ifdep(ixo1,i) = 1
          ifdep(ixn2,i) = 1
          ifdep(ixz,i) = 1
        enddo
      endif
c
c Lat,lon locations: 
c
      if (iutvert.gt.0.and.nloc.le.0.and.nloclt.le.0) then
        write(6,"('>>> if PLUTVERT=1, then need locations or lat,slt: ',
     +    'nloc=',i2,' nloclt=',i2)")
     +    nloc,nloclt
        stop 'NLOC'
      endif
      if (nloc.gt.0) then
        if (mod(nloc,2).ne.0) then
          write(6,"('>>> getinp: need even number of locs (lat,lon)',
     +      ' nloc=',i3)") nloc
          stop 'nloc'
        else
          nloc = nloc/2
        endif
        if (nloc.gt.mxloc) then
          write(6,"('>>> getinp: too many locs: nloc=',i3,
     +      ' will default to ',i3)") nloc,mxloc
          nloc = mxloc
        endif
        write(6,"('getinp: nloc=',i2)") nloc
        if (nlocname.gt.0) then
          if (nlocname.ne.nloc*2) then
            write(6,"('>>> getinp: must have one 16-char loc name ',
     +        'for each location: nloc=',i2,' but nlocname=',i2)")
     +        nloc,nlocname/2
            stop 'locname'
          endif
        else
          locname(1) = 'xxxxxxxxxxxxxxxx'
        endif
        do i=1,nloc
c
c Accept lon in range 0->360, but convert to -180->+180:
c
          if (gloc(2,i).ne.gmflag.and.gloc(2,i).gt.180.) 
     +      gloc(2,i) = gloc(2,i)-360.
c
c Check validity of lat,lon:
c
          if (gloc(1,i).ne.gmflag.and.
     +       (gloc(1,i).lt.-90..or.gloc(1,i).gt.90.)) then
            write(6,"('>>> getinp: bad latitude in LOC = ',f12.3,
     +        ': lat must be >= ',f6.2,' and <= ',f6.2)")
     +        gloc(1,i),gcmlat(1),gcmlat(jmx)
            stop 'badlat'
          elseif (gloc(2,i).ne.gmflag.and.
     +      (gloc(2,i).lt.gcmlon(1).or.gloc(2,i).gt.gcmlon(imx))) then
            write(6,"('>>> getinp: bad longitude in LOC = ',f12.3,
     +        ': lon must be >= ',f7.2,' and <= ',f7.2)")
     +        gloc(2,i),gcmlon(1),gcmlon(imx)
            stop 'badlon'
          else
            if (gloc(1,i).ne.gmflag.and.gloc(2,i).ne.gmflag) then
              if (nlocname.gt.0) then
                write(6,"('Loc ',i3,': lat,lon=',f6.2,',',f7.2,
     +            ' (',a,')')") i,gloc(1,i),gloc(2,i),locname(i)
              else
                write(6,"('Loc ',i3,': lat,lon=',f6.2,',',f7.2)")
     +            i,gloc(1,i),gloc(2,i)
              endif
            elseif (gloc(1,i).ne.gmflag.and.gloc(2,i).eq.gmflag) then
              write(6,"('Loc ',i3,': lat=',f6.2,' (ZONAL MEANS)')")
     +          i,gloc(1,i)
            elseif (gloc(1,i).eq.gmflag.and.gloc(2,i).eq.gmflag) then
              write(6,"('Loc ',i3,': (GLOBAL MEANS)')") i
            endif
          endif
        enddo
      endif
c
c Lat,slt locations: 
c
      if (nloclt.gt.0) then
        if (mod(nloclt,2).ne.0) then
          write(6,"('>>> getinp: need even number of locs (LOCSLT)',
     +      ' nloclt=',i3)") nloclt
          stop 'nloclt'
        else
          nloclt = nloclt/2
        endif
        if (nloclt.gt.mxloc) then
          write(6,"('>>> getinp: too many locs (LOCSLT): nloclt=',i3,
     +      ' will default to ',i3)") nloclt,mxloc
          nloclt = mxloc
        endif
        write(6,"('getinp: nloclt=',i2)") nloclt
        do i=1,nloc
c
c Check local times:
c
          if (gloclt(2,i).lt.0..or.gloclt(2,i).gt.24.) then
            write(6,"('>>> getinp: bad local time in LOCSLT = ',f12.3)")
     +        gloclt(2,i)        
            stop 'badslt'
          endif
          if (gloclt(1,i).lt.-90..or.gloclt(1,i).gt.90.)) then
            write(6,"('>>> getinp: bad latitude in LOCSLT = ',f12.3,
     +        ': lat must be >= ',f6.2,' and <= ',f6.2)")
     +        gloclt(1,i),gcmlat(1),gcmlat(jmx)
            stop 'badlat'
          else
            write(6,"('Lat,slt=',2f8.2)") (gloclt(ii,i),ii=1,2)
          endif
        enddo
      endif
c
c Range of zp for y-axis for vertical slices:
      if (nzprang.gt.0) then
        if (zprange(1).lt.gcmzp(1).or.zprange(2).gt.gcmzp(kmx).or.
     +      zprange(1).ge.zprange(2)) then
          write(6,"('>>> BAD ZP_RANGE = ',2f10.2,' gcmzp=',/(6e12.4))")
     +      zprange,gcmzp
          stop 'zprange'
        endif
        izprange(1) = ixfind(gcmzp,kmx,zprange(1),dzp)
        if (izprange(1).lt.0) then
          write(6,"('>>> error from ixfind for zprange(1): zprange(1)=',
     +      f10.2,' kmx=',i3,' gcmzp=',/(6e12.4))") zprange(1),kmx,gcmzp
          stop 'izprange'
        endif
        izprange(2) = ixfind(gcmzp,kmx,zprange(2),dzp)
        if (izprange(2).lt.0) then
          write(6,"('>>> error from ixfind for zprange(2): zprange(2)=',
     +      f10.2,' kmx=',i3,' gcmzp=',/(6e12.4))") zprange(2),kmx,gcmzp
          stop 'izprange'
        endif
        nzprange = izprange(2)-izprange(1)+1
        write(6,"('getinp: zprange=',2f8.2,' izprange=',2i3,' nzprange=',
     +    i3)") zprange,izprange,nzprange
      else 
        izprange(1) = 0
        izprange(2) = 0
      endif
c
c Linear height scale (for pltlat,pltlon):
c User specifies bottom, top, and delta in that order:
c
      if (nhtscale.gt.0.and.nhtscale.ne.3) then
        write(6,"('>>> getinp: HTSCALE should be = htbot,httop,delht ',
     +    'e.g., 50.,500.,25.')")
        stop 'htscale'
      endif
      if (nhtscale.gt.0) then
        if (htsc(1).ge.htsc(2)) then
          write(6,"('>>> getinp: HTSCALE: top must be > bot: bot=',
     +      f10.2,' top=',f10.2)") htsc(1),htsc(2)
          stop 'htscale'
        endif
        if (htsc(3).le.0.) then
          write(6,"('>>> getinp: HTSCALE: bad delta ht=',f10.2)")htsc(3)
          stop 'htscale'
        endif
        htbot = htsc(1)
        httop = htsc(2)
        delht = htsc(3)
      else
        delht = 0.
      endif
c
c Set up linear height scale, if needed:
c
      nhtscale = 0
      if (delht.gt.0.) then
        nhtscale = ifix((httop-htbot) / delht + 1.0000001)
        call alloc(phtscale,nhtscale)
        do i=1,nhtscale
          htscale(i) = htbot + (i-1)*delht
        enddo
        write(6,"('getinp: nhtscale=',i2,' linear height scale = ',
     +    /(6e10.3))") nhtscale,(htscale(i),i=1,nhtscale)
      endif
c
c Will plot doppler t,u,v,brightness from e5577 with linear
c height scale (nhtscale > 0), and zphtline (line plots with ut on 
c xaxis, fld on y)
c
      idop5577 = 0
      if (ifplt(ixe5577).gt.0.and.nhtscale.gt.0) then
        ifdep(ixu,ixe5577) = 1
        ifdep(ixv,ixe5577) = 1
        idop5577 = 1
        call alloc(pdop5577,ntms*nloc*4)
        write(6,"('Will plot doppler t,u,v, brightness from e5577')")
      endif
c
c Will plot doppler t,u,v,brightness from e6300 with linear
c height scale (nhtscale > 0), and zphtline (line plots with ut on 
c xaxis, fld on y)
c
      idop6300 = 0
      if (ifplt(ixe6300).gt.0.and.nhtscale.gt.0) then
        ifdep(ixu,ixe6300) = 1
        ifdep(ixv,ixe6300) = 1
        idop6300 = 1
        call alloc(pdop6300,ntms*nloc*4)
        write(6,"('Will plot doppler t,u,v, brightness from e6300')")
      endif
c
c Will plot doppler t,u,v,brightness from eo200 with linear
c height scale (nhtscale > 0), and zphtline (line plots with ut on 
c xaxis, fld on y)
c
      idopo200 = 0
      if (ifplt(ixeo200).gt.0.and.nhtscale.gt.0) then
        ifdep(ixu,ixeo200) = 1
        ifdep(ixv,ixeo200) = 1
        idopo200 = 1
        call alloc(pdopo200,ntms*nloc*4)
        write(6,"('Will plot doppler t,u,v, brightness from eo200')")
      endif
c
c If doing ion drifts with linear height scale on y-axis, then 
c need to allocate space (will be defined in mkfields and plotted 
c from pltloc):
c
      if ((ifplt(ixui).gt.0.or.ifplt(ixvi).gt.0.or.ifplt(ixwi).gt.0)
     +    .and.nhtscale.gt.0) then
        call alloc(phtions,ntms*nhtscale*3*nloc)
      endif
c
c Allocate space for e5577, 6300  and/or eo200 at interpolated height scale
c (like ion drifts above)
c
      if (ifplt(ixe5577).gt.0.and.nhtscale.gt.0)
     +  call alloc(phte5577,ntms*nhtscale*nloc)
      if (ifplt(ixe6300).gt.0.and.nhtscale.gt.0)
     +  call alloc(phte6300,ntms*nhtscale*nloc)
      if (ifplt(ixeo200).gt.0.and.nhtscale.gt.0)
     +  call alloc(phteo200,ntms*nhtscale*nloc)
c
c zphtline = selected zp/ht at which to make line plots at locations
c            with ut on x-axis, field on y-axis
c (assume is zp if <= gcmzp(kmx), otherwise is height)
c
      if (nzphtlin.gt.0) then
        if (nzphtlin.gt.kmx) then
          write(6,"('>>> Too many ZPHTLINE: nzphtlin=',i3)") nzphtlin
          stop 'nzphtlin'
        endif
        do i=1,nzphtlin
          if (zphtline(i).lt.gcmzp(1)) then
            write(6,"('>>> Bad ZPHTLINE=',f9.2,' i=',i3)") zphtline(i),i
            stop 'zphtline'
          endif
          if (zphtline(i).le.gcmzp(kmx)) then
            izphtlin(i) = ixfind(gcmzp,kmx,zphtline(i),dzp)
            if (izphtlin(i).le.0) then
              write(6,"('>>> getinp: error from ixfind for ',
     +          'zphtline(i)=',f8.2)") zphtline(i)
              stop 'zphtline'
            endif
          else
            izphtlin(i) = 0
          endif
        enddo
      endif
c
c mutline = selected model times (integer triplets) at which to make
c   line plots with field on x-axis, zp or ht on y-axis (according to
c   zprange and/or htscale (mutline must be a subset of mtimes)
c
      if (nutline.gt.0) then
        if (mod(nutline,3).ne.0) then
          write(6,"('>>> UTLINE must be integer triplets: nutline=',
     +      i3)") nutline
          stop 'nutline'
        endif
        nutline = nutline/3
        do i=1,nutline
          do ii=1,ntms
            if (mutline(1,i).eq.mtimes(1,ii).and.
     +          mutline(2,i).eq.mtimes(2,ii).and.
     +          mutline(3,i).eq.mtimes(3,ii)) goto 100
          enddo
          write(6,"('>>> UTLINE must be subset of DDHHMM: cannot ',
     +      'find UTLINE ',3i3,' in DDHHMM=',/(6(3i3,'  ')))") 
     +      (mutline(ii,i),ii=1,3),((mtimes(ii,iii),ii=1,3),iii=1,ntms)
          stop 'utline'
 100      continue
        enddo
      endif
c
c mutlines = selected model times (integer triplets) at which to make
c   line plots with field on x-axis, zp or ht on y-axis (according to
c   zprange and/or htscale (mutlines must be a subset of mtimes)
c Lines for each ut are plotted on the same frame for each field
c   (this is difference between mutlines and mutline)
c
      if (nutlines.gt.0) then
        if (mod(nutlines,3).ne.0) then
          write(6,"('>>> UTLINES must be integer triplets: nutlines=',
     +      i3)") nutlines
          stop 'nutlines'
        endif
        nutlines = nutlines/3
        do i=1,nutlines
          do ii=1,ntms
            if (mutlines(1,i).eq.mtimes(1,ii).and.
     +          mutlines(2,i).eq.mtimes(2,ii).and.
     +          mutlines(3,i).eq.mtimes(3,ii)) goto 101
          enddo
          write(6,"('>>> UTLINES must be subset of DDHHMM: cannot ',
     +      'find UTLINES ',3i3,' in DDHHMM=',/(6(3i3,'  ')))") 
     +      (mutlines(ii,i),ii=1,3),((mtimes(ii,iii),ii=1,3),iii=1,ntms)
          stop 'utline'
 101      continue
        enddo
      endif
c
c zpht_lon (zpht,lon pairs) for contours with ut on x-axis, lat on y-axis
c
      if (nzphtlon.gt.0) then
        if (mod(nzphtlon,2).ne.0) then
          write(6,"('>>> getinp: need even number of ZPHT_LON ',
     +      ' (lat,lon)  nzphtlon=',i3)") nzphtlon
          stop 'nzphtlon'
        else
          nzphtlon = nzphtlon/2
        endif
        if (nzphtlon.gt.mxloc) then
          write(6,"('>>> getinp: too many ZPHT_LON: nzphtlon=',i3,
     +      ' will default to ',i3)") nzphtlon,mxloc
          nzphtlon = mxloc
        endif
        write(6,"('getinp: nzphtlon=',i2)") nzphtlon
        do i=1,nzphtlon
          if (zphtlon(1,i).lt.gcmzp(1)) then 
            write(6,"('>>> getinp: bad zp (ZPHT_LON)=',f8.2,' i=',i3)")
     +        zphtlon(1,i),i
            stop 'zphtlon'
          endif
          if (zphtlon(2,i).ne.gmflag.and.
     +       (zphtlon(2,i).lt.gcmlon(1).or.zphtlon(2,i).gt.gcmlon(imx))) 
     +      then
            write(6,"('>>> getinp: bad lon (ZPHT_LON)=',f8.2,' i=',
     +        i3)") zphtlon(2,i),i
            stop 'zphtlon'
          endif
c
c At selected zp (put index to zp in zphtlon(1,i)):
          if (zphtlon(1,i).le.gcmzp(kmx)) then
            izphtlon(1,i) = ixfind(gcmzp,kmx,zphtlon(1,i),dzp)
            if (izphtlon(1,i).le.0) then
              write(6,"('>>> getinp: error from ixfind for ',
     +          'zphtlon(1,i)=',f8.2)") zphtlon(1,i)
              stop 'zphtlon'
            endif
c
c At selected height (flag izphtlon(1,i)):
          else
            izphtlon(1,i) = 0
          endif
c
c At selected longitude:
          if (zphtlon(2,i).ne.zmflag) then
            izphtlon(2,i) = ixfind(gcmlon,imx,zphtlon(2,i),dlon)
            if (izphtlon(2,i).le.0) then
              write(6,"('>>> getinp: error from ixfind for ',
     +          'zphtlon(2,i)=',f8.2)") zphtlon(2,i)
              stop 'zphtlon'
            endif
            write(6,"('ZPHT_LON(',i2,')=',2f8.2)") i,
     +        (zphtlon(ii,i),ii=1,2)
c
c At zonal means (flag izphtlon(2,i):
          else
            izphtlon(2,i) = ifix(zmflag)
            write(6,"('ZPHT_LON(',i2,')=',2f8.2,' (ZONAL MEANS)')")
     +        i,(zphtlon(ii,i),ii=1,2)
          endif
        enddo
      endif
c
c zpht_slt (zpht,slt pairs) for contours with ut on x-axis, slt on y-axis
c
      if (nzphtslt.gt.0) then
        if (mod(nzphtslt,2).ne.0) then
          write(6,"('>>> getinp: need even number of ZPHT_SLT ',
     +      ' (lat,lon)  nzphtslt=',i3)") nzphtslt
          stop 'nzphtslt'
        else
          nzphtslt = nzphtslt/2
        endif
        if (nzphtslt.gt.mxloc) then
          write(6,"('>>> getinp: too many ZPHT_SLT: nzphtslt=',i3,
     +      ' will default to ',i3)") nzphtslt,mxloc
          nzphtslt = mxloc
        endif
        write(6,"('getinp: nzphtslt=',i2)") nzphtslt
        do i=1,nzphtslt
          if (zphtslt(1,i).lt.gcmzp(1)) then 
            write(6,"('>>> getinp: bad zp (ZPHT_SLT)=',f8.2,' i=',i3)")
     +        zphtslt(1,i),i
            stop 'zphtslt'
          endif
          if (zphtslt(2,i).lt.0..or.zphtslt(2,i).gt.24.) then
            write(6,"('>>> getinp: bad slt (ZPHT_SLT)=',f8.2,' i=',
     +        i3)") zphtslt(2,i),i
            stop 'zphtslt'
          endif
c
c At selected zp (put index to zp in zphtslt(1,i)):
          if (zphtslt(1,i).le.gcmzp(kmx)) then
            izphtslt(1,i) = ixfind(gcmzp,kmx,zphtslt(1,i),dzp)
            if (izphtslt(1,i).le.0) then
              write(6,"('>>> getinp: error from ixfind for ',
     +          'zphtslt(1,i)=',f8.2)") zphtslt(1,i)
              stop 'zphtslt'
            endif
            write(6,"('ZPHT_SLT(',i2,')=',2f8.2)") i,
     +        (zphtslt(ii,i),ii=1,2)
c
c At selected height (flag izphtslt(1,i)):
          else
            izphtslt(1,i) = 0
          endif
        enddo
      endif
c
c Check field dependencies, i.e., request additional history fields
c   that are required for certain plot field requests:
c
      call chflds(ifget,nfhist,ifplt,nftot,ifdep,nftot-nfhist,1,
     +  labshort,1)
c
c modelhts = 0 -> tell gettgcm calculate hts using "newhts", otherwise
c (modelhts = 1) gettgcm will get heights from history 
c
      ifget(ixz) = 1
      if (modelhts.gt.0) ifget(ixz) = 2 ! flag gettgcm to get history hts
      if (ifplt(ixz).gt.0) then	 ! also want to plot z
        if (modelhts.gt.0) then		 ! want hts from hist (flag gettgcm)
          write(6,"('Heights will be returned directly from model ',
     +      'history')")
        else				! want newhts (see proclat)
          write(6,"('Heights will be calculated from tn and ',
     +      'mean mass')")
        endif
      endif
c
c Contour intervals:
c
      if (ncint.le.0) then
        do ip=1,nftot
          cint(ip) = 0.
        enddo
      elseif (ncint.ne.nftot) then
        write(6,"('>>> Need ',i3,' contour intervals (CINT),'
     +    ' or none: got ',i3,' -- stop ')")
     +    nftot,ncint
        stop 'CINT'
      endif
c
c Contour minimums:
c
      if (ncmin.le.0) then
        do ip=1,nftot
          cmin(ip) = 1.
        enddo
      elseif (ncmin.ne.nftot) then
        write(6,"('>>> Need ',i3,' contour minimums (CMIN),'
     +    ' or none: got ',i3,' -- stop ')")
     +    nftot,ncmin
        stop 'CMIN'
      endif
c
c Contour maximums:
c
      if (ncmax.le.0) then
        do ip=1,nftot
          cmax(ip) = 0.
        enddo
      elseif (ncmax.ne.nftot) then
        write(6,"('>>> Need ',i3,' contour maximums (CMAX),'
     +    ' or none: got ',i3,' -- stop ')")
     +    nftot,ncmax
        stop 'CMAX'
      endif
c
c iwrascii = 0 -> do not write ascii data file
c iwrascii = 1 -> write ascii data file per frame
c iwrascii = 2 -> write single ascii data file (append each frame)
c dirascii = remote dir for rcp of ascii files
c
      if (nwrascii.le.0) iwrascii = 0
      if (ndirdat.gt.0) then
        if (ndirdat.ne.7) then
          write(6,"('>>> DIRASCII must be 56 characters: ',
     +      'ndirdat=',i3)") ndirdat
          stop 'DIRASCII'
        endif
      else
        call clearstr(dirascii)
      endif
c
c dircgm = remote dir for rcp of gmeta
c
      if (ndircgm.gt.0) then
        if (ndircgm.ne.7) then
          write(6,"('>>> DIRCGM must be 56 characters: ',
     +      'ndircgm=',i3)") ndircgm
          stop 'DIRCGM'
        endif
      else
        call clearstr(dircgm)
      endif
c
      return
      end
