Skip to content

Commit

Permalink
libpython: relax requirements for band names (#1081)
Browse files Browse the repository at this point in the history
* relax requirements for band names
* added STAC URL
* add another reference for STAC Band Objects
* fix trailing white space

Co-authored-by: Markus Neteler <neteler@gmail.com>
  • Loading branch information
metzm and neteler committed Nov 12, 2020
1 parent 6165efe commit 5a3a6e4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/python/bandref/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

import grass.script as gs

# band reference should be required to have the format
# <shortcut>_<band>
# instead, the sensor name should be stored somewhere else,
# and band names should be STAC common names, see
# https://stacspec.org/
# https://github.com/radiantearth/stac-spec/blob/master/extensions/eo/README.md#band-object
# custom names must be possible

class BandReferenceReaderError(Exception):
pass

Expand Down Expand Up @@ -165,9 +173,11 @@ def find_file(self, band_reference):
try:
shortcut, band = band_reference.split('_')
except ValueError:
raise BandReferenceReaderError("Invalid band identifier <{}>".format(
band_reference
))
# raise BandReferenceReaderError("Invalid band identifier <{}>".format(
# band_reference
# ))
shortcut = "unknown"
band = band_reference

for filename, config in self.config.items():
for root in config.keys():
Expand Down

0 comments on commit 5a3a6e4

Please sign in to comment.