[GRASS-dev] Re: [GRASS GIS] #73: r.out.gdal tiff output does not work

Markus Metz markus.metz.giswork at googlemail.com
Thu Apr 23 07:34:20 EDT 2009


Glynn Clements wrote:
> Markus Metz wrote:
>
>   
>>>    - all floating point: IEEE's NaN
>>>       
>> Problem with NaN? According to IEEE 754, x == y is always FALSE if 
>> either x or y or both are NaN. Assuming (nodata = 
>> GDALGetRasterNoDataValue()) == NaN,
Sorry, should have been nodata = GDALGetRasterNoDataValue() and 
isnan(nodata)
>>  then going through all cells if 
>> (cell == nodata) will always be FALSE, nodata cells may not be detected? 
>> Depends on each implementation of nodata detection? Can be solved for 
>> GRASS, but how is this done in all other GIS applications?
>>     
>
> 	if (x == nodata || isnan(nodata) && isnan(x))
>
> isnan() is C99 and POSIX, or it can be defined as e.g.:
>
> 	#define ISNAN(x) ((x) != (x))
As previously in ticket #73, I created a MASK and then exported 
elevation from nc_spm_08 as FLOAT32, once with nodata=0 and once with 
default nodata value NaN for GDT_Float32.
GRASS 7 r.in.gdal: all ok
GRASS 7 r.external: all ok

Other GIS applications:
QGIS 1.0.0: all ok
gvSIG 1.1.2: doesn't support the nodata concept, and NaN is displayed 
like 0.0
SAGA 2.0.3: display ok for NaN, but cell query gives 0.0 instead of NaN 
or nodata, and NoData info says 0
ESRI ArcMap 9.2: display ok for nodata=0, not ok when using NaN, NaN 
displayed like value 0.0, and cell query gives NaN instead of nodata

Considering this, rather use e.g. raster_min - 1 as default nodata value 
for GDAL floating point datatypes?


More information about the grass-dev mailing list