1

I can open and read a hyperspectral image using GDAL according to the instructions brought by Max König here:

So after reading the data like this :

data = gdal.Open( filename )

then I can see the x, y, dim information of the dataset :

x = data.RasterXSize
y = data.RasterYSize
dim = data.RasterCount

Now the question is that if there is any way to find out that each band is actually representing what electromagnetic spectrum?

After reading all bands as a list in python like this:

RasterBands =[]
for i in range(data.RasterCount):    
    RasterBands.append(data.GetRasterBand(i)) 

I can write:

RasterBands[1].ComputeBandStats()

This will give me two float values, but I am not sure if they are representing the wavelengths of band 1 or not.

Would be thankful if anyone can give me a clue!

Best Sina

  • 1
    They are the data values of the band, the bigger value the more radiation (of other measure) for that band. For GDAL they are just numbers. Numbers can express height or temperature or what ever but GDAL does not care. You must find the metadata about what each band means from other sources with one exception: sometimes image file itself contains Raster Attribute Tables which define the data but they are usually used for categorized data: value 1 means urban area, value 2 farmland etc. – user30184 Apr 14 '15 at 12:55
  • how to write hyper spectral file back to disk? – user55347 Jul 17 '15 at 11:54
  • This is not an answer. If you have a follow up question, please ask a new question and reference this one. If you are unsure about how to ask, look at the top of the page and click on the link, Ask Question. This is so other users can easily find your question for reference and others can answer it. – Branco Jul 17 '15 at 12:24
3

As @user30184 says, gdal is just reading the values of your raster band, but you should be able to know the wavenlenght of each band based on the metadata (information you should get about the data).

the two values returned by "ComputeBandStats()" will be the mean and standard deviation of the values in your bands. If the mean value is between zero and one, you can assume that your data stores the reflectance, otherwise the values are probably digit numbers.

Usually, hyperspectral data have a very large number of bands (several hundreds) with a constant sampling interval in the wavelengths (e.g. 6 nm), so if you know the value of the wavelength range (e.g. 400-900 nm), you can derive the central wavelength of each bands using a rule of 3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.