[Gdal-dev] no data column after gdal_translate

Frank Warmerdam warmerdam at pobox.com
Sat Apr 24 12:05:34 EDT 2004


Shoaib Burq (VPAC) wrote:
> Thanks heaps Frank,
> 
> I'm greatful for the offer to help. 
> 
> Since my last email I have been looking at the NODATA value for the files 
> more carefully. I think this may be the issue. I suspect the  NoData 
> Value=-3.40282e+038 is not being read correctly by ENVI. is 
> there a way to specify another value while converting or even 
> after?

Shoaib,

Indeed the issue is undoubtedly with no-data handling.  I see there is
a "nodata" column on the left side of the image.  While GDAL will write
this nodata to the TIFF file it is done in a way that only GDAL recognises.
There is no way that ENVI could recognise the nodata value.  This is because
there is no standard way in TIFF to mark nodata values.

So, everything seems to be working fine.

There is no convenient way of altering the NODATA value in gdal_translate,
but you could in theory write a little script to adjust the values in the
resulting TIFF file.  For instance, I used the following mini script to adjust
the output TIFF file I produced from your coverage.

import gdal
from Numeric import *

ds = gdal.Open( 'out.tiff', gdal.GA_Update )

rband = ds.GetRasterBand(1)

for y in range(rband.YSize):
     dataline = rband.ReadAsArray( 0, y, rband.XSize, 1)

     dataline = choose( less( dataline, -100000), (dataline,0.0) )
     rband.WriteArray( dataline, 0, y )

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list