Opened 8 years ago

Last modified 4 years ago

#1589 new defect

r.clump: inadequate color ramp

Reported by: pcav Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Raster Version: 6.4.1
Keywords: r.clump, G_make_random_colors() Cc:
CPU: x86-64 Platform: Linux

Description

r.clump applies a color table to results, but if we have many clumps (>900 in my case), higher clumps do not get a color, and appear (wrongly) missing.

Change History (2)

comment:1 Changed 8 years ago by hamish

Component: DefaultRaster
Keywords: r.clump G_make_random_colors() added
Milestone: 6.4.3

after closing the map r.clump does:

    G_read_range(OUTPUT, G_mapset(), &range);
    G_get_range_min_max(&range, &min, &max);
    G_make_random_colors(&colr, min, max);
    G_write_colors(OUTPUT, G_mapset(), &colr);

so maybe G_make_random_colors() is to blame?

it falling over at ~900 clumps is suspiciously close to this calculation in lib/gis/color_rand.c:

#define MAX_COLORS 1024
#define DEVIATION 128
...
count = MAX_COLORS - DEVIATION + rand() % DEVIATION;

as a basis for testing, could someone who knows about the module add an example using one of the standard datasets to the help page?

see also r.watershed's color creation mechanism.

thanks, Hamish

comment:2 Changed 4 years ago by neteler

Milestone: 6.4.36.4.6
Note: See TracTickets for help on using tickets.