2

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)?

user17744
  • 21
  • 1
  • 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

2 Answers2

1

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.

radouxju
  • 49,636
  • 2
  • 71
  • 144
1

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).

Mike T
  • 42,095
  • 10
  • 126
  • 187