Skip to content

AsciiGrid does not detect -3.4e+38 as a noData value #576

@latwood

Description

@latwood

Been playing around with no data filling methods. When I used bell_steep.tif converted to a new projection using the gdalwarp command line utility, the resulting noData values of -3.4e+38 wreaked havoc in the AsciiGrid fillNoDataValues() function, because if( get_cellValue(i,j) == get_noDataValue() ) was not seen as true. In addition, the call to if( input.dem.checkForNoDataValues() ) in readInputFile.cpp did not detect -3.4e+38 as a noData value, I had to swap to if( GDALHasNoData( poDataset, 1 ) ) to correctly detect the noData vals.

Note that the gui indirectly uses the GDALFillNodata() GDAL function, via calls to the gdal_util.cpp GDALFillBandNoData() function, which properly detects and fills -3.4e+38 as a noData value, but runs a heck of a lot slower than the AsciiGrid fillNoDataValues() function for larger datasets.

In the meantime, bell_steep.tif converted to a new projection using the gdalwarp command line utility works fine when specifying a no data value of 32767 for the destination band.

I did attempt a fix, similar to

return std::fabs(a - b) < epsilonMultiplier*std::numeric_limits<double>::epsilon();
but not quite the same, with no luck. I used if( std::fabs(get_cellValue(i, j) - get_noDataValue()) <= tolerance ) where I just set tolerance to be a value of 0.000001. Printing the information, I found that the resulting comparison difference was 4.78556e+30, so it seems like some kind of overflow is potentially happening as well.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions