[gdal-dev] working with AVIRIS data

Frank Warmerdam warmerdam at pobox.com
Mon Jul 6 14:17:36 EDT 2009


Dylan Beaudette wrote:
> Hi,
> 
> 
> Does anyone on the list know how to either convert or extract data as
> delivered in the "free data" section [1] of the AVIRIS home page? I
> have tried working with the "radiance" data, which when uncompressed
> comes with several ".img" files-- however my copy of GDAL (1.7) does not know
> what to make of it.

Dylan,

I downloaded  the cuprite radiance data and the readme says:


*.img      CALIBRATED AVIRIS RADIANCE (IMAGE) DATA

Contents:   AVIRIS calibrated radiance multipled by the gain and stored as
             16-bit integers.
File type:  BINARY 16-bit signed integer IEEE.
Units:      gain times (microwatts per centimeter_squared per nanometer per
             steradian).
Format:     Band interleaved by pixel (channel, sample, line) with dimensions
             (224, 614, 512).  The last scene may be less than 512.  To
             calculate the number of lines divide the file size by 275,072
              bytes per line.

So it is a normal bigendian signed 16bit integer pixel interleaved dataset
with a width of 614, a length of 512 and 224 bands.

Based on the VRT tutorial at http://www.gdal.org/gdal_vrttut.html I wrote
a .vrt file that allows access to the first band.

<VRTDataset rasterXSize="614" rasterYSize="512">
   <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
     <SourceFilename 
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>0</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

gdalinfo -mm sc01.vrt
Driver: VRT/Virtual Raster
Files: sc01.vrt
Size is 614, 512
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  614.0,    0.0)
Lower Right (  614.0,  512.0)
Center      (  307.0,  256.0)
Band 1 Block=614x1 Type=Int16, ColorInterp=Undefined
     Computed Min/Max=686.000,1381.000

To support more bands just add additional copies of the VRTRasterBand
section changing the band#, and adding two to the ImageOffset each time.
eg.

<VRTDataset rasterXSize="614" rasterYSize="512">
   <VRTRasterBand dataType="Int16" band="1" subClass="VRTRawRasterBand">
     <SourceFilename 
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>0</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
   <VRTRasterBand dataType="Int16" band="2" subClass="VRTRawRasterBand">
     <SourceFilename 
relativetoVRT="1">f970619t01p02_r02_sc01.c.img</SourceFilename>
     <ImageOffset>2</ImageOffset>
     <PixelOffset>448</PixelOffset>
     <LineOffset>275072</LineOffset>
     <ByteOrder>MSB</ByteOrder>
   </VRTRasterBand>
</VRTDataset>

You might want to write a small script to create this for 224 bands.
Note the SourceFilename element - update this for other cubes.

The same approach should work for the reflectance cubes (.rfl) if you
are interested in them.

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