[GRASS-SVN] r46566 -
grass/branches/releasebranch_6_4/scripts/r.fillnulls
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 4 23:38:46 EDT 2011
Author: neteler
Date: 2011-06-04 20:38:46 -0700 (Sat, 04 Jun 2011)
New Revision: 46566
Modified:
grass/branches/releasebranch_6_4/scripts/r.fillnulls/r.fillnulls
Log:
modernized MASK management to fix white space in path support
Modified: grass/branches/releasebranch_6_4/scripts/r.fillnulls/r.fillnulls
===================================================================
--- grass/branches/releasebranch_6_4/scripts/r.fillnulls/r.fillnulls 2011-06-04 07:31:29 UTC (rev 46565)
+++ grass/branches/releasebranch_6_4/scripts/r.fillnulls/r.fillnulls 2011-06-05 03:38:46 UTC (rev 46566)
@@ -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()
{
@@ -93,7 +89,8 @@
g.remove vect=${VECTTMP} > /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 > /dev/null
g.rename $USERMASK,MASK > /dev/null
fi
@@ -115,8 +112,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
@@ -124,8 +121,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 > /dev/null
fi
@@ -186,8 +183,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 > /dev/null
fi
@@ -203,8 +200,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 +221,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 > /dev/null
fi
More information about the grass-commit
mailing list