Skip to content

Commit df4082d

Browse files
authored
Update image.py (#140)
This commit solves the following issues: - The second argument of method read_band() of ImageArray is now consistent with that of SpyFile classes, which otherwise was producing warnings or errors. - read_datum() method of ImageArray class used a deprecated call (np.asscalar), which was giving errors. It is now replaced by the "self" call itself which returns what is supposed to be returned by the method.
1 parent 2606503 commit df4082d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spectral/image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ def __getitem__(self, args):
118118
def _parent_getitem(self, args):
119119
return np.ndarray.__getitem__(self, args)
120120

121-
def read_band(self, i):
121+
def read_band(self, band):
122122
'''
123123
For compatibility with SpyFile objects. Returns arr[:,:,i].squeeze()
124124
'''
125-
return np.asarray(self[:, :, i].squeeze())
125+
return np.asarray(self[:, :, band].squeeze())
126126

127127
def read_bands(self, bands):
128128
'''For SpyFile compatibility. Equivlalent to arr.take(bands, 2)'''
@@ -161,7 +161,7 @@ def read_subimage(self, rows, cols, bands=None):
161161

162162
def read_datum(self, i, j, k):
163163
'''For SpyFile compatibility. Equivlalent to arr[i, j, k]'''
164-
return np.asscalar(self[i, j, k])
164+
return self[i, j, k]
165165

166166
def load(self):
167167
'''For compatibility with SpyFile objects. Returns self'''

0 commit comments

Comments
 (0)