| 2 | |
| 3 | == From ENVI header == |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | ENVI header files are plan text files and can be opened in any text editor such as [https://en.wikipedia.org/wiki/Microsoft_Notepad notepad]. |
| 8 | |
| 9 | NERC-ARF also make a selection of tools available for extracting data from header files through https://github.com/pmlrsg/arsf_tools |
| 10 | |
| 11 | To extract the wavelength of each band to a CSV file the following can be used: |
| 12 | |
| 13 | {{{ |
| 14 | get_info_from_header.py f166011b.bil.hdr -o f166011b_wavelengths.csv |
| 15 | }}} |
| 16 | |
| 17 | Within Python you can use: |
| 18 | |
| 19 | {{{#!python |
| 20 | # Import envi_header module |
| 21 | from arsf_envi_reader import envi_header |
| 22 | |
| 23 | # Read the header to a dictonary |
| 24 | header_dict = envi_header.read_hdr_file("f166011b.bil.hdr") |
| 25 | |
| 26 | # Extract wavelengths, splitting into a list |
| 27 | wavelengths = header_dict['wavelength'].split(',') |
| 28 | |
| 29 | # Convert from string to float (optional) |
| 30 | wavelengths = [float(l) for l in wavelengths] |
| 31 | }}} |
| 32 | |
| 33 | == Using azgcor (for older data only) == |
| 34 | |
| 35 | '''Note azgcor is no longer supplied or supported by NERC-ARF, please contact us if you wish to use folder data in HDF format.''' |