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

Dominik Schneider Dominik.Schneider at Colorado.EDU
Fri Apr 10 08:55:22 PDT 2015


Hi Siebe,
gdal_translate has the argument -a_nodata but according to the help it
won't convert nodata values, only defines them in the new file.
http://www.gdal.org/gdal_translate.html
I think you can use gdalwarp to assign the nodata pixels a distinct value
(e.g. -99) in the new file though.
http://www.gdal.org/gdalwarp.html

Someone else might know otherwise though.
ds


On Fri, Apr 10, 2015 at 9:18 AM, Siebe Bosch <siebe at hydroconsult.nl> wrote:

>  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!
>
> 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
>
>
>
>
>
>
>
>
>
>
>
> --
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150410/ce979782/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature_60pct.gif
Type: image/gif
Size: 30165 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150410/ce979782/attachment-0001.gif>


More information about the gdal-dev mailing list