[GRASS-dev] dealing with null values in rasters only within mask
Stefan Blumentrath
Stefan.Blumentrath at nina.no
Fri Jun 28 02:10:23 PDT 2019
Hi Moritz,
Did you consider r.stats -N for checking for NULL values within the masked area, like:
r.stats -N input=tile,MASK
if there is *|1 in the output you have NULL cells in the tile...
For filling NULLs with a given value you could do:
r.mapcalc expression=tile_filled=if(MASK,if(isnull(tile),1,tile),null())
Just an idea...
Cheers
Stefan
-----Original Message-----
From: grass-dev <grass-dev-bounces at lists.osgeo.org> On Behalf Of Moritz Lennert
Sent: fredag 28. juni 2019 10:57
To: grass-dev at lists.osgeo.org
Subject: [GRASS-dev] dealing with null values in rasters only within mask
Hi to all,
As a followup of some recent discussions concerning the handling of null values, I have a fundamental issue, and would like some feedback:
I am working with irregular tiles of orthoimages. Each tile corresponds to the part of a large image mosaic that comes from a particular take.
Some of these tiles contain pixels with null values (generally due to sensor saturation).
I would like to be able to do the following:
- detect whether there are any null values in the tile
- replace the pixels values with a given value (or possibly use something like r.fill.stats)
For this, I am confronted to some issues:
- r.univar does not make a difference between null values in the data and those that are due to a mask (https://trac.osgeo.org/grass/ticket/3696). This means that if I create a mask to correspond to the irregular tile, I cannot use r.univar to detect whether there are any null values within the actual image tile.
- If I decide to just replace all null values with a given value, r.null also does not take into account the mask. IOW, it will fill all null pixels in the entire region outside the mask with that value.
- The same happens if I use r.mapcalc to replace null values with a given value.
Is there any way to solve this issues with existing tools, or would this demand a change in the code, in order to differentiate null values that are null because of a mask from other null values ? Any reflections on this ?
Moritz
_______________________________________________
grass-dev mailing list
grass-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev
More information about the grass-dev
mailing list