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

-- 
Glynn Clements <[EMAIL PROTECTED]>
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to