[GRASS5] very confused over NULL in rasters

William L. Baker BakerWL at uwyo.edu
Sat Dec 16 16:36:02 EST 2000


Hello,

Still another question while revising r.le, which is especially
messy because of null values and true zeroes.

I am confused about what the possible cases are for null values
in a raster map and the corresponding null file.

1. Will NULL values be in the raster map itself?
The programming manual section 5.8.2.2 on NULL VALUES
says that "the NULL values will not be written to the raster map
itself; a zero will be written as a place holder."  But, earlier (a
couple of pages back it says "Provide two methodologies for
accessing NULL values when reading maps: --embedding the
NULL value in the raster data buffers" and "All support functions
should assume that the data has embedded NULL values"
It seems that the first statement is wrong in the programming
manual, as NULL values can be embedded in the raster?

Since this seems contradictory, I looked at how r.null handles this.
Actually, r.null does embed "nan" in float/double rasters and
a large negative number (-2147483648.00000) in integer rasters.

Actually, the programming manual (section 5.8.2.2 NULL-values)
says "The bit pattern used for integer is the largest positive integer"
but r.null seems to lead to the largest negative integer on my
machine (Mandrake 7.2 on Intel).

So, am I right that NULL values can sometimes be embedded
only in the actual rasters?  This could happen if the raster has
no accompanying null-value file?

What is the correct way to search for a null in the raster, since
it can apparently be "nan" "largest negative integer" etc.  Does
this have to be done with a set of three cases, one each for
CELL, FCELL, DCELL?  Does searching for "== NULL" get
all the possible cases?

I think the programming manual needs to be cleaned up so it
is more correct about this, or else so people like me don't
misunderstand it, as it seems to be contradictory.  I can't
fix it though myself without knowing what is really right!


2. The NULL in the null value file (cell_misc/<map>/null) in the
programming manual is "one indicating that the corresponding
cell contains valid data, and zeros indicating that the corresponding
cell contains a NULL value.  I may have done something wrong
when I looked at the results from using r.null, but I'm pretty sure
that program does just the opposite--a one indicates a null and
a zero indicates valid data.  Is this wrong in the programming
manual or does r.null have it backwards?  What are programmers
assuming is correct?

Bill Baker
Univ. of Wyoming
BAKERWL at UWYO.EDU



---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list