<div dir="ltr"><div><div><div>Hi Jarek,<br><br></div>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.<br><br>
</div>Here the code that I ran in GRASS65:<br><br></div>#First I copied the elevation map (to get rid of the dot "." in the map name)<br><div>g.copy rast=elevation.10m@PERMANENT,elevation<br></div><div><br>#Then I simply ran the fuzzy system<br>
</div><div>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<br><br></div><div># and the error:<br>ERROR: line 2 Syntax error 3 near < &><br>
<br></div><div></div><div>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.<br></div><div><br></div><div>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).<br>
<br></div><div>Thank you for working on that! I really like that tool and if working we will apply it in the field of fish ecology.<br><br></div><div>Best regards,<br></div><div>Johannes<br><br></div><div>PS: I also added the grass-dev list as this might be interesting to others as well.<br>
</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 7, 2013 at 7:10 PM, Jarek Jasiewicz <span dir="ltr"><<a href="mailto:jarekj@amu.edu.pl" target="_blank">jarekj@amu.edu.pl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Please send me all your code and
      example on Spearfish. I cannot say more on the example you sent<span class="HOEnZb"><font color="#888888"><br>
      J.</font></span><div><div class="h5"><br>
      On 05/07/2013 01:36 PM, Johannes Radinger wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div>
                        <div>
                          <div>Hi again,<br>
                            <br>
                          </div>
                          following my last email I tried to simplify
                          the rule and still get an error. It seems that<br>
                          there are problems with parsing the rules.
                          Here are two very simple rules that both
                          (should) mean<br>
                          the same thing:<br>
                          <br>
                          $ 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)}<br>
                          <br>
                          $ 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))))}<br>
                          <br>
                        </div>
                        But for both I get an error when they're checked
                        by r.fuzzy.system.<br>
                      </div>
                      What I don't know is how to use the or-operator
                      '|' correctly multiple times. E.g. for "either A
                      or B or C".<br>
                    </div>
                    How do I need to set the parentheses correctly so
                    that the rules are parsed correctly. As I don't
                    understand<br>
                  </div>
                  the code in <a href="https://svn.osgeo.org/grass/grass-addons/grass6/raster/r.fuzzy.system/rule_parser.c" target="_blank">https://svn.osgeo.org/grass/grass-addons/grass6/raster/r.fuzzy.system/rule_parser.c</a><br>

                </div>
                I am not sure what is happening there. If it is just an
                error that is not influencing the fuzzy output, can<br>
                that be somehow bypassed as I thought the rules are
                correct.<br>
                <br>
              </div>
              Hopefully anybody can help here!<br>
            </div>
            <br>
          </div>
          Best regards,<br>
        </div>
        Johannes<br>
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div><br>
                        <br>
                        <div>
                          <div>
                            <div><br>
                              <div class="gmail_quote">----------
                                Forwarded message ----------<br>
                                From: <b class="gmail_sendername">Johannes
                                  Radinger</b> <span dir="ltr"><<a href="mailto:johannesradinger@gmail.com" target="_blank">johannesradinger@gmail.com</a>></span><br>
                                Date: Tue, May 7, 2013 at 11:35 AM<br>
                                Subject: r.fuzzy.sytem rule file syntax
                                error<br>
                                To: GRASS user list <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br>
                                <br>
                                <br>
                                <div dir="ltr">
                                  <div>
                                    Hi,<br>
                                    I try to use the r.fuzzy.system tool
                                    but my rules do not work. The error
                                    seems to be related<br>
                                    with a line in the rule definition
                                    file. The line is:<br>
                                    <br>
                                    $ low {(depth=veryhigh &
                                    (velocity=medium | velocity=high)) |
                                    ((depth=high & (velocity=high |
                                    velocity=veryhigh)) | ((depth=medium
                                    & velocity=veryhigh) |
                                    (depth=low &
                                    velocity=verylow)))}<br>
                                    <br>
                                    ERROR: line 2 Syntax error near <
                                    )><br>
                                    <br>
                                  </div>
                                  <div>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
                                    :)<br>
                                    <br>
                                  </div>
                                  <div>Any suggestions? Is there any
                                    possibility to check the syntax
                                    resp. to pin down where excaclty the
                                    problem is? <br>
                                    <span><font color="#888888"><br>
                                      </font></span></div>
                                  <span><font color="#888888">
                                      <div>
                                        /johannes<br>
                                      </div>
                                    </font></span></div>
                              </div>
                              <br>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div></div>