[GRASS-dev] dealing with null values in rasters only within mask

Moritz Lennert mlennert at club.worldonline.be
Fri Jun 28 01:57:05 PDT 2019

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 ?


More information about the grass-dev mailing list