Average function

Charles Seman Charles.Seman at NOAA.GOV
Mon May 22 18:59:51 EDT 2006


Loic,

If you try defining variables
(http://grads.iges.org/grads/gadoc/variable.html#new), it may work (are
your times (dates) different for each file? ...specifying the time
levels directly is then probably why you were able to do your working
example)

'set dfile 1'
...set lon/lat/height for file 1
'set t 1'
'define tas1 = ave(tas,t=2,t=1190)'
set dfile 2'
...set lon/lat/height for file 2
'set t 1'
'define tas2 = ave(tas,t=2,t=1190)'
'd tas1-tas2'

I hope this helps,
Chuck

Cottet, Loic (IFPRI) wrote:
> Hi all,
>
> I am trying to do the difference between 2 averages.
>
> It does not work:
>
> ga-> d (ave(tas,t=2,t=1190)-ave(tas.2,t=2,t=1190))
> Averaging.  dim = 3, start = 2, end = 1190
> Averaging.  dim = 3, start = 2, end = 1190
> Data Request Error: Invalid grid coordinates
>   World coordinates convert to non-integer grid coordinates
>     Variable = tas.2  Dimension = 3
> Operation Error:  Error from ave function
>   Error ocurred at column 22
> DISPLAY error:  Invalid expression
>   Expression = (ave(tas,t=2,t=1190)-ave(tas.2,t=2,t=1190))
>
> So I tried to put the same level (z=1)
>
> ga-> set z 1
> LEV set to 0 0
> ga-> d (ave(tas,t=2,t=1190)-ave(tas.2,t=2,t=1190))
> Averaging.  dim = 3, start = 2, end = 1190
> Averaging.  dim = 3, start = 2, end = 1190
> Data Request Error: Invalid grid coordinates
>   World coordinates convert to non-integer grid coordinates
>     Variable = tas.2  Dimension = 3
> Operation Error:  Error from ave function
>   Error ocurred at column 22
> DISPLAY error:  Invalid expression
>   Expression = (ave(tas,t=2,t=1190)-ave(tas.2,t=2,t=1190))
>
>
> It still has not worked,
>
> Can anyone help me out,
>
> I do not understand how else to do it because it works when I do a simple
> difference between those 2 temperature files:
>
> ga-> set z 1
> LEV set to 0 0
> ga-> d ((tas.2(t=1190)-tas.2(t=2)-(tas(t=1190)-tas(t=2))))
> Contouring: -25 to 15 interval 5
>
> I really would grateful to your help,
>
> Thanks a lot,
>
> Loic
>

--

********************************************************************
 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