Hi Jarek, attached there is a test.rul and a test.map that works on the spearfish dataset (elevation and slope map) and produces the same error like before in my own example.
Here the code that I ran in GRASS65: #First I copied the elevation map (to get rid of the dot "." in the map name) g.copy rast=elevation.10m@PERMANENT,elevation #Then I simply ran the fuzzy system r.fuzzy.system --overwrite maps=/path/to/test.map rules=/path/to/test.rul family=Zadeh defuz=bisector imp=minimum res=100 output=test_out # and the error: ERROR: line 2 Syntax error 3 near < &> In the rules files you can also use the rules provided in the email before, you just need to replace depth by slope and velocity by elevation. To me the problem seems to be located when the tool tries to disentangle the rules-string into single rules and that might interfere with the location of the parentheses (although they are locically set in a correct way). Thank you for working on that! I really like that tool and if working we will apply it in the field of fish ecology. Best regards, Johannes PS: I also added the grass-dev list as this might be interesting to others as well. On Tue, May 7, 2013 at 7:10 PM, Jarek Jasiewicz <jar...@amu.edu.pl> wrote: > Please send me all your code and example on Spearfish. I cannot say more > on the example you sent > J. > > On 05/07/2013 01:36 PM, Johannes Radinger wrote: > > Hi again, > > following my last email I tried to simplify the rule and still get an > error. It seems that > there are problems with parsing the rules. Here are two very simple rules > that both (should) mean > the same thing: > > $ low {(depth=verylow & velocity=verylow) | (depth=low & velocity=verylow) > | (depth=verylow & velocity=low) | (depth=verylow & velocity=medium) | > (depth=veryhigh & velocity=medium) | (depth=high & velocity=high)} > > $ low {(depth=verylow & velocity=verylow) | ((depth=low & > velocity=verylow) | ((depth=verylow & velocity=low) | ((depth=verylow & > velocity=medium) | ((depth=veryhigh & velocity=medium) | (depth=high & > velocity=high))))} > > But for both I get an error when they're checked by r.fuzzy.system. > What I don't know is how to use the or-operator '|' correctly multiple > times. E.g. for "either A or B or C". > How do I need to set the parentheses correctly so that the rules are > parsed correctly. As I don't understand > the code in > https://svn.osgeo.org/grass/grass-addons/grass6/raster/r.fuzzy.system/rule_parser.c > I am not sure what is happening there. If it is just an error that is not > influencing the fuzzy output, can > that be somehow bypassed as I thought the rules are correct. > > Hopefully anybody can help here! > > Best regards, > Johannes > > > > ---------- Forwarded message ---------- > From: Johannes Radinger <johannesradin...@gmail.com> > Date: Tue, May 7, 2013 at 11:35 AM > Subject: r.fuzzy.sytem rule file syntax error > To: GRASS user list <grass-u...@lists.osgeo.org> > > > Hi, > I try to use the r.fuzzy.system tool but my rules do not work. The error > seems to be related > with a line in the rule definition file. The line is: > > $ low {(depth=veryhigh & (velocity=medium | velocity=high)) | ((depth=high > & (velocity=high | velocity=veryhigh)) | ((depth=medium & > velocity=veryhigh) | (depth=low & velocity=verylow)))} > > ERROR: line 2 Syntax error near < )> > > However that does not give me the real info about the problem. I checked > several times the number of opening and closing braces")" but somehow I > can't find the syntax error. Probably I am just code-blind :) > > Any suggestions? Is there any possibility to check the syntax resp. to > pin down where excaclty the problem is? > > /johannes > > >
test.map
Description: Binary data
test.rul
Description: Binary data
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev