[GRASS-dev] r.recode: behaviour at limits

Glynn Clements glynn at gclements.plus.com
Mon Jul 13 11:25:11 EDT 2009


Moritz Lennert wrote:

> Before I delve into the code to try to find this out: does someone know
> what is the behaviour of r.recode at the limits, i.e. with
> 
> 0:10:0:1
> 10:20:10:20
> 
> what is 10 recoded to ?

1

> In other words are the min and max values exclusive or inclusive ?

They're both inclusive. If ranges overlap (Rast_fpreclass_add_rule()
doesn't prevent this), the first match is used. If the rules were
reversed:

	10:20:10:20
	0:10:0:1

then 10 would be recoded to 10.

BTW, libraster needs reformatting; the change of prefix from G_* to
Rast* means that parameter lists which are split over multiple lines
no longer align, e.g.:

void Rast_fpreclass_add_rule(struct FPReclass *r,
                          DCELL dLow, DCELL dHigh,
                          DCELL rLow, DCELL rHigh)

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


More information about the grass-dev mailing list