trying to extract a seasonal subset of data

Charles Seman Charles.Seman at NOAA.GOV
Tue Aug 15 15:36:26 EDT 2006


Katherin,

Have you tried using the "modify" command to create seasonal averages?

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

from above web site:
---
modify /varname type/

This command defines a climatological variable, which is
year-independent. /varname/ is a defined grid. There are two options for
/type/:

      |seasonal   |- For creating monthly or multi-monthly climatologies
      |diurnal    |- For creating climatologies over a time period less
      than a day


      Usage Notes


      Example

Say you have a 50-year timeseries of monthly mean sea surface
temperatures (a variable named sst with 600 time steps) and you want to
create a climatology and then look at the monthly anomalies. First, set
the time range for 1 to 12, to span a complete year. Second, define the
variable "sstclim" which will contain the January mean in the first time
step, the February mean in the second time set, etc. Then use 'modify'
to turn 'sstclim' into a climatological variable. This means that the
calendar year associated with 'sstclim' (the first year in the original
sst data set) becomes a wild card. Then you can define the anomaly by
subtracting the climatology from the original time series. The commands
are as follows:

'set t 1 12'
'define sstclim = ave(sst, t+0, t=600, 12)'
'modify sstclim seasonal'
'set t 1 last'
'define anom = sst - sstclim'
---

and from a Brian Doty email to the GrADS Listserv:

---
...
    set lon 0 360
    set lat -90 90
    set z 1
    set t 1 12
    define ozave = ave(ozone,t+0,t=144,12)

Now 'ozave' contains the seasonal mean for each month (the above assumes
the data starts with January).

Then, to display a seasonal mean -- for example, DJF:

   display (ozave(t=12)+ozave(t=1)+ozave(t=2))/3

or if you want to account for the lengths of the months (note that ave
does not do this by default when averaging monthly data):

   display (ozave(t=12)*31+ozave(t=1)*31+ozave(t=2)*28)/90

...Brian
---

I hope this helps,
Chuck


Katherin Kullgren wrote:
> Hi,
>
> I am trying to extract seasonal subsets of data from my dataset.
> I  want DJF MAM JJA SON
>
> So this is what I tried
>
> 'open anom.ctl'
> 'set gxout fwrite'
>
> * This creates the DJF season from Dec1950/Feb1951 - Dec1999/Feb2000
>
> 'set fwrite djf.data'
> imap = 12
> pmap = 14
> while (imap <= 600)
> 'set t ' imap pmap
> 'd anom'
> imap = imap + 12
> pmap = pmap + 14
> endwhile
>
> 'disable fwrite'
>
> This does not work. I am not sure the correct way  define the increments that I want.
> I  want to have
> set t 12 14
> set t 24 26
>  ..........
> set t 603 605
>
> I keep getting the error
>
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> Data Request Warning:  Request beyond file limits
> and so on
>
> If someone could suggest a way that this would work.  I would appreciate it.
> BTW- its monthly gridded data.
>
> Thanks
> Katherin
>

--

Please note that Charles.Seman at noaa.gov should be considered my NOAA
email address, not cjs at gfdl.noaa.gov.

********************************************************************
 Charles Seman                                Charles.Seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."



More information about the gradsusr mailing list