How do I adjust the code for the Gaussian Blur posted in the thread:

What raster smoothing/generalization tools are available?

to retain the resolution/gradients in the y direction and blur only in the x direction (rather than over a square area)?

  • My answer there applies directly if you simply use neighborhoods that extend only one cell vertically (that is, in the y direction). – whuber May 30 '13 at 19:24

It depends on the kernel shape. The linked answer in the question uses a circular kernel shape (not square), since the size of x and y values are identical. However, the source code was based on this cookbook which defines a kernel on size and optional sizey, for a different size in the y-direction. Therefore, the kernel is elliptical, and should do what you are looking for (i.e., a rectangle stretched out in the x-direction).


Here is how to make @whuber 's answer directional.

1) take the mean of a 3 pixels by 1 window centered on your pixel. (equivalent to a custom linear neighbourhood with weights of 1/3, 1/3 and 1/3)

2) repeat several times

alternatively, you can define a custom neighborhood with the weights extracted from a Gaussian distribution or other smoothing kernel.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.