Home ] Su ]
 

Esempi relativi alla funzione tloop

Esempio n.1

* nomefile tloop1.gs
* A typical application of the tloop function
* is to obtain a time series of areal averages
* using the aave function.
* Since the aave function will not work when time
* is a varying dimension, the use of tloop is required:

'set display color white'
'c'
'set x 1'
'set y 1'
'set t 1 9'
'set lev 850'
'd tloop(aave(tmpprs-273.16,lon=0,lon=360,lat=-90,lat=90))'
'printim tloop_esempio1.gif x800 y600'

* Note that the dimension environment is set up
* to reflect the kind of plot desired, namely
* a line plot where time is the varying dimension.
* Thus it is necessary to fix the X and Y dimensions;
* the values of those dimensions in this case are not relevant.
 

Esempio n.2

* nomefile: tloop2.gs
* The tloop function can be used to smooth in time:

'set display color white'
'c'

'set lon -180 0'
'set lat 40'
'set lev 500'
'set t 3 28'
'd tloop(ave(hgtprs,t-2,t+2))'
'printim tloop_esempio2.gif x800 y600'

* In this example, we are plotting a time-longitude cross section,
* where each time is a 5 time period mean centered at that time.
 

Esempio n.3

 

* nomefile tloop3.gs
* If we wanted to display a time-longitude cross section (X and T varying),
* with the data being averaged over latitude, the 'standard' way to do this might be:

'set display color white'
'c'
'set lon -180 0'
'set lat 42'
'set lev 500'
'set t 1 31'
* 'd ave(hgtprs,lat=20,lat=40)'

* This calculation could be fairly time consuming, since to perform the average,
* a longitude-time section is obtained at each latitude. If the time period is
* long, then this would be a very inneficient operation, due to the ordering of data
* in a typical GrADS data set.
* The tloop function might substantially improve the performance of this calculation:

'd tloop(ave(hgtprs,lat=20,lat=40))'
'printim tloop_esempio3.gif x800 y600'

* since the average is then done at each fixed time, and is thus just an average
* of X varying data over Y. Thus the tloop function here is simply being used
* to force a different ordering to the calculation, although the result is the same.


Questa pagina è stata realizzata da Vittorio Villasmunta

Ultimo aggiornamento: 14/05/16