Przeglądaj źródła

TGIS: any number of "_" is allowed in semantic labels (#2238)

Markus Metz 3 lat temu
rodzic
commit
dbd51e0a5d

+ 10 - 6
python/grass/temporal/abstract_space_time_dataset.py

@@ -1571,12 +1571,16 @@ class AbstractSpaceTimeDataset(AbstractDataset):
             where += "semantic_label IN ('{}'".format(self.semantic_label)
 
             # be zero-padding less sensitive
-            shortcut, identifier = self.semantic_label.split("_", -1)
-            identifier_zp = leading_zero(identifier)
-            if identifier_zp:
-                where += ", '{fl}_{zp}'".format(
-                    fl=shortcut.upper(), zp=identifier_zp.upper()
-                )
+            try:
+                shortcut, identifier = self.semantic_label.split("_", -1)
+                identifier_zp = leading_zero(identifier)
+                if identifier_zp:
+                    where += ", '{fl}_{zp}'".format(
+                        fl=shortcut.upper(), zp=identifier_zp.upper()
+                    )
+            except ValueError:
+                # any number of "_" is allowed in semantic labels
+                pass
 
             # close WHERE statement
             where += ")"