spectralpython / spectral

Python module for hyperspectral image processing
MIT License
571 stars 139 forks source link

Exception raised when band info is not passed to SpectralLibrary constructor #102

Closed tboggs closed 4 years ago

tboggs commented 4 years ago

If wavelength info is not passed in the SpectralLibrary constructor header argument, the following exception is raised:

----> 1 s.save('mylib.json')

~/src/spectral/spectral/io/envi.py in save(self, fileBaseName, description)
    980             meta['samples'] = len(self.bands.centers)
    981         else:
--> 982             meta['samples'] = len(self.spectra.shape[0])
    983         meta['lines'] = self.spectra.shape[0]
    984         meta['bands'] = 1

TypeError: object of type 'int' has no len()

Line 982 should actually be

meta['samples'] = self.spectra.shape[1]