[GRASS-dev] [grass-code I][381] r.colors rules: some scripts broken

Michael Barton michael.barton at asu.edu
Thu May 3 11:08:52 EDT 2007


FWIW, the old way rules= was implemented never made much sense. It should
have followed the old concept of rulesfile > r.colors and made it easier to
implement, but was a strange hybrid of this and colors=. The current
implementation is much more logical. I'm sympathetic about the problem with
user scripts, but it's easy to fix (change rules= to colors=).

Michael


On 5/3/07 12:36 AM, "Glynn Clements" <glynn at gclements.plus.com> wrote:

> 
> Hamish wrote:
> 
>> http://wald.intevation.org/tracker/?func=detail&atid=204&aid=381&group_id=21
>> ..
>>> code I item #381, was opened at 2007-04-25 19:24
>>> Summary: r.colors rules: some scripts broken
>> ..
>>> Eg. in GRASS 6.3 scripts dir:
>>> 
>>> i.in.spotvgt: 213: r.colors ${NAME} rules=ndvi 2>&1 >/dev/null
>>> i.in.spotvgt: 275: r.colors ${NAME}_filt rules=ndvi 2>&1 >/dev/null
>>> r.in.srtm: 237: r.colors rul=srtm map=$TILEOUT
>>> 
>>> Such syntax leads now to "ERROR: Unable to load rules file srtm".
>>> 
>>> How do we fix it? Add the $GISBASE/etc/colors/ before the rule name?
>>> Looks like a broken backwards compatibility...
>> 
>> 
>> [cc'd from the tracker]
>> 
>> r.colors was changed in 6.3 CVS,
>> 
>> -------
>> Revision 2.14, Sat Apr 14 03:35:32 2007 UTC by glynn
>> ..
>> r.colors:
>> ..
>>  Merge rules= with color=
>>  Use rules= for external rules file
>> -------
>> 
>> you can get rid of the errors by changing "r.colors rules="
>> to "r.colors color=". I've just done this for r.in.srtm.
>> 
>> But really this will break a lot of scripts and should be revisited
>> to be backwards compatible. Suggestion: when it looks for the rules
>> file it should try looking for $GISBASE/etc/colors/$RULEFILE if it
>> can't find the file as just $RULEFILE.
>> 
>> Anything written using "r.colors rules=" will be affected.
> 
> When I added rules=, it was made clear that this was a temporary
> feature until it could replace color=.
> 
> As there hasn't been a 6.3.0 release yet, the 6.3 API remains subject
> to change.

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton





More information about the grass-dev mailing list