Sensor band information

From ENVI header

The centre wavelength and bandwith for hyperspectral data such as Eagle, Hawk, Fenix and Owl are stored within the ENVI header (.hdr) file associated with each binary (.bil) file. ENVI header files are plan text files and can be opened in any text editor such as notepad.

NERC-ARF also make a selection of tools available for extracting data from header files through https://github.com/pmlrsg/arsf_tools

To extract the wavelength of each band to a CSV file the following can be used:

get_info_from_header.py f166011b.bil.hdr -o f166011b_wavelengths.csv

Within Python you can use:

# Import envi_header module
from arsf_envi_reader import envi_header

# Read the header to a dictonary
header_dict = envi_header.read_hdr_file("f166011b.bil.hdr")

# Extract wavelengths, splitting into a list
wavelengths = header_dict['wavelength'].split(',')

# Convert from string to float (optional)    
wavelengths = [float(l) for l in wavelengths]                               

Using azgcor (for older data only)

Note azgcor is no longer supplied or supported by NERC-ARF, please contact us if you wish to use folder data in HDF format.

You can get the bandwidth information from an HDF files by running azexhdf on it. The information is stored in several vectors in the HDF.

For CCD sensors, the key vectors are:

  • CAwavc: wavelength central frequencies for CCD sensors (CASI, Eagle, Hawk), in nm
  • CAwavh: wavelength half bandwidth for CCD sensors (CASI, Eagle, Hawk), in nm

The number of entries in the vectors will vary for CCD sensors depending on the band configuration.

For ATM,

  • ATwavu & ATwavl: upper and lower wavelength limits for ATM, in nm

The ATM vectors will never vary. You can use the CSV file at the bottom of this page for ATM.

Example commands

General form:

  • azexhdf -vf OUTPUT_FILE.txt -vn VECTOR_NAME -h LEV1_HDF_FILENAME

Example

  • azexhdf -vf casi192_wave_centre.txt -vn CAwavc -h lev1/c192a011b.hdf
    • this prints lots of information and also outputs the vector as space-separated numbers to the file, e.g.
       408.94 440.93 488.94 508.72 528.52 559.66 570.06 588.97 620.21 648.68 670.55 679.11 684.83 704.86 754.62 779.60 871.54
      
    • The output is in order of band number.

A unix command to transpose this output into a column is cat OUTPUT_FILE.txt | tr ' ' \\n > OUTPUT_FILE-transposed.txt


A Linux script that will produce a CSV file of a CASI, Eagle or Hawk HDF is attached to the bottom of this page.

  • Save the script somewhere on a Linux system
  • Make the script executable (chmod +x /path/to/create_band_info_csv.sh)
  • Run the script: /path/to/create_band_info_csv.sh /another/path/to/level1_HDF_file.hdf /yet/another/path/to/output.csv
    • Note you must have the azexhdf command installed somewhere in the path (ie. such that typing "azexhdf" works).
  • If it all runs ok, you should be able to load the csv file into Excel or other spreadsheet packages
Last modified 3 months ago Last modified on Aug 24, 2017 3:36:18 PM

Attachments (2)

Download all attachments as: .zip