[GRASS-dev] [GRASS GIS] #3077: r.colors: flag to output color table type and value range

#3077: r.colors: flag to output color table type and value range
--------------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Keywords: r.colors, gsoc2016 | CPU: All
Platform: All |
--------------------------------+-------------------------
r.colors would benefit from more detailed output

  * flag to output of type of a color table (relative, absolute, ...)
  * flag to output the ranges of all color tables (min, max in case of
absolute tables)

At time, the user does not know if a predefined color table covers the
range of the input map. Explanations on this would quite help but they
should be generated automatically:

Examples:

  * aspect
    * based on degree? (it is in percent)
  * haxby: relative colors for bathymetry or topography
    * "relative" is given, fine
  * ndvi: Normalized Difference Vegetation Index colors
    * ... (-1.0 .. +1.0)
  * ndwi: Normalized Difference Water Index colors
    * ... (-200 .. +200)
  * precipitation
    * starts at 0, ends at 7000
    * suggestion: instead of "precipitation: precipitation color table
(0..2000mm)" which is incorrect anyway, print e.g. "precipitation:
precipitation color table [%s..%smm),min, max)"

etc.

In essence: relative color tables will cover "any" range while absolute
color tables do not. This should become clear from the description without
reverse engineering the color files.

Effectively, more values should be added to lib/gis/colors.desc in an
automated way.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.2.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, gsoc2016, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------
Changes (by wenzeslaus):

* keywords: r.colors, gsoc2016 => r.colors, gsoc2016, cartography

Comment:

[source:grass/trunk/lib/gis/colors.desc lib/gis/colors.desc] could be
somehow improved during compilation or we can do some updates in the C
code and just do it on the fly (creating some overhead). The string in the
manual is now created in [source:grass/trunk/lib/gis/parser_html.c
lib/gis/parser_html.c] from name and description which are prepared by
`G_color_rules_descriptions()` in
[source:grass/trunk/lib/gis/color_rules.c lib/gis/color_rules.c]. This
function could read the actual file and put the info to the string. Min
and max could be done by string replacement in the text to provide way to
include those into the text and ''relative''/''absolute'' (and perhaps
''combined'') can be at the end of the description ("out of the
sentence"). For example, the `colors.desc` file would have this:

{{{
precipitation: precipitation color table ({min}..{max}mm)
}}}

Then the `G_color_rules_descriptions()` function would read the
[source:grass/trunk/lib/gis/colors/precipitation precipitation] file and
get 0 as min and 7000 as max and because there is no percent sign in the
whole file, the color table type would be set to `absolute`. The resulting
string for the color table `precipitation` would be:

{{{
precipitation;precipitation color table (0..7000mm) [absolute];
}}}

Related to that (but outside of scope), this does not solve the issue with
translations of these descriptions (they are not translated). Also, the
GUI currently doesn't show the descriptions well enough.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.2.1
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------
Changes (by neteler):

* keywords: r.colors, gsoc2016, cartography => r.colors, v.colors,
     cartography
* milestone: 7.2.0 => 7.2.1

Comment:

I like you proposal, how hard would it be to be implemented?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.4.2
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------

Comment (by mmetz):

There is a new -d flag in trunk r72895 for r.colors to list color rules as
name: description (type), e.g.
{{{
aspect: aspect oriented grey colors (relative, percent of map range)
aspectcolr: aspect oriented rainbow colors (absolute, 0 to 360)
}}}

If a color rule is specified with the color option, only this color rule
is listed, otherwise all are listed. The description and type are
determined on the fly by parsing colors.desc and the color rule files.
Suggestions on the wording are welcome.

Should the descriptions of the color option also be updated? That would
require modification of `G_color_rules_descriptions()`.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------
Changes (by martinl):

* milestone: 7.4.2 => 7.6.0

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------

Comment (by mmetz):

Replying to [comment:7 mmetz]:
> There is a new -d flag in trunk r72895 for r.colors to list color rules
as name: description (type), e.g.
> {{{
> aspect: aspect oriented grey colors (relative, percent of map range)
> aspectcolr: aspect oriented rainbow colors (absolute, 0 to 360)
> }}}
>
> If a color rule is specified with the color option, only this color rule
is listed, otherwise all are listed. The description and type are
determined on the fly by parsing colors.desc and the color rule files.
Suggestions on the wording are welcome.

New suggestion:

{{{
aspect: aspect oriented grey colors [range: map values]
aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
}}}
It's shorter, and I think "percent of map range" is not very clear.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:9&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------

Comment (by neteler):

Replying to [comment:9 mmetz]:
> New suggestion:
>
> {{{
> aspect: aspect oriented grey colors [range: map values]
> aspectcolr: aspect oriented rainbow colors [range: 0 to 360]
> }}}
> It's shorter, and I think "percent of map range" is not very clear.

Pretty good, thanks!

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:10&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
--------------------------+---------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, v.colors, cartography
       CPU: All | Platform: All
--------------------------+---------------------------------------------

Comment (by Nikos Alexandris):

And why not simply use set notation, and avoid the term/string "range:"
altogether?
Like, [map values] or [0,360] or even [0,360) depending on the actual case
each time.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:11&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
-------------------------+-------------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: | Status: new
  enhancement |
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, r3.colors, v.colors,
                         | cartography
       CPU: All | Platform: All
-------------------------+-------------------------------------------------
Changes (by neteler):

* keywords: r.colors, v.colors, cartography => r.colors, r3.colors,
     v.colors, cartography

Comment:

Replying to [comment:11 Nikos Alexandris]:
> And why not simply use set notation, and avoid the term/string "range:"
altogether?
> Like, [map values] or [0,360] or even [0,360) depending on the actual
case each time.

Along with "range" more people may more easily understand what's meant
here...

While r.colors and r3.colors are (for me) fine now, still v.colors would
need this enhancement.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:12&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
-------------------------+-------------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: | Status: new
  enhancement |
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, r3.colors, v.colors,
                         | cartography
       CPU: All | Platform: All
-------------------------+-------------------------------------------------

Comment (by mmetz):

In [changeset:"73186" 73186]:
{{{
#!CommitTicketReference repository="" revision="73186"
v.colors: +flag to output color table type and value range (see #3077)
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:13&gt;
GRASS GIS <https://grass.osgeo.org>

#3077: r.colors: flag to output color table type and value range
-------------------------+-------------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: | Status: new
  enhancement |
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.colors, r3.colors, v.colors,
                         | cartography
       CPU: All | Platform: All
-------------------------+-------------------------------------------------

Comment (by neteler):

Replying to [comment:13 mmetz]:
> In [changeset:"73186" 73186]:
> {{{
> #!CommitTicketReference repository="" revision="73186"
> v.colors: +flag to output color table type and value range (see #3077)
> }}}

Thank you! So, now only wxGUI missing, right?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3077#comment:14&gt;
GRASS GIS <https://grass.osgeo.org>