<html style="direction: ltr;">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;" bidimailui-charset-is-forced="true"
bgcolor="#FFFFFF" text="#000000">
Interesting...<br>
I can duplicate the problem (but only up to 100 cats). Above that I
get an error of "stack smashing":<br>
<br>
<tt>GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq
-s " " 1 100`" --o</tt><tt><br>
</tt><tt>All subsequent raster operations will be limited to the
MASK area. Removing</tt><tt><br>
</tt><tt>or renaming raster map named 'MASK' will restore raster
operations to</tt><tt><br>
</tt><tt>normal.</tt><tt><br>
</tt><tt>[Raster MASK present]</tt><tt><br>
</tt><tt><br>
</tt><tt>GRASS 7.2.0 (ITM):~ > r.info -g MASK</tt><tt><br>
</tt><tt>north=530000</tt><tt><br>
</tt><tt>south=510000</tt><tt><br>
</tt><tt>east=185000</tt><tt><br>
</tt><tt>west=170000</tt><tt><br>
</tt><tt>nsres=4</tt><tt><br>
</tt><tt>ewres=4</tt><tt><br>
</tt><tt>rows=5000</tt><tt><br>
</tt><tt>cols=3750</tt><tt><br>
</tt><tt>cells=18750000</tt><tt><br>
</tt><tt>datatype=CELL</tt><tt><br>
</tt><tt>ncats=0</tt><tt><br>
</tt><tt>[Raster MASK present]</tt><tt><br>
</tt><br>
But with 103 cats...<br>
<tt>GRASS 7.2.0 (ITM):~ > r.mask raster=farm_bas maskcats="`seq
-s " " 1 103`" --o</tt><tt><br>
</tt><tt>WARNING: MASK already exists and will be overwritten</tt><tt><br>
</tt><tt>*** stack smashing detected ***: r.reclass terminated</tt><tt><br>
</tt><tt>All subsequent raster operations will be limited to the
MASK area. Removing</tt><tt><br>
</tt><tt>or renaming raster map named 'MASK' will restore raster
operations to</tt><tt><br>
</tt><tt>normal.</tt><tt><br>
</tt><tt>GRASS 7.2.0 (ITM):~ > r.info -g MASK</tt><tt><br>
</tt><tt>ERROR: Raster map <MASK> not found</tt><tt><br>
</tt><br>
<br>
<div class="moz-cite-prefix">On 04/06/2017 12:12 PM, Mira Kattwinkel
wrote:<br>
</div>
<blockquote
cite="mid:e9c9d690-9fd2-b853-f099-643917464e14@uni-landau.de"
type="cite">Dear Anna, dear list
<br>
<br>
I used the NC basic sample data set to replicate my case.
Unfortunately, I get the same problem. Can anybody give me a hint?
Thanks a lot!
<br>
<br>
Here is what I did and the output:
<br>
<br>
r.watershed elevation=elevation@PERMANENT threshold=500
basin=basins_new
<br>
SECTION 1a (of 5): Initiating Memory.
<br>
SECTION 1b (of 5): Determining Offmap Flow.
<br>
SECTION 2: A* Search.
<br>
SECTION 3a: Accumulating Surface Flow with MFD.
<br>
SECTION 3b: Adjusting drainage directions.
<br>
SECTION 4: Watershed determination.
<br>
SECTION 5: Closing Maps.
<br>
<br>
## creating mask with 106 categories works fine
<br>
r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
99 100 101 102 103 104 105 106
<br>
All subsequent raster operations will be limited to the MASK area.
Removing or renaming raster map named 'MASK' will restore raster
operations to normal.
<br>
<br>
r.mapcalc expression=r106 = MASK
<br>
<br>
r.mask -r
<br>
Raster MASK removed
<br>
<br>
## creating mask with 107 categories seems to work without error
but there is no MASK output
<br>
r.mask raster=basins_new@PERMANENT maskcats=1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
99 100 101 102 103 104 105 106 107
<br>
All subsequent raster operations will be limited to the MASK area.
Removing or renaming raster map named 'MASK' will restore raster
operations to normal.
<br>
<br>
r.mapcalc expression=m107 = MASK
<br>
Invalid map <MASK>
<br>
Parse error
<br>
ERROR: parse error
<br>
<br>
g.list type=raster
<br>
basins
<br>
basins_new
<br>
elevation
<br>
elevation_shade
<br>
geology
<br>
lakes
<br>
landuse
<br>
r106
<br>
soils
<br>
<br>
<br>
<br>
On 06/04/17 05:06, Anna Petrášová wrote:
<br>
<blockquote type="cite">On Wed, Apr 5, 2017 at 8:22 AM, Mira
Kattwinkel
<br>
<a class="moz-txt-link-rfc2396E" href="mailto:kattwinkel-mira@uni-landau.de"><kattwinkel-mira@uni-landau.de></a> wrote:
<br>
<blockquote type="cite">Dear List,
<br>
<br>
I am using r.mask to create a new raster map that only
contains certain
<br>
categories given in 'maskcats'. Then, I use r.mapcalc to save
the map under
<br>
a new name and (to be on the save side) delete the MASK with
r.mask flag
<br>
'-r'. I do this in a loop and it works fine until a case when
the number of
<br>
categories to combine is 213 (trail and error lead to 106 as
the maximum
<br>
number that works fine). Flag 'verbose' gives the message that
a MASK was
<br>
created, but none is there. The problem arises in both cases
when I directly
<br>
use Grass or through R using execGrass.
<br>
</blockquote>
I tried it on landsat raster from NC sample dataset and it
worked.
<br>
Perhaps you could try to replicate it with this sample dataset?
<br>
<br>
Anna
<br>
<br>
<blockquote type="cite">Is there a limit in the number of
categories that can be passed to r.mask? I
<br>
did not find any hint about that. Additionally, I wonder why
there is no
<br>
error message but in the contrary one that tells me that a
MASK was created
<br>
even when it failed.
<br>
<br>
In case the details are important (or if anybody has a better
idea how to
<br>
achieve what I want): I have a raster map of subcatchemts
belonging to
<br>
stream segments created with r.stream.basins. For the
endpoints of segments,
<br>
I want to combine these subcatchments to a total catchment
raster map
<br>
containing all upstream catchments.
<br>
<br>
Thanks a lot,
<br>
<br>
Mira
<br>
<br>
<br>
--
<br>
Dr. Mira Kattwinkel
<br>
Quantitative Landscape Ecology
<br>
Institute for Environmental Sciences
<br>
University of Koblenz-Landau
<br>
Fortstraße 7
<br>
76829 Landau
<br>
Germany
<br>
Phone: + 49 6341 280-31553
<br>
Office: Building I, Room 2.02
<br>
<br>
_______________________________________________
<br>
grass-user mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<br>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Micha Silver
cell: +972-523-665918</pre>
</body>
</html>