Skip to content

Commit

Permalink
Handle DEM "band" in new lpgs version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed Mar 10, 2017
1 parent a9e34a0 commit 772d8e7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions eodatasets/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,19 @@ def to_band(self, dataset, path):
>>> # No bands for non-tiff files.
>>> OrthoDriver().to_band(None, Path('/tmp/out/LC81090852015088LGN00_MTL.txt'))
>>> OrthoDriver().to_band(None, Path('/tmp/out/passinfo'))
>>> # A DEM image -- not included as a band.
>>> OrthoDriver().to_band(None, Path('LT05_L1TP_108078_20060703_20170309_01_T1_DEM.TIF'))
"""
if path.suffix.lower() != '.tif':
return None

name = path.stem.lower()

# A DEM image -- the only tif without a 'B' prefix.
# We don't include it in the list of bands according to Lan-Wei, as it's not part of a typical USGS package.
if name.endswith('_dem'):
return None

# Images end in a band number (eg '_B12.tif'). Extract it.
position = name.rfind('_b')
if position == -1:
Expand Down

0 comments on commit 772d8e7

Please sign in to comment.