[Thread Prev][Thread Next][Index]

how to grid yt-scattered data



Dear Ferret-users,

recently I posted a question to this mailing list describing the following
problem:

Assume you have point data (scattered data) over latitude and time and you like
to compile a 'zonal average climatology' from it. How can you do that ?

Below is a possible solution for everybody who is interested and has a similar
problem. Hope anybody can use it.

Yours,
           Patrick Joeckel

! --yt-gridding demo ------------------------------------------
! read (e.g.) an ascii-file with the data in 3 columns
! day is from 1 to 365, latitude from -90 to +90, value is the data to grid
file/var="day,lat,value" data.txt

! now define the grid, the climatology should be based on
! here a 5-deg latitude interval is chosen, and a 1-day time interval
! respectively
DEFINE AXIS/y=-90:90:5/unit=lat yax
DEFINE AXIS/t="01-Jan-0001":"31-Dec-0001"/npoints=365 tax
DEFINE GRID/y=yax/t=tax gyt

! define additionally an intermediate xz-grid for the 'gridding' process
! the x-axis is used for the latitude dimension
! it has to have the same intervals as the 'real' y-axis above 
DEFINE AXIS/x=-90:90:5 xax
! the z-axis is used for the time dimension
! it has to have the same intervals as the 'real' t-axis above
DEFINE AXIS/z=1:365:1 zax

! with this intermediate grid, we can use the xz-regridding (external) function
! of ferret
LET data_pre = scatter2gridlaplace_xz (lat, day, value, x[gx=xax], z[gz=zax],5.,5)

! finally, transform the data from the intermediate grid to the desired grid 
! this does the x->y, z->t transformation
let data_final = RESHAPE(data_pre,t[gt=gyt]+y[gy=gyt])

! NOTE, that this does not work with a x-y intermediate grid, where y is
! already used for longitude, since the RESHAPE-function does not transform
! the x-axis into the t-axis
! --------------------------------------------------------

-- 
---------------------------------------------------------------
Patrick Joeckel
Max Planck Institute for Chemistry
Joh.-J. Becher Weg 27         
55128 Mainz                   phone:++49-6131-305452      
Germany                       fax  :++49-6131-305436     
                             e-mail:joeckel@mpch-mainz.mpg.de
                         http://www.mpch-mainz.mpg.de/~joeckel
---------------------------------------------------------------
Never trust an operating system you don't have sources for.


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement