[GRASS-dev] Fwd: Re: [gdal-dev] Setting NODATA to -nan

Glynn Clements glynn at gclements.plus.com
Sat Jul 18 03:48:24 PDT 2015


Yann Chemin wrote:

> it might be that some communication improvement from GRASS-GDAL could be
> done?
> 
> is there a clear NODATA/NAN definition understood within GDAL that we could
> use within r.out.gdal as a target NODATA value whenever anything than a
> number is used (i.e. NaN, nan, -nan, helloworld, mynameisbee, etc.)
> 
> typically MODIS users are used to -28768 and similar "standard" NODATA
> numbers, but that maybe another story.

IMHO, anything using NaN as a no-data value should treat all NaNs
equally. The reason being that the only way to reliably propagate the
representation for a NaN is to memcpy() it. Assignment only preserves
NaN-ness, not necessarily the representation.

Actually, r.external is doing it wrong, as it expects any NaNs
supplied by GDAL to exactly match the representation generated by
Rast_set_d_null_value() (the all-ones bit pattern).

Fixed in r65602.

And if the no-data value isn't NaN, you have the issue of comparing
floating-point values for equality. Well, that will probably work so
long as the chosen no-data value is an integer.

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


More information about the grass-dev mailing list