function lplt2 (args)

'numargs  'args
 numargs = result

obsnam  = 'NULL'
control = 'NULL'
numrc   = 'NULL'

        num = 0
while ( num < numargs )
        num = num + 1

if( subwrd(args,num) = '-EXPID'   ) ; expid    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-EXPORT'  ) ; EXPORT   = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-ALIAS'   ) ; alias    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-FILE'    ) ; file     = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-NNUM'    ) ; nnum     = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-QDESC'   ) ; qdesc    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-OUTPUT'  ) ; output   = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-SEASON'  ) ; season   = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-ONAME'   ) ; obsnam   = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-COLOR'   ) ; color    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-FIELD'   ) ; field    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-CONTROL' ) ; control  = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-NUMRC'   ) ; numrc    = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-CLIM'    ) ; climflag = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-BEGDATE' ) ; begdate  = subwrd(args,num+1) ; endif
if( subwrd(args,num) = '-ENDDATE' ) ; enddate  = subwrd(args,num+1) ; endif

endwhile


* Echo Input Parameters
* ---------------------

say '-EXPID   'expid
say '-EXPORT  'EXPORT
say '-ALIAS   'alias
say '-FIELD   'field
say '-CONTROL 'control
say '-COLOR   'color
say '-QFILE   'file
say '-NNUM    'nnum
say '-QDESC   'qdesc
say '-OUTPUT  'output
say '-SEASON  'season
say '-NUMRC   'numrc
say '-ONAME   'obsnam
say '-CLIM    'climflag
say ''


* Get Plotting Values from Resource File
* --------------------------------------
'run getenv "GEOSUTIL"'
         geosutil = result
PLOTRC = geosutil'/plots/grads_util/plot.rc'
 
if( EXPORT = "U"   )
     name  = "U"
     title = "Zonal Mean U-Wind (m/sec)"
     levs  = "200 850"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "V"   )
     name  = "V"
     title = "Zonal Mean V-Wind (m/sec)"
     levs  = "200 850"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "T"   )
     name  = "T"
     title = "Zonal Mean Temperature (K)"
     levs  = "100 850"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "Q"   )
     name  = "QV"
     title = "Zonal Mean Specific Humidity (g/kg)"
     levs  = "500 925"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "RH2" )
     name  = "RH"
     title = "Zonal Mean Relative Humidity (%)"
     levs  = "500 925"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "ZLE" )
     name  = "H"
     title = "Zonal Mean Heights (m)"
     levs  = "300 850"
     nplots  =  2
     vpage.1 = '0  6 1.5 7.5'
     vpage.2 = '5 11 1.5 7.5'
endif

if( EXPORT = "SLP" )
     name  = "Sea-Level Pressure"
     title = "Zonal Mean Sea-Level Pressure (mb)"
     levs  = "1000"
     nplots  =  1
     vpage.1 = '2.5 8.5 1.5 7.5'
endif

if( obsnam = 'NULL' )
    cthick = 8
else
    cthick = 3
endif

* Make Mean Plot
* --------------
'set dfile 'file
'set xlopts 1 3 .15'
'set ylopts 1 3 .15'
'set y 1'
'getinfo lat'
         latmin = result
'getinfo ydim'
         ydim = result
'set y  'ydim
'getinfo lat'
         latmax = result

n = 1
while( n<=nplots ) 

'set vpage 'vpage.n
'set grads off'
'set ylab %.1f'
say 'set lev 'subwrd(levs,n)
'set lev 'subwrd(levs,n)
if( control != 'NULL' )
say 'set y 1 'ydim
'set y 1 'ydim
'!remove   axlim'n
'set_axlim axlim'n' 'control
endif
'set_axlim axlim'n
'set lat -90 90'
'set cstyle 1'
'set cthick  'cthick
'set cmark  0'
'set ccolor  'color
'd 'field
if( control != 'NULL' )
    if( EXPORT  != 'SLP' )
       'draw title 'name'  Level: 'subwrd(levs,n)
    else
       'draw title 'name
    endif
'draw xlab Latitude'
endif

n = n+1
endwhile


* Draw Labels for Each Experiment
* -------------------------------
'set vpage off'

if( numrc != 'NULL' )
 yloc = 8.3-0.15*(numrc-1)
 xbeg = 8.5
 xend = 9.0
 xloc =  xend+0.3
 xmid = (xbeg+xend)/2
  'set string 1 l 5'
  'set strsiz .08'
  'set  line 'color' 1 6'
  'draw line 'xbeg' 'yloc' 'xend' 'yloc
  'draw mark 3 'xmid' 'yloc' 0.08'
  'draw string 'xloc' 'yloc' 'obsnam' ('nnum') 'climflag

else

'set string 1 c 6'
'set strsiz .12'
'draw string 6.0  8.2   'title

                date = getdate (begdate)
bmnthm = subwrd(date,1)
byearm = subwrd(date,2)
                date = getdate (enddate)
emnthm = subwrd(date,1)
eyearm = subwrd(date,2)

'set string 1 l 6'
'set strsiz .13'
'draw string 1.15 8.00 'expid'  'season' ('nnum')'
'set strsiz .11'
'draw string 1.15 7.75 'qdesc

'set string 1 c 4'
'set strsiz .08'
'draw string 6.0  7.55 Begin Date: 'bmnthm' 'byearm
'draw string 6.0  7.40   End Date: 'emnthm' 'eyearm

endif

return

function getdate (date,month,year)
       num = 1
       bit = substr(date,num,1)
while( bit != '' )
       num = num+1
       bit = substr(date,num,1)
endwhile
       loc = num-7
     month = substr(date,loc  ,3)
      year = substr(date,loc+3,4)
return month' 'year
