Browse Source

Rename g.bads to i.band.library and i.band to r.semantic.label (#1983)

According to a proposal by PSC:
https://trac.osgeo.org/grass/wiki/PSC/Minutes/PSC_Meeting_20211112

Related to #1868 and #1928
Māris Nartišs 3 years ago
parent
commit
eb841925d9

+ 1 - 1
.flake8

@@ -196,7 +196,7 @@ per-file-ignores =
     scripts/r.in.wms/wms_cap_parsers.py: F841, E741, E501
     scripts/r.in.wms/wms_cap_parsers.py: F841, E741, E501
     scripts/r.in.wms/wms_drv.py: E402, E722, E501
     scripts/r.in.wms/wms_drv.py: E402, E722, E501
     scripts/r.in.wms/srs.py: E722, E501
     scripts/r.in.wms/srs.py: E722, E501
-    scripts/i.band/i.band.py: F841, E501
+    scripts/r.semantic.label/r.semantic.label.py: F841, E501
     scripts/v.report/v.report.py: F841, E501
     scripts/v.report/v.report.py: F841, E501
     scripts/db.out.ogr/db.out.ogr.py: F841
     scripts/db.out.ogr/db.out.ogr.py: F841
     scripts/g.extension/g.extension.py: F841, E722, E501
     scripts/g.extension/g.extension.py: F841, E722, E501

+ 1 - 1
python/grass/semantic_label/reader.py

@@ -23,7 +23,7 @@ class SemanticLabelReader:
 
 
     def __init__(self):
     def __init__(self):
         self._json_files = glob.glob(
         self._json_files = glob.glob(
-            os.path.join(os.environ["GISBASE"], "etc", "g.bands", "*.json")
+            os.path.join(os.environ["GISBASE"], "etc", "i.band.library", "*.json")
         )
         )
         if not self._json_files:
         if not self._json_files:
             raise SemanticLabelReaderError("No semantic label definitions found")
             raise SemanticLabelReaderError("No semantic label definitions found")

+ 2 - 2
scripts/Makefile

@@ -18,14 +18,13 @@ SUBDIRS = \
 	db.out.ogr \
 	db.out.ogr \
 	db.test \
 	db.test \
 	db.univar \
 	db.univar \
-	g.bands \
 	g.download.location \
 	g.download.location \
 	g.extension \
 	g.extension \
 	g.extension.all \
 	g.extension.all \
 	g.manual \
 	g.manual \
 	g.search.modules \
 	g.search.modules \
+	i.band.library \
 	i.colors.enhance \
 	i.colors.enhance \
-	i.band \
 	i.image.mosaic \
 	i.image.mosaic \
 	i.in.spotvgt \
 	i.in.spotvgt \
 	i.oif \
 	i.oif \
@@ -50,6 +49,7 @@ SUBDIRS = \
 	r.plane \
 	r.plane \
 	r.reclass.area \
 	r.reclass.area \
 	r.rgb \
 	r.rgb \
+	r.semantic.label \
 	r.shade \
 	r.shade \
 	r.tileset \
 	r.tileset \
 	r.unpack \
 	r.unpack \

+ 1 - 1
scripts/g.bands/Makefile

@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 MODULE_TOPDIR = ../..
 
 
-PGM = g.bands
+PGM = i.band.library
 
 
 # TODO: unfortunately Script.make assumes that ETCFILES are Python
 # TODO: unfortunately Script.make assumes that ETCFILES are Python
 # modules only, this should be improved (by introducing a new variable
 # modules only, this should be improved (by introducing a new variable

+ 23 - 15
scripts/g.bands/g.bands.html

@@ -1,6 +1,6 @@
 <h2>DESCRIPTION</h2>
 <h2>DESCRIPTION</h2>
 
 
-<em>g.bands</em> prints available band references information of multispectral data
+<em>i.band.library</em> prints available band information of multispectral data
 defined by GRASS GIS. The following multispectral sensors are supported
 defined by GRASS GIS. The following multispectral sensors are supported
 by default (other band reference registry files can be added, see below):
 by default (other band reference registry files can be added, see below):
 
 
@@ -75,19 +75,27 @@ fully defined band reference identifier) which can be specified
 by <b>pattern</b> option. For pattern syntax
 by <b>pattern</b> option. For pattern syntax
 see <a href="https://docs.python.org/3/library/re.html#regular-expression-syntax">Python
 see <a href="https://docs.python.org/3/library/re.html#regular-expression-syntax">Python
 regular expression operations</a> documentation. By
 regular expression operations</a> documentation. By
-default, <em>g.bands</em> prints all available band references.
+default, <em>i.band.library</em> prints all available band references.
 
 
 <p>
 <p>
 Extended metadata (central wavelength, spatial resolution, etc.) is printed
 Extended metadata (central wavelength, spatial resolution, etc.) is printed
 only when the <b>-e</b> flag is given.
 only when the <b>-e</b> flag is given.
 
 
-<h2>NOTES</h2>
+<h2>Band reference and semantic label relation</h2>
+
+<p>
+Band references are a special case (a subset) of semantic labels.
+Any string can be a semantic label but strings identifying specific
+remote sensing platform bands (=band references)
+can have additional metadata managed by <em>i.band.library</em>.
+Specific band reference can be assigned to a raster map as a semantic
+label by <em><a href="r.semantic.label.html">r.semantic.label</a></em>
+or <em><a href="r.support.html">r.support</a></em> modules.
 
 
-Specific band reference can be assigned to a raster map
-by <em><a href="i.band.html">i.band</a></em> module.
+<h2>NOTES</h2>
 
 
 <p>
 <p>
-Band reference concept is supported by temporal GRASS modules,
+Semantic label concept is supported by temporal GRASS modules,
 see <em><a href="t.register.html#support-for-band-references">t.register</a></em>,
 see <em><a href="t.register.html#support-for-band-references">t.register</a></em>,
 <em><a href="t.rast.list.html#filtering-the-result-by-band-references">t.rast.list</a></em>,
 <em><a href="t.rast.list.html#filtering-the-result-by-band-references">t.rast.list</a></em>,
 <em><a href="t.info.html#space-time-dataset-with-band-references-assigned">t.info</a></em>
 <em><a href="t.info.html#space-time-dataset-with-band-references-assigned">t.info</a></em>
@@ -102,7 +110,7 @@ multi band data. It is used in many frameworks
 Earth Engine API</a> for example) to address multi spectral satellite
 Earth Engine API</a> for example) to address multi spectral satellite
 images series. GRASS supports a multi-band raster layer approach
 images series. GRASS supports a multi-band raster layer approach
 basically with the imagery group concept
 basically with the imagery group concept
-(<em><a href="i.group.html">i.group</a></em>). A new band reference
+(<em><a href="i.group.html">i.group</a></em>). A new semantic label
 concept is designed in order to support image collections in GRASS
 concept is designed in order to support image collections in GRASS
 GIS.
 GIS.
 
 
@@ -169,8 +177,8 @@ identifier.
 
 
 <p>
 <p>
 System-defined registry files are located in GRASS GIS installation
 System-defined registry files are located in GRASS GIS installation
-directory (<tt>$GISBASE/etc/g.bands</tt>). Note that
-currently <i>g.bands</i> allows to manage only system-defined registry
+directory (<tt>$GISBASE/etc/i.band.library</tt>). Note that
+currently <i>i.band.library</i> allows to manage only system-defined registry
 files. Support for user-defined registry files is planned to be
 files. Support for user-defined registry files is planned to be
 implemented, see <a href="#known-issues">KNOWN ISSUES</a> section for
 implemented, see <a href="#known-issues">KNOWN ISSUES</a> section for
 details.
 details.
@@ -180,7 +188,7 @@ details.
 <h3>Print all available band references</h3>
 <h3>Print all available band references</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.bands
+i.band.library
 
 
 S2_1 Visible (Coastal/Aerosol)
 S2_1 Visible (Coastal/Aerosol)
 S2_2 Visible (Blue)
 S2_2 Visible (Blue)
@@ -201,7 +209,7 @@ Only band identifiers related to Sentinel-2 satellite will be
 printed.
 printed.
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.bands pattern=S2
+i.band.library pattern=S2
 
 
 S2_1 Visible (Coastal/Aerosol)
 S2_1 Visible (Coastal/Aerosol)
 ...
 ...
@@ -213,7 +221,7 @@ S2_12 SWIR 2
 Print all available 2nd bands:
 Print all available 2nd bands:
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.bands pattern=.*_2
+i.band.library pattern=.*_2
 
 
 S2_2 Visible (Blue)
 S2_2 Visible (Blue)
 L7_2 Visible (Green)
 L7_2 Visible (Green)
@@ -227,7 +235,7 @@ Extended metadata related to the first band of Sentinel-2 satellite
 will be printed.
 will be printed.
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-g.bands -e pattern=S2_1
+i.band.library -e pattern=S2_1
 
 
 description: The Sentinel-2 A/B bands
 description: The Sentinel-2 A/B bands
 shortcut: S2
 shortcut: S2
@@ -247,7 +255,7 @@ source: https://sentinel.esa.int/web/sentinel/missions/sentinel-2
 
 
 <h2>KNOWN ISSUES</h2>
 <h2>KNOWN ISSUES</h2>
 
 
-<em>g.bands</em> has currently <b>very limited functionality</b>. Only
+<em>i.band.library</em> has currently <b>very limited functionality</b>. Only
 system-defined band references are supported. The final implementation
 system-defined band references are supported. The final implementation
 will support managing (add, modify, delete) user-defined band
 will support managing (add, modify, delete) user-defined band
 references.
 references.
@@ -266,7 +274,7 @@ will be improved in the near future.
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 
 <em>
 <em>
-  <a href="i.band.html">i.band</a>,
+  <a href="r.semantic.label.html">r.semantic.label</a>,
   <a href="r.info.html">r.info</a>
   <a href="r.info.html">r.info</a>
 </em>
 </em>
 
 

+ 1 - 1
scripts/g.bands/g.bands.py

@@ -2,7 +2,7 @@
 
 
 ############################################################################
 ############################################################################
 #
 #
-# MODULE:       g.bands
+# MODULE:       i.band.library
 # AUTHOR(S):    Martin Landa <landa.martin gmail com>
 # AUTHOR(S):    Martin Landa <landa.martin gmail com>
 #
 #
 # PURPOSE:      Prints available semantic label information used for multispectral data.
 # PURPOSE:      Prints available semantic label information used for multispectral data.

scripts/g.bands/landsat.json → scripts/i.band.library/landsat.json


scripts/g.bands/sentinel.json → scripts/i.band.library/sentinel.json


+ 2 - 2
scripts/g.bands/testsuite/test_g_bands.py

@@ -8,12 +8,12 @@ from grass.gunittest.gmodules import call_module
 class TestBandsSystemDefined(TestCase):
 class TestBandsSystemDefined(TestCase):
     @staticmethod
     @staticmethod
     def _number_of_bands(**kwargs):
     def _number_of_bands(**kwargs):
-        gbands = call_module("g.bands", **kwargs)
+        gbands = call_module("i.band.library", **kwargs)
         return len(gbands.rstrip(os.linesep).split(os.linesep))
         return len(gbands.rstrip(os.linesep).split(os.linesep))
 
 
     def test_number_system_defined(self):
     def test_number_system_defined(self):
         """Test number of valid band identifiers"""
         """Test number of valid band identifiers"""
-        # get number of valid band identifiers by g.bands
+        # get number of valid band identifiers by i.band.library
         nbands = self._number_of_bands()
         nbands = self._number_of_bands()
 
 
         # get number of valid band identifiers by Bands lib
         # get number of valid band identifiers by Bands lib

+ 1 - 1
scripts/i.band/Makefile

@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 MODULE_TOPDIR = ../..
 
 
-PGM = i.band
+PGM = r.semantic.label
 
 
 include $(MODULE_TOPDIR)/include/Make/Script.make
 include $(MODULE_TOPDIR)/include/Make/Script.make
 
 

+ 10 - 10
scripts/i.band/i.band.html

@@ -1,6 +1,6 @@
 <h2>DESCRIPTION</h2>
 <h2>DESCRIPTION</h2>
 
 
-<em>i.band</em> allows assigning a semantic label information to a
+<em>r.semantic.label</em> allows assigning a semantic label information to a
 single raster map or to a list of specified raster maps. Semantic
 single raster map or to a list of specified raster maps. Semantic
 label can be defined by <b>semantic_label</b> option. Already assigned semantic
 label can be defined by <b>semantic_label</b> option. Already assigned semantic
 label can be removed from a specified raster map
 label can be removed from a specified raster map
@@ -19,7 +19,7 @@ Note that <i>only raster maps from the current mapsets</i> can be modified.
 <p>
 <p>
 For more information about semantic label concept and supported sensors
 For more information about semantic label concept and supported sensors
 (generic multispectral system, Landsat-5, Landsat-7, Landsat-8, Sentinel-2)
 (generic multispectral system, Landsat-5, Landsat-7, Landsat-8, Sentinel-2)
-see the <em><a href="g.bands.html">g.bands</a></em> module.
+see the <em><a href="i.band.library.html">i.band.library</a></em> module.
 
 
 <p>
 <p>
 Semantic labels are supported by temporal GRASS modules. Name of
 Semantic labels are supported by temporal GRASS modules. Name of
@@ -36,48 +36,48 @@ modules for examples.
 <h3>Assign semantic label to a single raster map</h3>
 <h3>Assign semantic label to a single raster map</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01 semantic_label=S2_1
+r.semantic.label map=T33UVR_20180506T100031_B01 semantic_label=S2_1
 </pre></div>
 </pre></div>
 
 
 <h3>Assign semantic label to a list of raster maps</h3>
 <h3>Assign semantic label to a list of raster maps</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01,T33UVR_20180521T100029_B01 semantic_label=S2_1,S2_1
+r.semantic.label map=T33UVR_20180506T100031_B01,T33UVR_20180521T100029_B01 semantic_label=S2_1,S2_1
 </pre></div>
 </pre></div>
 
 
 <h3>Assign different semantic labels to a list of raster maps</h3>
 <h3>Assign different semantic labels to a list of raster maps</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 semantic_label=S2_1,S2_2
+r.semantic.label map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 semantic_label=S2_1,S2_2
 </pre></div>
 </pre></div>
 
 
 <h3>Remove semantic label from a list of raster maps</h3>
 <h3>Remove semantic label from a list of raster maps</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 operation=remove
+r.semantic.label map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 operation=remove
 </pre></div>
 </pre></div>
 
 
 <h3>Print semantic label information about single raster map</h3>
 <h3>Print semantic label information about single raster map</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01 operation=print
+r.semantic.label map=T33UVR_20180506T100031_B01 operation=print
 </pre></div>
 </pre></div>
 
 
 <h3>Print extended semantic label information for a list of raster map</h3>
 <h3>Print extended semantic label information for a list of raster map</h3>
 
 
 <div class="code"><pre>
 <div class="code"><pre>
-i.band map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 operation=print
+r.semantic.label map=T33UVR_20180506T100031_B01,T33UVR_20180506T100031_B02 operation=print
 </pre></div>
 </pre></div>
 
 
 <h2>KNOWN ISSUES</h2>
 <h2>KNOWN ISSUES</h2>
 
 
-<em>i.band</em> allows managing semantic labels only related to 2D
+<em>r.semantic.label</em> allows managing semantic labels only related to 2D
 raster maps.
 raster maps.
 
 
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 
 <em>
 <em>
-  <a href="g.bands.html">g.bands</a>,
+  <a href="i.band.library.html">i.band.library</a>,
   <a href="r.info.html">r.info</a>,
   <a href="r.info.html">r.info</a>,
   <a href="r.support">r.support</a>
   <a href="r.support">r.support</a>
 </em>
 </em>

+ 1 - 1
scripts/i.band/i.band.py

@@ -2,7 +2,7 @@
 
 
 ############################################################################
 ############################################################################
 #
 #
-# MODULE:       i.band
+# MODULE:       r.semantic.label
 # AUTHOR(S):    Martin Landa <landa.martin gmail com>
 # AUTHOR(S):    Martin Landa <landa.martin gmail com>
 #
 #
 # PURPOSE:      Manages semantic label information assigned to a single
 # PURPOSE:      Manages semantic label information assigned to a single

+ 3 - 3
scripts/i.band/testsuite/test_i_band.py

@@ -33,13 +33,13 @@ class TestSemanticLabelsSystemDefined(TestCase):
             self.mapset.name = "PERMANENT"
             self.mapset.name = "PERMANENT"
             a_map = self.mapset.glist(type="raster")[0]
             a_map = self.mapset.glist(type="raster")[0]
             module = SimpleModule(
             module = SimpleModule(
-                "i.band", map=a_map, semantic_label=self.semantic_label
+                "r.semantic.label", map=a_map, semantic_label=self.semantic_label
             )
             )
             self.assertModuleFail(module)
             self.assertModuleFail(module)
 
 
     def test_semantic_label_assign(self):
     def test_semantic_label_assign(self):
         module = SimpleModule(
         module = SimpleModule(
-            "i.band", map=self.map, semantic_label=self.semantic_label
+            "r.semantic.label", map=self.map, semantic_label=self.semantic_label
         )
         )
         self.assertModule(module)
         self.assertModule(module)
 
 
@@ -47,7 +47,7 @@ class TestSemanticLabelsSystemDefined(TestCase):
         self.assertEqual(self.read_semantic_label(), self.semantic_label)
         self.assertEqual(self.read_semantic_label(), self.semantic_label)
 
 
     def test_semantic_label_dissociate(self):
     def test_semantic_label_dissociate(self):
-        module = SimpleModule("i.band", operation="remove", map=self.map)
+        module = SimpleModule("r.semantic.label", operation="remove", map=self.map)
         self.assertModule(module)
         self.assertModule(module)
 
 
         # check also using pygrass
         # check also using pygrass

+ 1 - 1
temporal/t.info/t.info.html

@@ -140,7 +140,7 @@ t.info input=2009_01_tempmean type=raster
 <h3>Space time dataset with semantic labels assigned</h3>
 <h3>Space time dataset with semantic labels assigned</h3>
 
 
 This information is printed only when semantic labels have been assigned
 This information is printed only when semantic labels have been assigned
-to registered raster maps by <em><a href="i.band.html">i.band</a></em>
+to registered raster maps by <em><a href="r.semantic.label.html">r.semantic.label</a></em>
 or <em><a href="t.register.html#support-for-semantic-labels">t.register</a></em> module.
 or <em><a href="t.register.html#support-for-semantic-labels">t.register</a></em> module.
 
 
 <div class="code"><pre>
 <div class="code"><pre>

+ 2 - 2
temporal/t.rast.list/t.rast.list.html

@@ -187,7 +187,7 @@ vector dataset <a href="t.vect.list.html#using-method-option">t.vect.list</a>
 <h3>Filtering the result by semantic label</h3>
 <h3>Filtering the result by semantic label</h3>
 
 
 Semantic label can be assigned to raster maps
 Semantic label can be assigned to raster maps
-by <em><a href="i.band.html">i.band</a></em> module or even when
+by <em><a href="r.semantic.label.html">r.semantic.label</a></em> module or even when
 registrating raster maps into STRDS
 registrating raster maps into STRDS
 by <em><a href="t.register.html#support-for-semantic-labels">t.register</a></em>.
 by <em><a href="t.register.html#support-for-semantic-labels">t.register</a></em>.
 
 
@@ -206,7 +206,7 @@ modules</i>.
 
 
 <p>
 <p>
 Also note that only STRDS can be filtered by semantic label,
 Also note that only STRDS can be filtered by semantic label,
-see <em><a href="i.band.html#known-issues">i.band</a></em> for
+see <em><a href="r.semantic.label.html#known-issues">r.semantic.label</a></em> for
 current limitations.
 current limitations.
 
 
 
 

+ 1 - 1
temporal/t.rast.mapcalc/t.rast.mapcalc.html

@@ -165,7 +165,7 @@ t.rast.mapcalc inputs=test.S2_8,test.S2_4 output=ndvi basename=ndvi \
 </pre></div>
 </pre></div>
 
 
 For more information about semantic label concept
 For more information about semantic label concept
-see <em><a href="g.bands.html">g.bands</a></em> module.
+see <em><a href="i.band.library.html">i.band.library</a></em> module.
 
 
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 

+ 2 - 2
temporal/t.register/t.register.html

@@ -116,7 +116,7 @@ prec_6|2002-04-01|2002-07-01
 <h3>Support for semantic labels</h3>
 <h3>Support for semantic labels</h3>
 
 
 For more information about semantic labels and image collections
 For more information about semantic labels and image collections
-see <em><a href="g.bands.html">g.bands</a></em> module.
+see <em><a href="i.band.library.html">i.band.library</a></em> module.
 
 
 <p>
 <p>
 Specification of map names and absolute start time (datetime) of the time
 Specification of map names and absolute start time (datetime) of the time
@@ -139,7 +139,7 @@ T33UYP_20190331T094039_B09|2019-03-31 09:40:39|S2_9
 
 
 In this case <em>t.register</em> assigns to given raster maps
 In this case <em>t.register</em> assigns to given raster maps
 a semantic label similarly as
 a semantic label similarly as
-<em><a href="i.band.html">i.band</a></em> does.
+<em><a href="r.semantic.label.html">r.semantic.label</a></em> does.
 
 
 Such registered raster maps is possible
 Such registered raster maps is possible
 to <a href="t.rast.list.html#filtering-the-result-by-semantic-label">filter
 to <a href="t.rast.list.html#filtering-the-result-by-semantic-label">filter

+ 1 - 1
temporal/t.upgrade/t.upgrade.html

@@ -3,7 +3,7 @@
 This module upgrades the temporal database in the current mapset
 This module upgrades the temporal database in the current mapset
 from version 2 (default in GRASS 7) to 3 (default in GRASS 8).
 from version 2 (default in GRASS 7) to 3 (default in GRASS 8).
 The version 3 introduces a semantic label support, see
 The version 3 introduces a semantic label support, see
-<em><a href="g.bands.html">g.bands</a></em> for details.
+<em><a href="i.band.library.html">i.band.library</a></em> for details.
 
 
 <h2>EXAMPLE</h2>
 <h2>EXAMPLE</h2>