[gradsusr] Generating Climatology Average Using Fwrite and NCEP/NCAR Data

Wesley Ebisuzaki - NOAA Federal wesley.ebisuzaki at noaa.gov
Fri Oct 30 15:21:06 EDT 2015


Perry,

There is an example on how to generate a climatology

http://www.iges.org/grads/gadoc/gradcomdmodify.html

    'set t 1 12'
    'define sstclim = ave(sst, t+0, t=600, 12)'

The fwrite command can write big/little endian ieee data files.

     http://www.iges.org/grads/gadoc/gradcomdsetfwrite.html

After you have used fwrite to save the climo, you can then
write a GrADS ctl file for it.  (google and you shall find)

Welsye



On Fri, Oct 30, 2015 at 2:20 PM, Perry, Aaron <Aaron.Perry at lsc.vsc.edu>
wrote:

> Good Afternoon Users,
>
>
> I have a grib1 file that contains 500mb heights from 1985 to 2014, using
> the NCEP/NCAR Reanalysis Dataset. I am trying to create an averaged
> climatology file to create monthly anomalies with. I've written a small
> GrADS script to try and create this climo file but, I'm not having much
> luck with it. The script outputs a .grib1 file but, no control file, as
> advertised.
>
>
> What am I doing wrong?
>
>
> Script Code:
>
>
> function pull (args)
>
> 'reinit'
>
> rc = gsfallow('on')
>
> currdate = subwrd(args,1)
> curr_run = subwrd(args,2)
> regions = subwrd(args,3)
> month = subwrd(args,4)
> date = sublin(currdate,1)
> mon = substr(date,5,2)
> day = substr(date,7,2)
> yr = substr(date,1,4)
>
> path1 = '/mnt/homes/perrya/'
> path2 = 'new.climate.atlas/'
> model = ncep_reanal
>
> var = hgt500
>
> 'open 'path1''path2'hgt500.mon.1985.2014.grib.ctl'
>
> count = 0
> rec = 360
> incr = 1; t = 0
> fhr = 0
> inc = 1
>
> 'set gxout fwrite'
> 'set fwrite 'path1''path2'hgt500.1985.2014.mean.grib'
>
> while(count<=rec)
>
> 'set t 't
>
> say t
>
> 'set lon -320 40'
> 'set lat -30 90'
>
> 'define hgt500 = (hgt500mb.1/100)'
>
> 'define climo=ave(hgt500,t=0,t='t',1mo)'
>
> 'd climo'
>
> count = count + incr
> t = t + incr
> fhr = fhr + inc
>
> endwhile
>
> 'quit'
>
>
>
> Aaron D. Perry
> Class of 2016
> Lyndon State College
> Lyndonville, VT
> Twitter: <https://twitter.com/AaronPerryLSC>
> <https://www.twitter.com/AaronPerryLSC>@AaronPerryLSC
> <https://twitter.com/AaronPerryLSC>
> Mobile: 617-780-4312
> Web: shearanalytics.net
> Email: Aaron.Perry at lyndonstate.edu
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20151030/7c2fe4cd/attachment.html 


More information about the gradsusr mailing list