aggregate pixel values within shapes or another raster [message #69391] |
Thu, 14 January 2010 01:54  |
ivitseva
Messages: 15 Registered: December 2009
|
Junior Member |
|
|
Dear All,
I have a time series of images (yearly data) on 1km spatial resolution
and I have a systematic grid in an ArcGIS shapefile format or a ArcGIS
grid format or envi BIL format, whatever suits best that has a 25km
spatial resolution. I need to calculate the mean and standard
deviation of all pixels within 1 grid zone, for all years and write
them out in a new image. Thus, in case of 26 input years on 1km
spatial resolution I need to have 26 output images on 25km spatial
resolution, where in each 25km cell the mean and/or the standard
deviation of the 1km cells within the respective grid is written.
Besdies opening and reading the files (at least that I have no
problems with) any clue please how to start it? Thank you very much in
advance, Eva.
|
|
|
Re: aggregate pixel values within shapes or another raster [message #69512 is a reply to message #69391] |
Mon, 18 January 2010 00:06  |
wita
Messages: 43 Registered: January 2005
|
Member |
|
|
Dear Itiseva,
Have a look at: ftp://sc:image1@ftp.alterra.nl/pub/adewit/cgi_zonal_stats.pr o
It is basically as simple as:
result = cgi_zonal_stats(zones, data)
Results is a structure which contains the zone_id, mean, count, stdev
and median of the values in 'data' (each layer in your time-series)
for each unique zone in 'zones' (your 25km grid). A requirement is
that 'zones' and 'data' are on the same grid, so resample your 25km
grid to your 1km data grid.
The function leverages the power of HISTOGRAM module by looping over
the reverse indices returned by HISTOGRAM and is therefore maybe
faster then David's solution. Moreover, my routine can aggregate data
over arbitrary shaped zoned and not just within kernel.
My guess is that this is exactly what you need.
Hope this helps
Allard
|
|
|