<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Mira,</p>
    <p>I find a more elegant way to create a mask from an arbitrarily
      long list of raster categories would be to use r.reclass where you
      can use an input file:</p>
    <p>r.reclass input=subcatchments output=MASK rules=mask.dat</p>
    <p>and in mask.dat you list your categories:</p>
    <pre>12=1
23=1
10=1
...
1200=1
</pre>
    <p>Might help, although the problem seems to have been solved.</p>
    <p>Michel<br>
    </p>
    <div class="moz-cite-prefix">On 04/05/2017 03:59 PM, Mira Kattwinkel
      wrote:<br>
    </div>
    <blockquote
      cite="mid:9a045c30-7b90-0df0-f30a-787f2a50e067@uni-landau.de"
      type="cite">Dear Micha
      <br>
      <br>
      thanks for your suggestion.
      <br>
      <br>
      Actually, that's is what I usually do. However, I am not really
      interested in the catchment of the endpoints of the edges but in
      sampling points lying at the streams. If a point lies within the
      dem cell of the outlet, which can be a confluence of two streams,
      the coordinate approach will result in the catchment of both
      confluences, although the point lies just at one of them. That's
      why I came up with the idea of summing up the subcatchments of
      only the relevant branch of the stream network.
      <br>
      <br>
      Maybe there are other thoughts on that?
      <br>
      <br>
      Mira
      <br>
      <br>
      <br>
      On 05/04/17 15:25, Micha Silver wrote:
      <br>
      <blockquote type="cite">
        <br>
        <br>
        <br>
        On 04/05/2017 03:22 PM, Mira Kattwinkel wrote:
        <br>
        <blockquote type="cite">Dear List,
          <br>
          <br>
          I am using r.mask to create a new raster map that only
          contains certain categories given in 'maskcats'. Then, I use
          r.mapcalc to save the map under a new name and (to be on the
          save side) delete the MASK with r.mask flag '-r'. I do this in
          a loop and it works fine until a case when the number of
          categories to combine is 213 (trail and error lead to 106 as
          the maximum number that works fine). Flag 'verbose' gives the
          message that a MASK was created, but none is there. The
          problem arises in both cases when I directly use Grass or
          through R using execGrass.
          <br>
          <br>
          Is there a limit in the number of categories that can be
          passed to r.mask? I did not find any hint about that.
          Additionally, I wonder why there is no error message but in
          the contrary one that tells me that a MASK was created even
          when it failed.
          <br>
          <br>
          In case the details are important (or if anybody has a better
          idea how to achieve what I want): I have a raster map of
          subcatchemts belonging to stream segments created with
          r.stream.basins. For the endpoints of segments, I want to
          combine these subcatchments to a total catchment raster map
          containing all upstream catchments.
          <br>
          <br>
        </blockquote>
        If you have the endpoint of of the outlet segment, you might use
        that as the "coordinates" parameter to r.stream.basins to create
        a single large drainage basin. Then use that as the mask to get
        out the subcatchments.
        <br>
        <br>
        <blockquote type="cite">Thanks a lot,
          <br>
          <br>
          Mira
          <br>
          <br>
          <br>
        </blockquote>
        <br>
        -- <br>
        Micha Silver
        <br>
        cell: +972-523-665918
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>