[GRASS-SVN] r50921 - grass/branches/releasebranch_6_4/scripts/r.mask
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 22 14:36:23 EST 2012
Author: hamish
Date: 2012-02-22 11:36:23 -0800 (Wed, 22 Feb 2012)
New Revision: 50921
Modified:
grass/branches/releasebranch_6_4/scripts/r.mask/description.html
grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
Log:
merge changes from devbr6 (mainly quoting variables)
Modified: grass/branches/releasebranch_6_4/scripts/r.mask/description.html
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.mask/description.html 2012-02-22 19:34:14 UTC (rev 50920)
+++ grass/branches/releasebranch_6_4/scripts/r.mask/description.html 2012-02-22 19:36:23 UTC (rev 50921)
@@ -25,7 +25,7 @@
<p>
To restore raster operations to normal (i.e., all cells of the current region),
-remove the MASK file by setting the <b>-r</b> remove MASK flag. In this case, a
+remove the MASK map by setting the <b>-r</b> remove MASK flag. In this case, a
dummy value must also be given for the input parameter.
A MASK also can be removed by using <em>g.remove</em>
or by renaming it to any other name with <em>g.rename</em>.
@@ -35,7 +35,7 @@
The above method for specifying a "mask" may seem
counterintuitive. Areas inside the MASK are not hidden;
-areas outside the MASK will be ignored until the MASK file
+areas outside the MASK will be ignored until the MASK map
is removed.
<p>
@@ -60,19 +60,19 @@
<h2>EXAMPLES</h2>
-Creating a raster mask, for showing only elevations of lakes:
+Creating a raster MASK, for showing only elevations of lakes:
<div class="code"><pre>
r.mask input=lakes
# statistics only for elevation pixels in the lakes:
r.univar elevation
</pre></div>
-Removing a raster mask with the -r flag:
+Removing a raster MASK with the -r flag:
<div class="code"><pre>
r.mask -r
</pre></div>
-Creating a mask from categories 3 through 6 in the North Carolina
+Creating a MASK from categories 3 through 6 in the North Carolina
'geology_30m' raster map:
<div class="code"><pre>
g.region rast=geology_30m -p
Modified: grass/branches/releasebranch_6_4/scripts/r.mask/r.mask
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.mask/r.mask 2012-02-22 19:34:14 UTC (rev 50920)
+++ grass/branches/releasebranch_6_4/scripts/r.mask/r.mask 2012-02-22 19:36:23 UTC (rev 50921)
@@ -15,8 +15,8 @@
#############################################################################
#%module
-#% description: Creates a MASK for limiting raster operation.
-#% keywords: raster, mask
+#% description: Creates a MASK for limiting raster operation.
+#% keywords: raster, mask
#%end
#%option
#% key: input
@@ -58,7 +58,7 @@
fi
if [ -z "$GRASS_VERBOSE" ] || [ "$GRASS_VERBOSE" -le 2 ] ; then
- BEQUIET="--q"
+ BEQUIET="--quiet"
else
BEQUIET=""
fi
@@ -83,10 +83,10 @@
trap "exitprocedure" 2 3 15
# if map is given check if existing
-if [ $GIS_OPT_INPUT ]; then
- eval `g.findfile element=cell file=$GIS_OPT_INPUT`
- filename="${fullname}"
- if [ "$filename" = "" ] ; then
+if [ -n "$GIS_OPT_INPUT" ]; then
+ eval `g.findfile element=cell file="$GIS_OPT_INPUT"`
+ filename="$fullname"
+ if [ -z "$filename" ] ; then
g.message -e "Raster map <$GIS_OPT_INPUT> not found"
exit 1
fi
@@ -103,39 +103,39 @@
if [ "$GIS_FLAG_R" -eq 1 ]; then
if test -f "`g.gisenv GISDBASE`/`g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`/cell/MASK" ; then
g.remove rast=MASK
- g.message ${BEQUIET} "Raster MASK removed"
+ g.message $BEQUIET "Raster MASK removed"
else
- g.message ${BEQUIET} -w "No existing MASK to remove"
+ g.message $BEQUIET -w "No existing MASK to remove"
fi
else
- if [ ! $GIS_OPT_INPUT ]; then
- g.message ${BEQUIET} -w "No raster map for MASK provided"
+ if [ -z "$GIS_OPT_INPUT" ]; then
+ g.message $BEQUIET -w "No raster map for MASK provided"
exit 1;
fi
if [ "$GIS_FLAG_O" -eq 1 ]; then
- echo "$GIS_OPT_MASKCATS = 1" | r.reclass input=$GIS_OPT_INPUT output=MASK --o
+ echo "$GIS_OPT_MASKCATS = 1" | r.reclass input="$GIS_OPT_INPUT" output=MASK --o
else
# does map exist in CURRENT mapset?
- eval `g.findfile element=cell file=MASK mapset=$MAPSET`
- if [ "$file" ] ; then
+ eval `g.findfile element=cell file=MASK mapset="$MAPSET"`
+ if [ -n "$file" ] ; then
g.message -e "MASK already found in current mapset. Delete first or overwrite"
exit 1
fi
- echo "$GIS_OPT_MASKCATS = 1" | r.reclass input=$GIS_OPT_INPUT output=MASK
+ echo "$GIS_OPT_MASKCATS = 1" | r.reclass input="$GIS_OPT_INPUT" output=MASK
fi
if [ "$GIS_FLAG_I" -eq 1 ]; then
- g.rename --q rast=MASK,$TEMPRAST
- r.mapcalc "MASK=if(isnull($TEMPRAST),1,null())"
- g.remove --q rast=$TEMPRAST
- g.message ${BEQUIET} "Inverted MASK created. All subsequent raster operations"
+ g.rename --q rast=MASK,"$TEMPRAST"
+ r.mapcalc "MASK = if(isnull($TEMPRAST),1,null())"
+ g.remove --q rast="$TEMPRAST"
+ g.message $BEQUIET "Inverted MASK created. All subsequent raster operations"
else
- g.message ${BEQUIET} "MASK created. All subsequent raster operations"
+ g.message $BEQUIET "MASK created. All subsequent raster operations"
fi
- g.message ${BEQUIET} "will be limited to MASK area"
- g.message ${BEQUIET} "Removing or renaming raster file named MASK will"
- g.message ${BEQUIET} "restore raster operations to normal"
+ g.message $BEQUIET "will be limited to MASK area"
+ g.message $BEQUIET "Removing or renaming raster file named MASK will"
+ g.message $BEQUIET "restore raster operations to normal"
fi
exit 0
More information about the grass-commit
mailing list