[GRASS-dev] standarizing range syntax

Hamish hamish_b at yahoo.com
Wed Aug 13 02:00:37 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.


v.extract user the standard parser option G_OPT_V_CATS:
    list   Category values
            Example: 1,3,7-9,13

which I think is fine; cat ranges never fall into the negative.

r.category's cats= option is the same, but its rules file format uses
  cat:Label
or
  val1:val2:Label


r.reclass format is a bit weird, I don't mind changing that.

r.colors rules are used bit differently, so they may not fall into the
scope of this standardization round.

I assume vector modules which take SQL statements do not parse those
statements but pass them intact, in which case I would leave them
as-is.


I would not touch this for grass6, and not stress too much about backwards
compatibility for grass7.


2c,
Hamish



      



More information about the grass-dev mailing list