[Numpy-discussion] "moving window" in numpy

Matthew Perry perrygeo@gmail....
Sun Nov 25 19:00:48 CST 2007


Hi all,

 I'm not sure if my terminology is familiar but I'm trying to do a
"moving window" analysis (ie a spatial filter or kernel) on a 2-D
array representing elevation. For example, a 3x3 window centered on
each cell is used to calculate the derivate slope of that cell.

 Can this easily be implemented using numpy?

 Currently I have tried implementing in pure python loops (too slow)
and c++ (fast but more difficult to compile, distribute, wrap in
python calls, etc). I think a good solution would be to leverage numpy
which is both fast and and easy package for end users to install.

 An example of the C++ code I'm trying to emulate is at
http://perrygeo.net/download/hillshade.html . Does anyone have any
tips or examples out there? Where should I start researching this?

-- 
Matthew T. Perry
http://www.perrygeo.net


More information about the Numpy-discussion mailing list