[GRASSLIST:116] Re: jumping moving window analysis

Hamish hamish_nospam at yahoo.com
Tue Mar 14 22:33:41 EST 2006


> I am stuck with a solution how to compute a kind of jumping moving
> window. 
> 
> We have a 1 Km DEM (gtopo30) and a 90 m DEM (SRTM) and would like to
> know how  high the diversity of the srtm90 inside a gtopo30 pixel is.
> This could be achieved by a jumping moving window which is aligned to
> the gtopo30 but computes the diversity on the srtm90. The output
> would be a diversity map based on srtm90 but with a resolution of the
> gtopo30. 
> 
> r.le has an option called systematic continuous but writes the output
> into a  file rather than creating a new map.
> 
> r.neighbors is not a solution because it computes the diversity for
> each pixel continuous and not un-continuous like we wish.  


g.region rast=gtopo30

to get the box size, number of rows and columns, then

g.region rast=srtm

to match the res then set the region to the size/placement of the first
gtopo30 cell.

then iterate r.univar & adjusting the region.

either by

g.region e=e+${dx} w=w+${dx}
 or
g.region e=w w=w+${dx}    # ???

then at the end of the row,

g.region n=n-${dy} s=s-${dy}
 or
g.region n=s s=s-${dy}    # ???

& reset e,w. Careful that the big & little cells line up. See the
g.region help page for more on relative region changes.


or v.mkgrid, as you thought, and a loop which does v.extract or v.select
--o by the box ij ID, then g.region vect=single_box, r.univar, & loop.


let me know if that doesn't make sense and I'll try and put together
some pseudo-code which might explain it better. I've done this before
with luck..


Hamish




More information about the grass-user mailing list