[Gdal-dev] HDF EOS: cannot retrieve band scale and offset

Jan Cermak jcermak at atmos.washington.edu
Thu Oct 11 12:34:45 EDT 2007


Hi,

 From a MODIS MYD021km file I am trying to read band data including 
offset and scaling factors. Band data works just fine, but I can't get 
offset and scale. Without offset and scale the data is completely 
useless, so this seems to be a major issue to me.

Here is some sample code:

dsobj = 
gdal.Open('HDF4_EOS:EOS_SWATH:"myfile.hdf":MODIS_SWATH_Type_L1B:EV_1KM_RefSB')
bandobj = dsobj.GetRasterBand(1)
scale = bandobj.GetScale()
offset = bandobj.GetOffset()

scale and offset variables are empty.

I am using yesterday's stable branch nightly.
A sample file is at
ftp://ladsweb.nascom.nasa.gov/allData/5/MYD021KM/2006/220/MYD021KM.A2006220.1330.005.2007140045620.hdf

For this file and data set, HDFView yields:
radiance_scales = 
0.0072957743,0.0051752976,0.0037723905,0.0029522364,0.0023176796,0.001162374,5.6182046E-4,0.0011558639,4.1845915E-4,9.5770456E-4,6.215421E-4,0.006355153,0.009465027,0.0069601014,0.0027906199
radiance_offsets = 
316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722,316.9722

Any suggestions appreciated.

All the best,
Jan



More information about the Gdal-dev mailing list