[GRASS-SVN] r46567 -
grass/branches/develbranch_6/scripts/r.fillnulls
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 4 23:44:01 EDT 2011
Author: neteler
Date: 2011-06-04 20:44:00 -0700 (Sat, 04 Jun 2011)
New Revision: 46567
Modified:
grass/branches/develbranch_6/scripts/r.fillnulls/r.fillnulls
Log:
modernized MASK management to fix white space in path support
Modified: grass/branches/develbranch_6/scripts/r.fillnulls/r.fillnulls
===================================================================
--- grass/branches/develbranch_6/scripts/r.fillnulls/r.fillnulls 2011-06-05 03:38:46 UTC (rev 46566)
+++ grass/branches/develbranch_6/scripts/r.fillnulls/r.fillnulls 2011-06-05 03:44:00 UTC (rev 46567)
@@ -80,10 +80,6 @@
LC_NUMERIC=C
export LC_NUMERIC
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-LOCATION="$GISDBASE/$LOCATION_NAME/$MAPSET"
-
# what to do in case of user break:
exitprocedure()
{
@@ -92,8 +88,8 @@
g.remove rast="$TMP1","$TMP1.buf","${TMP1}_filled" --quiet > /dev/null
g.remove vect="$VECTTMP" --quiet > /dev/null
- #restore user mask if present:
- if test -f $LOCATION/cell/$USERMASK ; then
+ eval `g.findfile element=cell file=$USERMASK`
+ if [ "$file" ] ; then
g.remove rast=MASK --quiet > /dev/null
g.rename "$USERMASK",MASK --quiet > /dev/null
fi
@@ -113,8 +109,8 @@
fi
#check if input file exists
-#if test -f $LOCATION/cell/$GIS_OPT_INPUT
-if [ -z `g.findfile elem=cell file="$GIS_OPT_INPUT" | grep ^file | cut -f2 -d=` ] ; then
+eval `g.findfile element=cell file="$GIS_OPT_INPUT"`
+if [ ! "$file" ] ; then
g.message -e "<$GIS_OPT_INPUT> does not exist! Aborting."
exit 1
fi
@@ -122,8 +118,8 @@
#check if a MASK is already present:
MASKTMP=mask.$$
USERMASK="usermask_$MASKTMP"
-if test -f "$LOCATION/cell/MASK"
-then
+eval `g.findfile element=cell file=MASK`
+if [ "$file" ] ; then
g.message "A user raster mask (MASK) is present. Saving it..."
g.rename MASK,"$USERMASK" --quiet > /dev/null
fi
@@ -186,8 +182,8 @@
g.remove MASK > /dev/null
#restoring user's mask, if present:
- if test -f "$LOCATION/cell/$USERMASK"
- then
+ eval `g.findfile element=cell file=$USERMASK`
+ if [ "$file" ] ; then
g.message "Restoring user mask (MASK)..."
g.rename "$USERMASK",MASK --quiet > /dev/null
fi
@@ -203,8 +199,8 @@
#remove internal MASK first -- WHY???? MN 10/2005
g.remove MASK > /dev/null
-if test -f "$LOCATION/cell/$USERMASK"
-then
+eval `g.findfile element=cell file=$USERMASK`
+if [ "$file" ] ; then
g.message "Using user mask while interpolating"
RST_CMD="v.surf.rst zcol=value tension=$GIS_OPT_TENSION smooth=$GIS_OPT_SMOOTH maskmap=$USERMASK"
else
@@ -224,8 +220,8 @@
g.message "Note: Above warnings may be ignored."
#restoring user's mask, if present:
-if test -f "$LOCATION/cell/$USERMASK"
-then
+eval `g.findfile element=cell file=$USERMASK`
+if [ "$file" ] ; then
g.message "Restoring user mask (MASK)..."
g.rename "$USERMASK",MASK --quiet > /dev/null
fi
More information about the grass-commit
mailing list