Monavg.gs Script
 
*This is a script to produce long term monthly means for gpcp data from
*1999 using the GPCP8799.dat data.
*The data will be stored graphically in gpcmonav.gmf
*and numerically in gpcmonav.fil (or ncpmonav for ncep)
*
******************Modification Box*********************
indata = "gpcp8799.ctl"
outplot = "../gpcpdir/maps/month"
outfile = "files/gpcmonav.fil"
datname = "GPCP"
var = "p"
endmonth = 156
endyear = "99"
*
*set color scheme wanted: skip = 1 turns it on.  Just set one!
skipdcp4 = 0
skipweb = 1
**********************************************************
'reinit'
'set vpage 0  11 0 8.5'
'set parea .8 10.8 1.25 7.5'
'open 'indata''
'set gxout shaded'
'run color.gs'
*
*following data file will hold all twelve monthly averages:
* 'enable print 'outplot''
*
* calculate longterm monthly avg for each month of gpcp data.
*Data begin jan 1987, but missing data (jan-may 87) not averaged
*Average will be from Jan 1988 - Dec 1996 
*
'set t 1 12'
'define monavg=ave(p,t+12,t='endmonth',1yr)'
*
* Month assignments are for title purposes.
n.1="January"
n.2="February"
n.3="March"
n.4="April"
n.5="May"
n.6="June"
n.7="July"
n.8="August"
n.9="September"
n.10="October"
n.11="November"
n.12="December"
*
*Loop to display titles
m = 1
while (m <= 12)
  'set t 'm''
        'set clevs 1 2 3 4 5 6 7 8 9 10 11 12 13 14'
*         colors for dcp4:        
        If (skipdcp4 = 1)
         'set ccols 52 53 46 11 13 38 36 34 22 23 24 26 2 27 6'  
        endif 
*         colors for web page:        
       if (skipweb = 1) 
        'set ccols 53 55 4 11 5 13 3 38 10 7 12 8 2 27 6'
       endif 
        'set grads off'
      'd monavg'
      'run cbar'
'Draw Title Average 'n.m' 'datname' Precipitation (mm/day) for 1988-'endyear''
 'enable print 'outplot''m'.gmf'
      'print'
   'disable print'
      'clear'
   m = m + 1
endwhile
*
* Data file loop;
 
'set fwrite 'outfile''
'set gxout fwrite'
 'set x 1 144'
 'set y 1 73'
 'set t 1 12'
     'display monavg'