I have a GDAL raster that looks like this: Unfiltered raster of priority values

And I would really like to blur this raster along an arbitrary transect.

I see that scipy.ndimage has a gaussian filter that allows me to blur the raster along a given axis, as long as the axis is valid given the raster's numpy matrix. Doing so with the default axis of -1 (and sigma=2) looks like this:

Same raster with 1-dimensional gaussian filtering

This raster is pretty close to what I'm looking for, I'd just really like to have this filtering not strictly happen along the horizontal axis, if that's possible.

So my questions are thus:

  • Is it possible to filter the matrix along an arbitrary axis, such as an axis that is not necessarily along the vertical or horizontal?
  • Is it possible to do so just with Numpy/Scipy and GDAL?
  • Why not just convolve the image with an appropriate kernel? E.g., a 5 x 5 kernel equal to the diagonal matrix [.067, .242, .382, .242, .067] will blur along a 45 degree axis. – whuber Sep 28 '12 at 20:17
  • That could totally work! Thanks for the suggestion! – James Sep 28 '12 at 20:21
  • example please? I fail to see how it helps – nickves Sep 28 '12 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.