[gdal-dev] gdal_translate truncates nodata_value < -4.21358e-09

Even Rouault even.rouault at spatialys.com
Fri Apr 10 09:28:04 PDT 2015


Le vendredi 10 avril 2015 17:18:04, Siebe Bosch a écrit :
> Dear list,
> 
> I am trying to convert one band from a GRIB2-file into an ASCII raster,
> using gdal_translate.
> Upon inspection (opening the original raster using the MapWinGis
> ActiveX-component) and requesting the nodata_value, I get this:
> 
> ? mygrid.Header.NodataValue
> -3.40282346638529E+38 {Double}
>      Double: -3.40282346638529E+38 {Double}
> 
> So far, so good. Now l tried to convert to ASCII using gdal_translate,
> with the arguments "-of AAIGrid -b 13" (to ASC, band #13)
> Much to my surprise the nodata-value (inside the grid) has changed in
> -4.2135788191899337e-009. A NODATA_value in the header has not been set
> at all!

Are you using GDAL 1.11 or above ? It should output values with "%.20g" 
formatting by default. See end of http://trac.osgeo.org/gdal/ticket/3732

> 
> So I tried converting to an ERDAS IMG file. Arguments: "-of HFA -b 13"
> Inspecting the results in QGIS I see in the metadata that the
> "nodata-value has not been set". The grid itself however contains data
> of the Float type, and the cells that should have nodata-values have now
> values of -4.21358e-09
> 
> My conclusion:
> 
> GDAL_Translate does not support numbers smaller than -4.21358e-09. Am I
> right?
> 
> The problem however is that I do need the nodata-cells to be recognized
> correctly. Is there any tool that can help me to correct this? E.g. can
> I change the nodata-value of the original (multi-band) grid on forehand?
> Or are there additional arguments for gdal_translate that allow values
> up to the original nodata_value?
> 
> Many thanks,
> Siebe

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list