Skip to content
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

wrong assignment of bands.band_quantity in envi.open #46

Closed
kidpixo opened this issue Apr 26, 2016 · 2 comments
Closed

wrong assignment of bands.band_quantity in envi.open #46

kidpixo opened this issue Apr 26, 2016 · 2 comments
Labels
Milestone

Comments

@kidpixo
Copy link
Contributor

kidpixo commented Apr 26, 2016

The function /io/envi.open assigns :

img.bands.band_quantity = "Wavelength"

but this is not always the case.

I'm working with some envi cube only providing geometrical information to other data cubes, thus not having band_quantity in the header. I get all the img.bands. empty , but img.bands.band_quantity is Wavelength even if isn't defined.

I suggest to add this metadata1 to the output spectral.SpyFile olny if they are effectively present in the header, or it is bad when we are going to write a new file?

Any way, the assumption for img.bands.band_quantity is in general wrong, in my opinion.


1. Metadata list I found:

img.bands.band_quantity
img.bands.bandwidth_stdevs
img.bands.centers
img.bands.band_unit       
img.bands.bandwidths      
img.bands.centers_stdevs 

@tboggs
Copy link
Member

tboggs commented Apr 26, 2016

I agree, the band_quantity attribute shouldn't be defaulted. This appears to be happening on this line:
https://github.com/spectralpython/spectral/blob/master/spectral/io/envi.py#L355.

None of the other members of the bands object are being defaulted. It's probably just as simple as removing that line but we need to make sure that none of the plotting functions fail when that attribute is not set. It's probably also worth considering whether band_quantity and band_unit should be defaulted to None or an empty string (currently the case for band_unit).

@tboggs tboggs added the bug label Apr 26, 2016
@tboggs tboggs added this to the v0.18.0 milestone Apr 26, 2016
@kidpixo
Copy link
Contributor Author

kidpixo commented Apr 26, 2016

None seems a pretty good solution to me, easy to check.

@tboggs tboggs closed this as completed in d7a17f2 Apr 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants