[GRASS-user] complex reclass / r.reclass segmentation fault

Koen Hufkens koen.hufkens at ua.ac.be
Tue Feb 26 08:15:32 EST 2008


Indeed if I split up the rules file in with less than 100 categories at
the lhs it works.

Thanks,
Koen


On Tue, 2008-02-26 at 12:33 +0000, Glynn Clements wrote:
> Koen Hufkens wrote:
> 
> > I have a problem with r.reclass.
> > 
> > I received a file with 2300 different integer class values in a raster
> > format. However every one of these 2300 different integer values is
> > actually a combination of main and subclasses. As I am only interested
> > in the main classes I used a lookup table to determine how I had to
> > group the classes according to my interest.
> > 
> > I made r.reclass rules file like:
> > 
> > 1 2 3 6 9 ... 450 123 456 ... = 1
> > 3 4 10 ... 325 698 ... = 2
> > 11 12 23 54 ... 654 789 222 = 3
> > end
> 
> > However, this results in a segmentation fault if I run the rule with
> > r.reclass.file.
> 
> > Now I know I use alot of values (2300 of them in the reclass rule) but
> > could this be the cause of the segmentation fault. Anything I have to
> > look out for when creating such long rules (new lines, carriage returns
> > etc etc). Any clues?
> 
> r.reclass appears to have a limit of 100 categories on the LHS of a
> rule. Any more than that and it will probably just crash.
> 
> You can have multiple rules with the same RHS, so you can just split
> each rule into multiple rules, each with less than 100 categories. 
> It's probably easiest to just make one rule for each category, e.g.:
> 
> 	while read line ; do
> 	    lhs="${line%%=*}"
> 	    rhs="${line##*=}"
> 	    for cat in $lhs ; do
> 	        echo $cat = $rhs
> 	    done
> 	done < old-rules.txt > new-rules.txt
> 


More information about the grass-user mailing list