[gdal-dev] [gdal-commits] r40282 - trunk/gdal/frmts/aaigrid
Kurt Schwehr
schwehr at gmail.com
Mon Oct 2 08:04:30 PDT 2017
+gdal-dev
Even,
Looking back at the changes to aaigrid, I think I've messed things up with
nodata. Before I submit anything else, what do you think?
The trouble is that it is no longer doing a cast to float for in range
values. That means for large values, it's not getting rounded to the
nearest float value any more. I'm seeing this in one on my local tests. I
dump the json out of gdalinfo and compare. For float64.asc.json:
I was getting: -1.234567880630493164
Now seeing: -1.234567890123
The new value matches the text in the file, but it was a behavior change.
Leave it be or put in an else that does the rounding to nearest float value
by casting?
What do you think?
-kurt
On Sat, Sep 30, 2017 at 10:59 AM, Even Rouault <even.rouault at spatialys.com>
wrote:
> On samedi 30 septembre 2017 10:47:16 CEST svn_gdal at osgeo.org wrote:
>
> > Author: goatbar
>
> > Date: 2017-09-30 10:47:16 -0700 (Sat, 30 Sep 2017)
>
> > New Revision: 40282
>
>
>
> Kurt,
>
>
>
> This will break the following test case with a infinite null value
>
>
>
> {{{
>
> north: 250.000000
>
> south: 0.000000
>
> east: 150.000000
>
> west: -100.000000
>
> rows: 2
>
> cols: 2
>
> null: inf
>
> 0 0
>
> 0 0
>
> }}}
>
>
>
> Peviously gdalinfo reported
>
> NoData Value=inf
>
> now its reports
>
> NoData Value=3.4028234663852886e+38
>
>
>
> so you should make a special case for pos and neg infinities.
>
>
>
> Note: in the same file, in the AAIGRID driver, there's a similar code at
> line 537
>
>
>
> Evn
>
>
>
> >
>
> > Modified:
>
> > trunk/gdal/frmts/aaigrid/aaigriddataset.cpp
>
> > Log:
>
> > Change double -> float -> double cast to clamping by numeric limits in
>
> > GRASSASCIIDataset::ParseHeader
>
> >
>
> > Found by autofuzz
>
> >
>
> >
>
> > Modified: trunk/gdal/frmts/aaigrid/aaigriddataset.cpp
>
> > ===================================================================
>
> > --- trunk/gdal/frmts/aaigrid/aaigriddataset.cpp 2017-09-30 16:56:10 UTC
> (rev
>
> > 40281) +++ trunk/gdal/frmts/aaigrid/aaigriddataset.cpp 2017-09-30
> 17:47:16
>
> > UTC (rev 40282) @@ -633,9 +633,10 @@
>
> > }
>
> > if( eDataType == GDT_Float32 )
>
> > {
>
> > - // TODO(schwehr): Is this really what we want?
>
> > - dfNoDataValue =
>
> > - static_cast<double>(static_cast<float>(dfNoDataValue));
>
> > + if( dfNoDataValue >= std::numeric_limits<float>::max() )
>
> > + dfNoDataValue = std::numeric_limits<float>::max();
>
> > + if( dfNoDataValue <= -std::numeric_limits<float>::max() )
>
> > + dfNoDataValue = -std::numeric_limits<float>::max();
>
> > }
>
> > }
>
> >
>
> >
>
> > _______________________________________________
>
> > gdal-commits mailing list
>
> > gdal-commits at lists.osgeo.org
>
> > https://lists.osgeo.org/mailman/listinfo/gdal-commits
>
>
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
--
--
http://schwehr.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171002/a80b8df6/attachment.html>
More information about the gdal-dev
mailing list