Skip to content

Commit

Permalink
Rename g.bads to i.band.library and i.band to r.semantic.label (OSGeo…
Browse files Browse the repository at this point in the history
  • Loading branch information
marisn authored and ninsbl committed Feb 17, 2023
1 parent 99aa16a commit c415b29
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ per-file-ignores =
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/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/db.out.ogr/db.out.ogr.py: F841
scripts/g.extension/g.extension.py: F841, E722, E501
Expand Down
2 changes: 1 addition & 1 deletion python/grass/semantic_label/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SemanticLabelReader:

def __init__(self):
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:
raise SemanticLabelReaderError("No semantic label definitions found")
Expand Down
4 changes: 2 additions & 2 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ SUBDIRS = \
db.out.ogr \
db.test \
db.univar \
g.bands \
g.download.location \
g.extension \
g.extension.all \
g.manual \
g.search.modules \
i.band.library \
i.colors.enhance \
i.band \
i.image.mosaic \
i.in.spotvgt \
i.oif \
Expand All @@ -50,6 +49,7 @@ SUBDIRS = \
r.plane \
r.reclass.area \
r.rgb \
r.semantic.label \
r.shade \
r.tileset \
r.unpack \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..

PGM = g.bands
PGM = i.band.library

# TODO: unfortunately Script.make assumes that ETCFILES are Python
# modules only, this should be improved (by introducing a new variable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<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
by default (other band reference registry files can be added, see below):

Expand Down Expand Up @@ -75,19 +75,27 @@ <h2>DESCRIPTION</h2>
by <b>pattern</b> option. For pattern syntax
see <a href="https://docs.python.org/3/library/re.html#regular-expression-syntax">Python
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>
Extended metadata (central wavelength, spatial resolution, etc.) is printed
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>
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>,
<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>
Expand All @@ -102,7 +110,7 @@ <h3>Image collections</h3>
Earth Engine API</a> for example) to address multi spectral satellite
images series. GRASS supports a multi-band raster layer approach
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
GIS.

Expand Down Expand Up @@ -169,8 +177,8 @@ <h3>Band reference registry files</h3>

<p>
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
implemented, see <a href="#known-issues">KNOWN ISSUES</a> section for
details.
Expand All @@ -180,7 +188,7 @@ <h2>EXAMPLES</h2>
<h3>Print all available band references</h3>

<div class="code"><pre>
g.bands
i.band.library

S2_1 Visible (Coastal/Aerosol)
S2_2 Visible (Blue)
Expand All @@ -201,7 +209,7 @@ <h3>Filter band references by a shortcut</h3>
printed.

<div class="code"><pre>
g.bands pattern=S2
i.band.library pattern=S2

S2_1 Visible (Coastal/Aerosol)
...
Expand All @@ -213,7 +221,7 @@ <h3>Filter band references by a regular expression</h3>
Print all available 2nd bands:

<div class="code"><pre>
g.bands pattern=.*_2
i.band.library pattern=.*_2

S2_2 Visible (Blue)
L7_2 Visible (Green)
Expand All @@ -227,7 +235,7 @@ <h3>Print extended metadata for specified band identifier</h3>
will be printed.

<div class="code"><pre>
g.bands -e pattern=S2_1
i.band.library -e pattern=S2_1

description: The Sentinel-2 A/B bands
shortcut: S2
Expand All @@ -247,7 +255,7 @@ <h3>Print extended metadata for specified band identifier</h3>

<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
will support managing (add, modify, delete) user-defined band
references.
Expand All @@ -266,7 +274,7 @@ <h2>REFERENCES</h2>
<h2>SEE ALSO</h2>

<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>
</em>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

############################################################################
#
# MODULE: g.bands
# MODULE: i.band.library
# AUTHOR(S): Martin Landa <landa.martin gmail com>
#
# PURPOSE: Prints available semantic label information used for multispectral data.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
class TestBandsSystemDefined(TestCase):
@staticmethod
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))

def test_number_system_defined(self):
"""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()

# get number of valid band identifiers by Bands lib
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..

PGM = i.band
PGM = r.semantic.label

include $(MODULE_TOPDIR)/include/Make/Script.make

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<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
label can be defined by <b>semantic_label</b> option. Already assigned semantic
label can be removed from a specified raster map
Expand All @@ -19,7 +19,7 @@ <h2>NOTES</h2>
<p>
For more information about semantic label concept and supported sensors
(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>
Semantic labels are supported by temporal GRASS modules. Name of
Expand All @@ -36,48 +36,48 @@ <h2>EXAMPLES</h2>
<h3>Assign semantic label to a single raster map</h3>

<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>

<h3>Assign semantic label to a list of raster maps</h3>

<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>

<h3>Assign different semantic labels to a list of raster maps</h3>

<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>

<h3>Remove semantic label from a list of raster maps</h3>

<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>

<h3>Print semantic label information about single raster map</h3>

<div class="code"><pre>
i.band map=T33UVR_20180506T100031_B01 operation=print
r.semantic.label map=T33UVR_20180506T100031_B01 operation=print
</pre></div>

<h3>Print extended semantic label information for a list of raster map</h3>

<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>

<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.

<h2>SEE ALSO</h2>

<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.support">r.support</a>
</em>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

############################################################################
#
# MODULE: i.band
# MODULE: r.semantic.label
# AUTHOR(S): Martin Landa <landa.martin gmail com>
#
# PURPOSE: Manages semantic label information assigned to a single
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ def test_semantic_label_assign_not_current_mapset(self):
self.mapset.name = "PERMANENT"
a_map = self.mapset.glist(type="raster")[0]
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)

def test_semantic_label_assign(self):
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)

# check also using pygrass
self.assertEqual(self.read_semantic_label(), self.semantic_label)

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)

# check also using pygrass
Expand Down
2 changes: 1 addition & 1 deletion temporal/t.info/t.info.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ <h3>Temporal maps information</h3>
<h3>Space time dataset with semantic labels assigned</h3>

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.

<div class="code"><pre>
Expand Down
4 changes: 2 additions & 2 deletions temporal/t.rast.list/t.rast.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ <h3>Using method option</h3>
<h3>Filtering the result by semantic label</h3>

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
by <em><a href="t.register.html#support-for-semantic-labels">t.register</a></em>.

Expand All @@ -206,7 +206,7 @@ <h3>Filtering the result by semantic label</h3>

<p>
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.


Expand Down
2 changes: 1 addition & 1 deletion temporal/t.rast.mapcalc/t.rast.mapcalc.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h3>Semantic label filtering</h3>
</pre></div>

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>

Expand Down
4 changes: 2 additions & 2 deletions temporal/t.register/t.register.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h2>INPUT FILE FORMAT</h2>
<h3>Support for semantic labels</h3>

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>
Specification of map names and absolute start time (datetime) of the time
Expand All @@ -139,7 +139,7 @@ <h3>Support for semantic labels</h3>

In this case <em>t.register</em> assigns to given raster maps
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
to <a href="t.rast.list.html#filtering-the-result-by-semantic-label">filter
Expand Down
2 changes: 1 addition & 1 deletion temporal/t.upgrade/t.upgrade.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h2>DESCRIPTION</h2>
This module upgrades the temporal database in the current mapset
from version 2 (default in GRASS 7) to 3 (default in GRASS 8).
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>

Expand Down

0 comments on commit c415b29

Please sign in to comment.