[GRASS-user] Do filters available in GRASS takes care of cell padding?

Uttam Kumar uttamsinha09 at gmail.com
Thu Dec 3 19:47:01 PST 2015

If I am trying to use

r.mfilter input=band5 output=band5_highpassfilter

where high_pass_filter is

TITLE 5x5 High Pass
-1 -1 -1 -1 -1
-1 -1 -1 -1 -1
-1 -1 24 -1 -1
-1 -1 -1 -1 -1
-1 -1 -1 -1 -1

1.) How do I ensure that cell padding is taken care using r.grow.distance?
Do I need to apply r.grow.distance on the output of r.mfilter or it should
be applied before r.mfilter on the input image (band5 in this case)?

2.) Will use of r.resamp.filter will do both - cell padding and apply
filter in a single execution? However, I felt r.resamp.filter does not
allow specifying the type of filter such as high pass filter coefficients
in the input.

r.resamp.filter input=band5 output=band5_resamp filter=box radius=1

How to specify the filter coefficients here?

3.) r.resamp.stats does not allow to specify the filter size (3 or 5)?

I feel that in any case the number of rows should increase by 2 (1 top and
1 bottom) and number of columns should increase by 2 (1 left and 1 right)
during cell padding.

4.) Which one of the above GRASS commands would be best suited to perform
window operation (high pass filtering) along with cell padding?

Any suggestions are appreciated and welcome.

On Mon, Nov 30, 2015 at 6:11 PM, Glynn Clements <glynn at gclements.plus.com>

> Uttam Kumar wrote:
> > Do the filters available in GRASS GIS such as average, low pass, high
> pass
> > filters take care of cell padding automatically?
> "filters"?
> > By Cell paddding, I refer to duplicating the first row on top,
> duplicating
> > bottom row at the bottom, duplicating first column before the actual
> first
> > column and duplicating last column after the actual last column.
> None of the modules do this, although you can achieve that result by
> by first using e.g. r.grow.distance with the value= option to replace
> null cells with the nearest non-null cell.
> r.resamp.filter simply enlarges the source region by the kernel
> radius. If this results in it reading nulls (because the enlarged
> region extends beyond the area for which the map contains data), then
> either
> a) the nulls will be propagated (if -n is used) or,
> b) the weighting will be adjusted, i.e. the result will be
>         sum(weight * value)/sum(weight)
> where both sums are evaluated over the non-null inputs.
> r.resamp.stats behaves similarly (i.e. it either propagates nulls or
> computes the aggregate over the non-null cells).
> r.neighbors always calculates the aggregate over the non-null cells.
> --
> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20151203/21fc17d2/attachment.html>

More information about the grass-user mailing list