Opened 8 years ago

Last modified 5 years ago

#3077 new enhancement

r.colors: flag to output color table type and value range

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Raster Version: svn-trunk
Keywords: r.colors, r3.colors, v.colors, cartography Cc:
CPU: All Platform: All

Description

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.

Change History (16)

comment:1 by wenzeslaus, 8 years ago

Keywords: cartography added

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 lib/gis/parser_html.c from name and description which are prepared by G_color_rules_descriptions() in 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 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.

comment:2 by neteler, 7 years ago

Keywords: v.colors added; gsoc2016 removed
Milestone: 7.2.07.2.1

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

comment:3 by martinl, 7 years ago

Milestone: 7.2.17.2.2

comment:4 by martinl, 7 years ago

Milestone: 7.2.27.4.0

All enhancement tickets should be assigned to 7.4 milestone.

comment:5 by neteler, 6 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:6 by neteler, 6 years ago

Milestone: 7.4.17.4.2

comment:7 by mmetz, 6 years ago

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

comment:8 by martinl, 6 years ago

Milestone: 7.4.27.6.0

in reply to:  7 ; comment:9 by mmetz, 6 years ago

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

in reply to:  9 comment:10 by neteler, 6 years ago

Replying to 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!

comment:11 by Nikos Alexandris, 6 years ago

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.

in reply to:  11 comment:12 by neteler, 6 years ago

Keywords: r3.colors added

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

comment:13 by mmetz, 6 years ago

In 73186:

v.colors: +flag to output color table type and value range (see #3077)

in reply to:  13 comment:14 by neteler, 6 years ago

Replying to mmetz:

In 73186:

v.colors: +flag to output color table type and value range (see #3077)

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

comment:15 by martinl, 5 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:16 by martinl, 5 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.