multi-year monthly mean standard deviation

Simone Marras simone.marras at BSC.ES
Tue Jul 17 10:35:04 EDT 2007


Hello Chuck,

thanks a lot for helping

all the best

simone






Simone,

Please find attached an email to the GrADS Listserv from earlier this
year showing how to calculate standard deviation...

Chuck

--

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."



On Tuesday 03 April 2007 22:38, Laura Feudale wrote:
> Dear Simon,
> in your script, after you define ztemp and zprec, add the following
> commands to transform the two variables in climatological variables:
> 'modify ztemp seasonal'
> 'modify zprec seasonal'
> So your script should look like this:
>
> .......
> 'define ztemp=ave(aave(tmp.2,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)'
> 'define zprec=ave(aave(pre,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)/30'
> 'modify ztemp seasonal
> 'modify zprec seasonal'
> 'd
> tloop(sqrt(ave(aave(pow(ztemp-tmp.2,2),lon=36,lon=54,lat=51,lat=65),t+396,t
>=528,12)))'
>
> 'd
> tloop(sqrt(ave(aave(pow(zprec-pre,2),lon=36,lon=54,lat=51,lat=65),t+396,t=5
>28,12)))'
>
>
>
> It should fix your problem.
> Regards,
>
> -- Laura
>
> ----------------------------------------------------------------------
>  Laura Feudale, Ph.D. (Climate Dynamics, George Mason University/COLA)
> *Current Affiliation:            Earth System Physics Section
>  The Abdus Salam International Centre for Theoretical Physics
>                          Trieste, ITALY
> ----------------------------------------------------------------------
>
> Simon Krichak wrote:
> > Dear all,
> >
> > My script looks better now (after the suggested by Laura correction) :
> >
> > 'open  ../CRU-DATA/GRADS:1951-2000.pre.ctl '
> > 'open  ../CRU-DATA/GRADS:1951-2000.tmp.ctl '
> > 'set x 1'
> > 'set y 1'
> > 'set t 1 12'
> > 'set tlsupp year'
> > 'define
> > ztemp=ave(aave(tmp.2,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)'
> > 'define
> > zprec=ave(aave(pre,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)/30'
> > 'd
> > tloop(sqrt(ave(aave(pow(ztemp-tmp.2,2),lon=36,lon=54,lat=51,lat=65),t+396
> >,t=528,12)))'
> >
> > 'd
> > tloop(sqrt(ave(aave(pow(zprec-pre,2),lon=36,lon=54,lat=51,lat=65),t+396,t
> >=528,12)))'
> >
> >
> >
> > But still doesn't work properly - please see the result below.
> > Thanks,
> >                     Simon Krichak
> >
> > Grid Analysis and Display System (GrADS) Version 1.9b4
> > Copyright (c) 1988-2005 by Brian Doty and IGES
> > Center for Ocean-Land-Atmosphere Studies (COLA)
> > Institute for Global Environment and Society (IGES)
> > GrADS comes with ABSOLUTELY NO WARRANTY
> > See file COPYRIGHT for more information
> >
> > Config: v1.9b4 32-bit little-endian readline sdf/xdf hdf-sds netcdf lats
> > printim
> >
> > Issue 'q config' command for more information.
> >
> > Landscape mode? (no for portrait):
> > GX Package Initialization: Size = 11 8.5
> > ga-> stand-deviation.gs
> > Cannot plot data - all undefined values
> > Cannot plot data - all undefined values
> > ga->
> >
> > ----- Original Message -----
> > From: "LAURA FEUDALE" <feudale at ICTP.IT>
> > To: <GRADSUSR at LIST.CINECA.IT>
> > Sent: Tuesday, April 03, 2007 11:42 AM
> > Subject: Re: multi-year monthly mean standard deviation
> >
> >> Dear Simon,
> >> the aave function doesn't work when time is a varying dimension. In this
> >> case you should use the "tloop" function.
> >> So try adding the tloop function in this way:
> >>
> >> .....
> >> 'd
> >> tloop(sqrt(ave(aave(pow(ztemp-tmp.2,2),lon=36,lon=54,lat=51,lat=65),t+39
> >>6,t=528,12)))'
> >>
> >> 'd
> >> tloop(sqrt(ave(aave(pow(zprec-pre,2),lon=36,lon=54,lat=51,lat=65),t+396,
> >>t=528,12)))'
> >>
> >>
> >> Regards,
> >>
> >> -- Laura
> >>
> >> ----------------------------------------------------------------------
> >>  Laura Feudale, Ph.D. (Climate Dynamics, George Mason University/COLA)
> >> *Current Affiliation:            Earth System Physics Section
> >>  The Abdus Salam International Centre for Theoretical Physics
> >>                         Trieste, ITALY
> >> ----------------------------------------------------------------------
> >>
> >> On Tue, 3 Apr 2007, Simon Krichak wrote:
> >>> Dear Experts,
> >>>
> >>>  I am trying to calculate mean multiyear standard deviations from
> >>>  monthly mean data on temperature and precip.
> >>>
> >>> To do it I apply the following script:
> >>>
> >>> 'open  ../CRU-DATA/GRADS:1951-2000.pre.ctl '
> >>> 'open  ../CRU-DATA/GRADS:1951-2000.tmp.ctl '
> >>> 'set x 1'
> >>> 'set y 1'
> >>> 'set t 1 12'
> >>> 'set tlsupp year'
> >>> 'define
> >>> ztemp=ave(aave(tmp.2,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)'
> >>> 'define
> >>> zprec=ave(aave(pre,lon=36,lon=54,lat=51,lat=65),t+396,t=528,12)/30'
> >>> 'd
> >>> sqrt(ave(aave(pow(ztemp-tmp.2,2),lon=36,lon=54,lat=51,lat=65),t+396,t=5
> >>>28,12))'
> >>>
> >>> 'd
> >>> sqrt(ave(aave(pow(zprec-pre,2),lon=36,lon=54,lat=51,lat=65),t+396,t=528
> >>>,12))'
> >>>
> >>>
> >>> And obtain the following diagnostics:
> >>>
> >>> ga-> stand-deviation.gs
> >>> Syntax Error:  Invalid dimension expression
> >>>  Cannot use an offset value with a varying dimension
> >>>  Varying dimension = 3
> >>> Error from AVE:  1st dimension expression invalid
> >>> Operation Error:  Error from ave function
> >>>  Operation Error:  Error from sqrt function
> >>>  Error ocurred at column 1
> >>>  DISPLAY error:  Invalid expression
> >>> Expression =
> >>> sqrt(ave(aave(pow(ztemp-tmp.2,2),lon=36,lon=54,lat=51,lat=65),t+396,t=5
> >>>28,12))
> >>>
> >>> Syntax Error:  Invalid dimension expression
> >>> Cannot use an offset value with a varying dimension
> >>> Varying dimension = 3
> >>> Error from AVE:  1st dimension expression invalid
> >>> Operation Error:  Error from ave function
> >>> Operation Error:  Error from sqrt function
> >>>  Error ocurred at column 1
> >>>  DISPLAY error:  Invalid expression
> >>>  Expression =
> >>> sqrt(ave(aave(pow(zprec-pre,2),lon=36,lon=54,lat=51,lat=65),t+396,t=528
> >>>,12))
> >>>
> >>>
> >>>
> >>> I do not understand my mistake unfortunately.
> >>> Please kindly let me know your recommendations.
> >>>
> >>> Thanks.
> >>>                    Simon Krichak

--
Simone Marras, Ph.D. Student
BSC & Universitat Politecnica de Catalunya
Jordi Jirona 29
08034 Barcelona
Spain



More information about the gradsusr mailing list