[GRASS-user] r.mfilter produces empty result

Dear all,

I am trying to apply a high pass filter to a raster; following Markus Neteler’s book I created a simple high-pass filter:

> cat highpass9.txt
TITLE 3x3 High Pass
MATRIX 3
-1 -1 -1
-1  8 -1
-1 -1 -1
DIVISOR 9
TYPE S

I then apply the filter:

> r.mfilter input=blenddem output=blenddem.highpass filter=highpass9.txt
 100%
Writing raster map <blenddem.highpass>

Apparently everything went fine, but in the Map Display the resulting raster is entirely blank.

A quick check with the statistics shows that indeed the result is empty:

> r.univar blenddem.highpass
 100%

What is going on here? I also tried the same filter in Markus’ book and result is again a blank raster. Is there some operation missing?

More details on this issue at GIS.SE: https://gis.stackexchange.com/q/239556/21532

Thank you.

···

Luís Moreira de Sousa

Im Grund 6

CH-8600 Dübendorf

Switzerland

Phone: +41 (0)79 812 62 65

Email: luis.de.sousa@protonmail.ch

URL: https://sites.google.com/site/luismoreiradesousa

Hi,

2017-05-11 9:36 GMT+02:00 Luí­s Moreira de Sousa <luis.de.sousa@protonmail.ch>:

r.mfilter input=blenddem output=blenddem.highpass filter=highpass9.txt

100%
Writing raster map <blenddem.highpass>

did you set up correctly computational region?

g.region raster=blenddem

Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Thu, May 11, 2017 at 3:47 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2017-05-11 9:36 GMT+02:00 Luí­s Moreira de Sousa <luis.de.sousa@protonmail.ch>:

r.mfilter input=blenddem output=blenddem.highpass filter=highpass9.txt

100%
Writing raster map <blenddem.highpass>

did you set up correctly computational region?

g.region raster=blenddem

Ma-

https://gis.stackexchange.com/questions/239556/r-mfilter-produces-empty-result

From the GIS SE question it seems everything is correctly set. In that

case, could you provide us with your data to test it? You can send a
link to it, offlist if you need to.

Anna

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Thu, May 11, 2017 at 10:15 AM, Luí­s Moreira de Sousa
<luis.de.sousa@protonmail.ch> wrote:

Hi Anna, thanks for the help. I can not post the DEM to the list, here is a
link to Dropbox:

It seems the problem is in the filter specification:

TITLE 3x3 High Pass
MATRIX 3
-1 -1 -1
-1 8 -1
-1 -1 -1
DIVISOR 9
TYPE S

If you change it to TYPE P it will work. S is 'sequential':

Sequential filtering happens in place. As the filter is applied to the
raster map layer, the category values that were changed in neighboring
cells affect the resulting category value of the current cell being
filtered.

So since you have nulls all around it it probably propagates the
nulls. I am not sure if it's a bug. Is the S type required for your
analysis?

Anna

--
Luís Moreira de Sousa
Im Grund 6
CH-8600 Dübendorf
Switzerland

Phone: +41 (0)79 812 62 65
Email: luis.de.sousa@protonmail.ch
URL: https://sites.google.com/site/luismoreiradesousa

-------- Original Message --------
Subject: Re: [GRASS-user] r.mfilter produces empty result
Local Time: 11 May 2017 3:56 PM
UTC Time: 11 May 2017 13:56
From: kratochanna@gmail.com
To: Martin Landa <landa.martin@gmail.com>
Luí­s Moreira de Sousa <luis.de.sousa@protonmail.ch>,
grass-user@lists.osgeo.org <grass-user@lists.osgeo.org>

On Thu, May 11, 2017 at 3:47 AM, Martin Landa <landa.martin@gmail.com>
wrote:

Hi,

2017-05-11 9:36 GMT+02:00 Luí­s Moreira de Sousa
<luis.de.sousa@protonmail.ch>:

r.mfilter input=blenddem output=blenddem.highpass filter=highpass9.txt

100%
Writing raster map <blenddem.highpass>

did you set up correctly computational region?

g.region raster=blenddem

Ma-

https://gis.stackexchange.com/questions/239556/r-mfilter-produces-empty-result

From the GIS SE question it seems everything is correctly set. In that
case, could you provide us with your data to test it? You can send a
link to it, offlist if you need to.

Anna

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Thank you Anna, indeed with TYPE P it works correctly.

My first question is why is it in the book with TYPE S? That way it does not seem to be a high-pass filter at all…

I also find the definition of the sequential filter somewhat unclear. Not sure what it does, but certainly can not be used with high-pass or low-pass filters.

Thank you.

···

Luís Moreira de Sousa

Im Grund 6

CH-8600 Dübendorf

Switzerland

Phone: +41 (0)79 812 62 65

Email: luis.de.sousa@protonmail.ch

URL: https://sites.google.com/site/luismoreiradesousa

-------- Original Message --------

Subject: Re: [GRASS-user] r.mfilter produces empty result

Local Time: 11 May 2017 4:41 PM

UTC Time: 11 May 2017 14:41

From: kratochanna@gmail.com

To: Luí­s Moreira de Sousa luis.de.sousa@protonmail.ch, GRASS user list grass-user@lists.osgeo.org

On Thu, May 11, 2017 at 10:15 AM, Luí­s Moreira de Sousa

luis.de.sousa@protonmail.ch wrote:

Hi Anna, thanks for the help. I can not post the DEM to the list, here is a

link to Dropbox:

It seems the problem is in the filter specification:

TITLE 3x3 High Pass

MATRIX 3

-1 -1 -1

-1 8 -1

-1 -1 -1

DIVISOR 9

TYPE S

If you change it to TYPE P it will work. S is ‘sequential’:

Sequential filtering happens in place. As the filter is applied to the

raster map layer, the category values that were changed in neighboring

cells affect the resulting category value of the current cell being

filtered.

So since you have nulls all around it it probably propagates the

nulls. I am not sure if it’s a bug. Is the S type required for your

analysis?

Anna

Luís Moreira de Sousa

Im Grund 6

CH-8600 Dübendorf

Switzerland

Phone: +41 (0)79 812 62 65

Email: luis.de.sousa@protonmail.ch

URL: https://sites.google.com/site/luismoreiradesousa

-------- Original Message --------

Subject: Re: [GRASS-user] r.mfilter produces empty result

Local Time: 11 May 2017 3:56 PM

UTC Time: 11 May 2017 13:56

From: kratochanna@gmail.com

To: Martin Landa landa.martin@gmail.com

Luí­s Moreira de Sousa luis.de.sousa@protonmail.ch,

grass-user@lists.osgeo.org grass-user@lists.osgeo.org

On Thu, May 11, 2017 at 3:47 AM, Martin Landa landa.martin@gmail.com

wrote:

Hi,

2017-05-11 9:36 GMT+02:00 Luí­s Moreira de Sousa

luis.de.sousa@protonmail.ch:

r.mfilter input=blenddem output=blenddem.highpass filter=highpass9.txt

100%

Writing raster map <blenddem.highpass>

did you set up correctly computational region?

g.region raster=blenddem

Ma-

https://gis.stackexchange.com/questions/239556/r-mfilter-produces-empty-result

From the GIS SE question it seems everything is correctly set. In that

case, could you provide us with your data to test it? You can send a

link to it, offlist if you need to.

Anna

Martin Landa

http://geo.fsv.cvut.cz/gwiki/Landa

http://gismentors.cz/mentors/landa


grass-user mailing list

grass-user@lists.osgeo.org

https://lists.osgeo.org/mailman/listinfo/grass-user

Hi Luís,

On Thu, May 11, 2017 at 9:36 AM, Luí­s Moreira de Sousa
<luis.de.sousa@protonmail.ch> wrote:

Dear all,

I am trying to apply a high pass filter to a raster; following Markus
Neteler's book I created a simple high-pass filter:

cat highpass9.txt

TITLE 3x3 High Pass
MATRIX 3
-1 -1 -1
-1 8 -1
-1 -1 -1
DIVISOR 9
TYPE S

In the book (3rd edition, p 309) we wrote

TYPE P (not S).

Maybe that helps?
Markus

--
Markus Neteler, PhD
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog

On Thu, May 11, 2017 at 5:05 PM, Luí­s Moreira de Sousa
<luis.de.sousa@protonmail.ch> wrote:

Thank you Anna, indeed with TYPE P it works correctly.

My first question is why is it in the book with TYPE S? That way it does not
seem to be a high-pass filter at all...

Indeed. Two things:

- you were reading the oldish 1st edition of the book from 2002 while
there is the fancy 3rd edition from 2008 :slight_smile:
- The erratum was noted here back then:
https://grassbook.org/errata/errata-1st-edition

I also find the definition of the sequential filter somewhat unclear. Not
sure what it does, but certainly can not be used with high-pass or low-pass
filters.

Likely something to improve in the manual page of r.mfilter.

HTH,
Markus

--
Markus Neteler, PhD
http://www.mundialis.de - free data with free software
http://grass.osgeo.org
http://courses.neteler.org/blog