-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using 'envi.open' on ENVI .sli file alters endmember spectra values (repost) #97
Comments
The issue you are encountering is due to the fact that the bands in the spectral library are not monotonically increasing in wavelength. The common reason for this is that many hyperspectral imagers use multiple detectors with slightly overlapping spectral ranges. In the For example, in the original file (cuprite-endmembers.hdr), there is the following sequence of wavelengths (note that they do not increase monotonically):
whereas in the library saved from ENVI (envi-out-EM24.hdr), the same set of bands are in increasing order, as follows:
If I plot the bands from both header files in the order they appear in the header file, I get the following, which is consistent with your plot (I'm highlighting the region around the first discrepancy you circled in your figure):
Here is the same plot after sorting the bands from cuprite-endmembers.hdr (note that the two spectra are identical):
Finally, to really see what is going on in the unsorted file, it is instructive to reproduce the first figure, plotting each spectrum as a line series with wavelength as the x coordinate:
Just to clarify with respect to the title of this issue, NOTE: Since sorting and filtering bands in spectral libraries is a fairly common task, I've opened issue #98 to add a |
Hi Thomas, Amazing catch. I definitely did not notice, nor even consider the bands were not sorted! Its also good to know that envi actually does some sorting of the wavelengths. |
Hi Thomas,
For those who don't know, this issue has been re-posted here, since I mistakenly put this issue up on the wrong repo!
I am experiencing an issue of which I cannot conclude is an issue with a particular envi .sli file (and associated header) itself, or with something in your code using 'envi.open'.
I have provided the following files in the attached zip folder:
The issue:
When using 'envi.open' on 'cuprite-endmembers.sli', endmember spectral values are altered or sorted at different positions at particular spectral regions. These values are not altered or sorted however, when comparing the same endmembers opened inside of ENVI (envi reads the endmember DN values correctly and differently than envi.open in spectral python).
An example here is 'EM24' (at row index position 12 of the cuprite-endmembers.sli endmember array). If I save that same endmember out from ENVI (which I have done for you and put in the zip file 'envi-out-EM24.sli') envi.open does not do anything to the spectral values. This can be verified by plotting:
In the above plot, EM24 in row 12 of 'cuprite-endmembers.sli' shows variations at 0.6554-0.6749 micrometers (or index 30-34. sli_file.spectra[12][30:35])
In summary, ENVI is able to open 'cuprite-endmembers.sli' properly without any alteration to the spectral values. But with this particular sli file, envi.open does something to the spectra, and I cannot seem to figure out the source of the issue. The only workaround is to open cuprite-endmembers.sli in envi and save the endmembers back out. Then envi.open works. But I would like to know the cause of this issue if possible.
Much thanks and sorry if the description is confusing. I found this issue hard to explain.
cuprite-endmembers.zip
The text was updated successfully, but these errors were encountered: