<div dir="ltr">Anna,<div><br></div><div>Below is my script. I am running on Ubuntu 10.10, GRASS 7 RC1 (built today). I have tried running my script two ways:</div><div><br></div><div>(1) external from GRASS, where I set the GRASS environment (the attached script) — this is how I have done almost all my GRASS scripting for years</div><div><br></div><div>(2) I remove the section where I set the GRASS environment and run from the GRASS prompt — this works perfectly fine!!!! (I had not tried this previously when I first reported this problem)</div><div><br></div><div>Running as (1) is where I get the r.mask errors I have been seeing; I get the errors both when I simply remove any existing MASKs (r.mask -r) or where I attempt to set the MASK.</div><div><br></div><div>Cheers!</div><div>Tom</div><div><br></div><div><p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">#!/bin/bash</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)"># Read the GRASS LOCATION and BASIN MASK as command line arguments</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">location=$1</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">basin_mask=$2</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###############################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)"># Set GRASS Environment</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###############################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">GISDBASE=/home/tadams/grass/data</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">MAPSET=$USER</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">LOCATION_NAME=$location</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export USER=$USER</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export GISBASE=/usr/local/grass-7.0.0RC1</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export GISDBASE=$GISDBASE</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export MAPSET=$USER</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export LOCATION_NAME=$location</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export GISRC=$HOME/.grass7/rc</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###################################################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)"># High resolution DEM analysis</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###################################################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Starting GRASS processing..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mask -r</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Set GRASS region..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">g.region rast=dem_filled@$MAPSET</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">g.region -dp e=509808.1892 w=170352.36895319 n=-504196.824054 s=-739405.268029</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Running r.watershed..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.watershed --overwrite elevation=dem_filled@$MAPSET threshold=75000 max_slope_length=1000 accumulation=basin_accum tci=basin_atanb drainage=basin_dir basin=basin_basins stream=basin_streamsegs length_slope=basin_slopelen slope_steepness=basin_steep convergence=5 memory=300</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.slope.aspect --overwrite elevation=dem_filled@$MAPSET slope=basin_slope_pct format=percent</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mapcalc expression="basin_slope=basin_slope_pct/100." --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###################################################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)"># 250 meter resolution DEM analysis</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">###################################################################################</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">g.region res=250</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Running r.resamp.stats..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.resamp.stats --overwrite input=basin_accum@$MAPSET output=basin_accum_250 method=maximum</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.resamp.stats --overwrite input=basin_slope@$MAPSET output=basin_slope_250 method=average</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Set GRASS raster mask..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mask raster=$basin_mask@$MAPSET maskcats=* --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Calculate Drainage Area (in sq mi)..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mapcalc  expression="da_mi=basin_accum_250*900/2589988." --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Calculate TOPWIDTH (in meters)..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mapcalc expression="topwidth=(11.33*exp(da_mi,0.476))*0.3048"  --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mapcalc expression="nc=exp(basin_slope_250,0.272)*exp(basin_accum_250*900,-0.00011)*0.05" --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">echo "Calculate alpha..."</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.mapcalc expression="alpha=exp(basin_slope_250,0.5)/(nc*exp(topwidth,0.66667))" --overwrite</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">rm rutpix_Q0CHN</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">r.out.gdal input=alpha@$MAPSET output=rutpix_Q0CHN format=GTiff</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0);min-height:14px"><br></p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)"># Cleanup -- Remove temporary GRASS files</p>
<p style="margin:0px;font-size:10px;font-family:Monaco;color:rgb(0,249,0);background-color:rgb(0,0,0)">$GISBASE/etc/clean_temp</p></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 8:45 AM, Anna Petrášová <span dir="ltr"><<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Jan 27, 2015 at 10:41 AM, Thomas Adams <span dir="ltr"><<a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Anna,<div><br></div><div>I'm building RC1 on a different Linux box (where I had beta3); I'll try again and  if I get the same error, I'll offer up an example — how would I do that? tar things up and put it on GoogleDrive?</div></div></blockquote><div><br></div></span><div>I was thinking ideally about a short .sh file which can be attached. I don't know how complicated that would be for you.</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Tom</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 8:34 AM, Anna Petrášová <span dir="ltr"><<a href="mailto:kratochanna@gmail.com" target="_blank">kratochanna@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Tue, Jan 27, 2015 at 8:31 AM, Thomas Adams <span dir="ltr"><<a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Markus,<br><br></div>Thank you for your help; I did try using RC1 (which I built shortly after it's release) and got the same error -- but I'll try again. I can't do that right now because I just kicked-off something else in a different GRASS LOCATION that's taking a while to process. So, I won't be able to try again until later.<br></div></div></div></blockquote><div><br></div></span><div>Maybe a short but complete example would help us to test?</div><div><br></div><div>Anna</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><br></div>Thank you,<br></div>Tom<span><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 1:39 AM, Markus Neteler <span dir="ltr"><<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Tom,<br>
<span><br>
On Tue, Jan 27, 2015 at 8:38 AM, Hermann Peifer <<a href="mailto:peifer@gmx.eu" target="_blank">peifer@gmx.eu</a>> wrote:<br>
> On 2015-01-26 23:57, Thomas Adams wrote:<br>
>><br>
>> All:<br>
>><br>
>> I have a GRASS bash shell script where all my GRASS commands<br>
>> (7.0.0beta3) execute just fine except for my call to set a MASK:<br>
>><br>
>> r.mask --overwrite input=$basin_mask@$MAPSET<br>
>><br>
>> I get this error...<br>
>><br>
>> Traceback (most recent call last):<br>
>>    File "/usr/local/grass-7.0.0beta3/scripts/r.mask", line 71, in <module><br>
<br>
</span>Please consider to update to RC1, we have fixed all these errors.<br>
<span><br>
>>      import grass.script as grass<br>
>> ImportError: No module named grass.script<br>
>><br>
><br>
> There is no input parameter in G7:r.mask [1]. This info is however missing<br>
> in [2], as I just noted. I am not sure of the behaviour of 7.0.0beta3, but<br>
> my GRASS 7.1.svn comes up with:<br>
><br>
> ERROR: Sorry, <input> is not a valid parameter<br>
><br>
> Hermann<br>
><br>
> [1] <a href="http://grass.osgeo.org/grass70/manuals/r.mask.html" target="_blank">http://grass.osgeo.org/grass70/manuals/r.mask.html</a><br>
> [2] <a href="http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges" target="_blank">http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures#Rastermodulechanges</a><br>
<br>
</span>The lookup mechanism should now work fine (otherwise please report),<br>
just beta3 didn't have it yet.<br>
<span><font color="#888888"><br>
Markus<br>
</font></span></blockquote></div><br><br clear="all"><br><div><br></div>
</div></span></div>
<br></div></div>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div><div><div><br></div></div>
</div></div></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Thomas E Adams, III<div>718 McBurney Drive</div><div>Lebanon, OH 45036</div><div><br></div><div>1 (513) 739-9512 (cell)</div><div><br></div></div>
</div>