[gdal-dev] GDALSetRasterNoDataValue and NaN

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] GDALSetRasterNoDataValue and NaN

Radim Blazek-2
Hi,
is it safe to use GDALSetRasterNoDataValue() with
std::numeric_limits<double>::quiet_NaN()?

Radim
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDALSetRasterNoDataValue and NaN

Mateusz Loskot
On 21 August 2012 12:01, Radim Blazek <[hidden email]> wrote:
> Hi,
> is it safe to use GDALSetRasterNoDataValue() with
> std::numeric_limits<double>::quiet_NaN()?

What kind of safety do you mean?

AFAICT, it does not sound sensible anyway.
Use of NaN would give unreliable results, by definition of NaN:

    double n1 = std::numeric_limits<double>::quiet_NaN();
    double n2 = std::numeric_limits<double>::quiet_NaN();
    assert(n1 != n2);

Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDALSetRasterNoDataValue and NaN

Even Rouault
In reply to this post by Radim Blazek-2
Selon Radim Blazek <[hidden email]>:

> Hi,
> is it safe to use GDALSetRasterNoDataValue() with
> std::numeric_limits<double>::quiet_NaN()?

There have been some work done in GDAL core (mainly in statistics functions), in
some algorithms (warping for example), in some utilities and in some drivers
(GTiff, VRT) to be able to deal properly with NaN as a nodata value, but the
support might be missing in other parts, because it generally requires a
particular case to deal with it.The support has been added incrementally when
someone raised a misbehaviour in a particular area. Basically, you can grep
CPLIsNan in the source tree and it will give you a good picture of the places
where some work has been done to support it.

>
> Radim
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev