Skip to content

Commit

Permalink
[Raster.__init__] create auto names if band names not in HDR file
Browse files Browse the repository at this point in the history
  • Loading branch information
johntruckenbrodt committed Jan 25, 2019
1 parent b2f94cc commit b981d76
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion spatialist/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def __init__(self, filename):
self.__data = [None] * self.bands

if self.format == 'ENVI':
self.bandnames = HDRobject(self.filename + '.hdr').band_names
with HDRobject(self.filename + '.hdr') as hdr:
if hasattr(hdr, 'band_names'):
self.bandnames = hdr.band_names
else:
self.bandnames = ['band{}'.format(x) for x in range(1, self.bands + 1)]
else:
self.bandnames = ['band{}'.format(x) for x in range(1, self.bands + 1)]

Expand Down

0 comments on commit b981d76

Please sign in to comment.