[GRASS-user] r.resamp.stats: how to count valid input pixels

Hi,

I am trying to find a way to do "r.resamp.stats method=average" together
with some option like: "propagate NULLs, but only if >= 50% of the input
pixels are NULLs".

I was hoping that some "method=countvalid" would perhaps exist, that would
generate a map which I could use to MASK unwanted/unreliable aggregation
results. But it doesn't.

Any suggestions?

Hermann (using GRASS7 from trunk, since recently)

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-resamp-stats-how-to-count-valid-input-pixels-tp5156214.html
Sent from the Grass - Users mailing list archive at Nabble.com.

peifer wrote:

I am trying to find a way to do "r.resamp.stats method=average" together
with some option like: "propagate NULLs, but only if >= 50% of the input
pixels are NULLs".

I was hoping that some "method=countvalid" would perhaps exist, that would
generate a map which I could use to MASK unwanted/unreliable aggregation
results. But it doesn't.

Any suggestions?

Create a validity map with e.g.

  r.mapcalc "valid = !isnull(input)"

then use r.resamp.stats method=average on that.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote

Create a validity map with e.g.

  r.mapcalc "valid = !isnull(input)"

then use r.resamp.stats method=average on that.

Thanks for the hint.

After a second thought, I came up with something slightly different:
  r.reclass input # valid pixels (cat 0..100)= 1, nodata pixels (cat
254,255) = 0
then r.resamp.stats method=sum # to get the count of valid pixels

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/r-resamp-stats-how-to-count-valid-input-pixels-tp5156214p5156444.html
Sent from the Grass - Users mailing list archive at Nabble.com.