Hi, 2008/8/5 christian Brandt <[EMAIL PROTECTED]>: > I try to adapt the color table of a raster file using an ascii file (> rules > option) with the following statement: > > r.colors [EMAIL PROTECTED] color=rules > 'rules=/sonne3/.../GIS/colorscript_farben_temp' > > Hence the following message comes up: > > "color", "rules", and "raster" options are mutually exclusive > > Any ideas what this means? Please see also the attached colorscript.
it seems to be a bug in r.colors, the attached patch quickly fix it. Anyway r.colors needs some more cleaning. In GRASS7 I would suggest to remove -i Enter rules interactively 1) then if rules file is given read from the file 2) if not given (and color=rules) switch to the interactive mode 3) or completely remove interactive mode, print error about missing rules file <- seems to be a better solution, to avoid any interactive mode in GRASS7 ? Martin [cc: grass-dev, sorry for cross-posting) -- Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa *
Index: raster/r.colors/main.c =================================================================== --- raster/r.colors/main.c (revision 32534) +++ raster/r.colors/main.c (working copy) @@ -109,6 +109,7 @@ char *style, *cmap, *cmapset; char *rules; int fp; + FILE *rules_file; struct GModule *module; struct { @@ -237,6 +238,7 @@ cmap = opt.rast->answer; rules = opt.rules->answer; + rules_file = NULL; if (!name) G_fatal_error(_("No map specified")); @@ -244,11 +246,11 @@ G_fatal_error(_ ("One of \"-i\" or \"-r\" or options \"color\", \"rast\" or \"rules\" must be specified!")); - if (interactive && (style || rules || cmap)) + if (interactive && ((strcmp(style, "rules") && rules) || cmap)) G_fatal_error(_ ("Interactive mode is incompatible with \"color\", \"rules\", and \"raster\" options")); - if ((style && (cmap || rules)) || (cmap && rules)) + if ((strcmp(style, "rules") && (cmap || rules)) || (cmap && rules)) G_fatal_error(_ ("\"color\", \"rules\", and \"raster\" options are mutually exclusive")); @@ -313,7 +315,11 @@ (CELL) max); } else if (strcmp(style, "rules") == 0) { - if (!read_color_rules(stdin, &colors, min, max, fp)) + rules_file = fopen(rules, "r"); + if (rules_file == NULL) { + G_fatal_error(_("Unable to open rules file <%s>"), rules); + } + if (!read_color_rules(rules_file, &colors, min, max, fp)) exit(EXIT_FAILURE); } else if (find_rule(style))
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user