[GRASS-SVN] r63630 - in grass/trunk: gui/wxpython/lmgr gui/wxpython/psmap raster/r.mapcalc/testsuite scripts/d.rast.edit scripts/i.in.spotvgt scripts/r.fillnulls scripts/r.mask scripts/v.rast.stats testsuite/raster
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Dec 19 14:17:15 PST 2014
Author: neteler
Date: 2014-12-19 14:17:15 -0800 (Fri, 19 Dec 2014)
New Revision: 63630
Modified:
grass/trunk/gui/wxpython/lmgr/datacatalog.py
grass/trunk/gui/wxpython/psmap/dialogs.py
grass/trunk/gui/wxpython/psmap/utils.py
grass/trunk/raster/r.mapcalc/testsuite/const_map_test.sh
grass/trunk/scripts/d.rast.edit/d.rast.edit.py
grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py
grass/trunk/scripts/r.fillnulls/r.fillnulls.py
grass/trunk/scripts/r.mask/r.mask.py
grass/trunk/scripts/v.rast.stats/v.rast.stats.py
grass/trunk/testsuite/raster/raster_md5test.sh
Log:
update g.region/g.rename calls to use new element names (#2409)
Modified: grass/trunk/gui/wxpython/lmgr/datacatalog.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/datacatalog.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/gui/wxpython/lmgr/datacatalog.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -352,11 +352,11 @@
label = _("Renaming") + " " + string + " ..."
self.showNotification.emit(message=label)
if (self.GetItemText(self.selected_type)=='vector'):
- renamed = RunCommand('g.rename', vect=string)
+ renamed = RunCommand('g.rename', vector=string)
elif (self.GetItemText(self.selected_type)=='raster'):
- renamed = RunCommand('g.rename', rast=string)
+ renamed = RunCommand('g.rename', raster=string)
else:
- renamed = RunCommand('g.rename', rast3d=string)
+ renamed = RunCommand('g.rename', raster3d=string)
if (renamed==0):
self.SetItemText(self.selected_layer,self.new_name)
label = "g.rename "+self.GetItemText(self.selected_type)+"="+string+" -- completed"
Modified: grass/trunk/gui/wxpython/psmap/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/dialogs.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/gui/wxpython/psmap/dialogs.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -1014,7 +1014,7 @@
mapFrameDict['center'] = self.center[0]
# set region
if self.mapType == 'raster':
- RunCommand('g.region', rast = mapFrameDict['map'])
+ RunCommand('g.region', raster = mapFrameDict['map'])
if self.mapType == 'vector':
raster = self.instruction.FindInstructionByType('raster')
if raster:
@@ -1024,9 +1024,9 @@
if rasterId:
- RunCommand('g.region', vect = mapFrameDict['map'], rast = self.instruction[rasterId]['raster'])
+ RunCommand('g.region', vector = mapFrameDict['map'], raster = self.instruction[rasterId]['raster'])
else:
- RunCommand('g.region', vect = mapFrameDict['map'])
+ RunCommand('g.region', vector = mapFrameDict['map'])
Modified: grass/trunk/gui/wxpython/psmap/utils.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/utils.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/gui/wxpython/psmap/utils.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -203,11 +203,11 @@
res = ''
if mapType == 'raster':
try:
- res = grass.read_command("g.region", flags = 'gu', rast = map)
+ res = grass.read_command("g.region", flags = 'gu', raster = map)
except grass.ScriptError:
pass
elif mapType == 'vector':
- res = grass.read_command("g.region", flags = 'gu', vect = map)
+ res = grass.read_command("g.region", flags = 'gu', vector = map)
currRegionDict = grass.parse_key_val(res, val_type = float)
elif scaleType == 1 and region: # saved region
res = grass.read_command("g.region", flags = 'gu', region = region)
Modified: grass/trunk/raster/r.mapcalc/testsuite/const_map_test.sh
===================================================================
--- grass/trunk/raster/r.mapcalc/testsuite/const_map_test.sh 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/raster/r.mapcalc/testsuite/const_map_test.sh 2014-12-19 22:17:15 UTC (rev 63630)
@@ -52,7 +52,7 @@
if test -f $LOCATION/cell/MASK
then
echo "A user raster mask (MASK) is present. Saving it..."
- g.rename MASK,$USERMASK > /dev/null
+ g.rename raster=MASK,$USERMASK > /dev/null
fi
finalcleanup()
@@ -64,7 +64,7 @@
if test -f $LOCATION/cell/$USERMASK ; then
echo "Restoring user MASK"
g.remove -f type=raster name=MASK > /dev/null
- g.rename $USERMASK,MASK > /dev/null
+ g.rename raster=$USERMASK,MASK > /dev/null
fi
}
@@ -112,7 +112,7 @@
if test -f $LOCATION/cell/MASK
then
echo "A user raster mask (MASK) is present. Saving it..."
- g.rename MASK,$USERMASK > /dev/null
+ g.rename raster=MASK,$USERMASK > /dev/null
check_exit_status $?
fi
Modified: grass/trunk/scripts/d.rast.edit/d.rast.edit.py
===================================================================
--- grass/trunk/scripts/d.rast.edit/d.rast.edit.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/scripts/d.rast.edit/d.rast.edit.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -471,7 +471,7 @@
def initialize(self):
grass.use_temp_region()
- run('g.region', rast = self.inmap)
+ run('g.region', raster = self.inmap)
reg = grass.region()
for k, f in wind_keys.values():
@@ -526,7 +526,7 @@
outf.close()
p.wait()
- run('g.region', rast = self.inmap)
+ run('g.region', raster = self.inmap)
run('r.patch', input = (self.tempmap, self.outmap), output = self.outmap, overwrite = True)
run('r.colors', map = self.outmap, rast = self.inmap)
run('g.remove', flags = 'f', type = 'rast', name = self.tempmap)
Modified: grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py
===================================================================
--- grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -175,13 +175,13 @@
# switch to a temporary region
grass.use_temp_region()
- grass.run_command('g.region', rast = name, quiet = True)
+ grass.run_command('g.region', raster = name, quiet = True)
grass.message(_("Remapping digital numbers to NDVI..."))
tmpname = "%s_%s" % (name, pid)
grass.mapcalc("$tmpname = 0.004 * $name - 0.1", tmpname = tmpname, name = name)
- grass.run_command('g.remove', flags = 'f', type = 'rast', name = name, quiet = True)
- grass.run_command('g.rename', rast = (tmpname, name), quiet = True)
+ grass.run_command('g.remove', type = 'rast', name = name, quiet = True, flags = 'f')
+ grass.run_command('g.rename', raster = (tmpname, name), quiet = True)
# write cmd history:
grass.raster_history(name)
Modified: grass/trunk/scripts/r.fillnulls/r.fillnulls.py
===================================================================
--- grass/trunk/scripts/r.fillnulls/r.fillnulls.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/scripts/r.fillnulls/r.fillnulls.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -106,7 +106,7 @@
grass.run_command('g.remove', quiet = True, flags = 'fb', type = 'rast', name = tmp_rmaps)
if usermask and mapset:
if grass.find_file(usermask, mapset = mapset)['file']:
- grass.run_command('g.rename', quiet = True, rast = (usermask, 'MASK'), overwrite = True)
+ grass.run_command('g.rename', quiet = True, raster = (usermask, 'MASK'), overwrite = True)
def main():
global usermask, mapset, tmp_rmaps, tmp_vmaps
@@ -139,7 +139,7 @@
if grass.find_file('MASK', mapset = mapset)['file']:
usermask = "usermask_mask." + unique
grass.message(_("A user raster mask (MASK) is present. Saving it..."))
- grass.run_command('g.rename', quiet = quiet, rast = ('MASK',usermask))
+ grass.run_command('g.rename', quiet = quiet, raster = ('MASK',usermask))
#check if method is rst to use v.surf.rst
if method == 'rst':
@@ -171,7 +171,7 @@
if usermask:
grass.message(_("Restoring user mask (MASK)..."))
try:
- grass.run_command('g.rename', quiet=quiet, rast=(usermask, 'MASK'))
+ grass.run_command('g.rename', quiet=quiet, raster = (usermask, 'MASK'))
except CalledModuleError:
grass.warning(_("Failed to restore user MASK!"))
usermask = None
@@ -242,7 +242,7 @@
# zoom to specific hole with a buffer of two cells around the hole to remove rest of data
try:
grass.run_command('g.region',
- vect=holename + '_pol', align=input,
+ vector=holename + '_pol', align=input,
w = 'w-%d' % (edge * 2 * ew_res),
e = 'e+%d' % (edge * 2 * ew_res),
n = 'n+%d' % (edge * 2 * ns_res),
@@ -333,18 +333,18 @@
# append hole result to interpolated version later used to patch into original DEM
if first:
tmp_rmaps.append(filling)
- grass.run_command('g.region', align = input, rast = holename + '_dem', quiet = quiet)
+ grass.run_command('g.region', align = input, raster = holename + '_dem', quiet = quiet)
grass.mapcalc("$out = if(isnull($inp), null(), $dem)",
out = filling, inp = holename, dem = holename + '_dem')
first = False
else:
tmp_rmaps.append(filling + '_tmp')
- grass.run_command('g.region', align = input, rast = (filling, holename + '_dem'), quiet = quiet)
+ grass.run_command('g.region', align = input, raster = (filling, holename + '_dem'), quiet = quiet)
grass.mapcalc("$out = if(isnull($inp), if(isnull($fill), null(), $fill), $dem)",
out = filling + '_tmp', inp = holename, dem = holename + '_dem', fill = filling)
try:
grass.run_command('g.rename',
- rast=(filling + '_tmp', filling),
+ raster=(filling + '_tmp', filling),
overwrite=True, quiet=quiet)
except CalledModuleError:
grass.fatal(_("abandoned. Removing temporary maps, restoring user mask if needed:"))
@@ -403,7 +403,7 @@
if usermask:
grass.message(_("Restoring user mask (MASK)..."))
try:
- grass.run_command('g.rename', quiet=quiet, rast=(usermask, 'MASK'))
+ grass.run_command('g.rename', quiet=quiet, raster=(usermask, 'MASK'))
except CalledModuleError:
grass.warning(_("Failed to restore user MASK!"))
usermask = None
Modified: grass/trunk/scripts/r.mask/r.mask.py
===================================================================
--- grass/trunk/scripts/r.mask/r.mask.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/scripts/r.mask/r.mask.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -166,7 +166,7 @@
if invert:
global tmp
tmp = "r_mask_%d" % os.getpid()
- grass.run_command('g.rename', rast = ('MASK', tmp), quiet = True)
+ grass.run_command('g.rename', raster = ('MASK', tmp), quiet = True)
grass.message(_("Creating inverted raster MASK..."))
grass.mapcalc("MASK = if(isnull($tmp), 1, null())", tmp = tmp)
grass.verbose(_("Inverted raster MASK created"))
Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats.py
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats.py 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats.py 2014-12-19 22:17:15 UTC (rev 63630)
@@ -76,7 +76,7 @@
name='MASK', quiet=True, stderr=nuldev)
if mask_found:
grass.message(_("Restoring previous MASK..."))
- grass.run_command('g.rename', rast=(tmpname + "_origmask", 'MASK'),
+ grass.run_command('g.rename', raster=(tmpname + "_origmask", 'MASK'),
quiet=True)
# for f in [tmp, tmpname, sqltmp]:
# grass.try_remove(f)
@@ -127,7 +127,7 @@
mask_found = bool(grass.find_file('MASK', 'cell')['file'])
if mask_found:
grass.message(_("Raster MASK found, temporarily disabled"))
- grass.run_command('g.rename', rast=('MASK', tmpname + "_origmask"),
+ grass.run_command('g.rename', raster=('MASK', tmpname + "_origmask"),
quiet=True)
# save current settings:
Modified: grass/trunk/testsuite/raster/raster_md5test.sh
===================================================================
--- grass/trunk/testsuite/raster/raster_md5test.sh 2014-12-19 21:55:37 UTC (rev 63629)
+++ grass/trunk/testsuite/raster/raster_md5test.sh 2014-12-19 22:17:15 UTC (rev 63630)
@@ -57,7 +57,7 @@
if test -f $LOCATION/cell/MASK
then
echo "A user raster mask (MASK) is present. Saving it..."
- g.rename MASK,$USERMASK > /dev/null
+ g.rename raster=MASK,$USERMASK > /dev/null
fi
finalcleanup()
@@ -69,7 +69,7 @@
if test -f $LOCATION/cell/$USERMASK ; then
echo "Restoring user MASK"
g.remove -f type=raster name=MASK > /dev/null
- g.rename $USERMASK,MASK > /dev/null
+ g.rename raster=$USERMASK,MASK > /dev/null
fi
}
More information about the grass-commit
mailing list