浏览代码

libpython: relax requirements for band names (#1081)

* 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>
Markus Metz 4 年之前
父节点
当前提交
5a3a6e497b
共有 1 个文件被更改,包括 13 次插入3 次删除
  1. 13 3
      lib/python/bandref/reader.py

+ 13 - 3
lib/python/bandref/reader.py

@@ -7,6 +7,14 @@ from collections import OrderedDict
 
 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
 
@@ -165,9 +173,11 @@ class BandReferenceReader:
         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():