Search code examples
spectral-python

how do I see all the bands of an .hdr file generated by ENVI.


I am trying to list all the bands present in my .hdr file. I have more then 100 bands and it's a hyperspectral data.

img = envi.open('Dun_Hyperion_Atm_Corr.hdr','Dun_Hyperion_Atm_Corr')

view = imshow(img,(29,19,9))

It open the image but I want to open the image after selecting one of the band present in my .hdr file. I am using spectral library for it.


Solution

  • You can read the header into a Dictionary and then access the bands:

    import spectral.io.envi as envi
    h = envi.read_envi_header('Dun_Hyperion_Atm_Corr.hdr')
    print(h)
    print(h['bands'])