[GRASS-dev] standarizing range syntax

Glynn Clements glynn at gclements.plus.com
Wed Aug 13 01:29:14 EDT 2008


Michael Barton wrote:

> Currently, due to its history, GRASS has various ways of designating a  
> range of values.
> 
> In raster displays (d.rast) ranges are expressed as 'n-n';
> for color tables, they are implied but not explicitly given;
> for raster reclass maps (r.reclass), they are expressed as 'n thru n'
> for raster recode (r.recode), they are expressed as 'n:n';
> for vector reclass (actually a recode, v.reclass), ranges are  
> expressed in SQL syntax
> 
> At least for rasters, I'd like to suggest that we standardize range  
> notation.
> 
> I recommend 'n-n'. It is compact, widely recognized, and doesn't use a  
> misspelled english word ("thru"). The syntax 'n:n' is used in some  
> programming, but not a lot beyond that.

One issue with "m-n" is that it could be quite easy to inadvertently
write code which doesn't handle negative values correctly, e.g. 
"-10--5". IMHO, it's also less clear than "-10:-5".

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list