Skip to content

Commit

Permalink
Rename g.mlist to g.list and update g.remove usage
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62015 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
HuidaeCho committed Sep 17, 2014
1 parent ae34016 commit e1984e8
Show file tree
Hide file tree
Showing 125 changed files with 316 additions and 369 deletions.
8 changes: 4 additions & 4 deletions gui/wxpython/animation/g.gui.animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ <h2>EXAMPLES</h2>
</pre></div>

The loading of a series of maps into the Animation Tool can be simplified
with <em><a href="g.mlist.html">g.mlist<a></em> (back ticks syntax works for Linux and Mac only):
with <em><a href="g.list.html">g.list<a></em> (back ticks syntax works for Linux and Mac only):
<div class="code"><pre>
g.gui.animation rast=`g.mlist type=rast mapset=. separator=comma pattern="precip*"`
g.gui.animation rast=`g.list type=rast mapset=. separator=comma pattern="precip*"`
</pre></div>

Using extended regular expressions, the list of a series of raster maps can be subset by
e.g., numeric range (here: precipitation for the years 1997-2012):
<div class="code"><pre>
g.gui.animation rast=`g.mlist -e type=rast mapset=. separator=comma pattern="precip_total.(199[7-9]|200[0-9]|201[0-2]).sum"`
g.gui.animation rast=`g.list -e type=rast mapset=. separator=comma pattern="precip_total.(199[7-9]|200[0-9]|201[0-2]).sum"`
</pre></div>


Expand All @@ -85,7 +85,7 @@ <h2>SEE ALSO</h2>
<p>
<em>
<a href="g.gui.timeline.html">g.gui.timeline</a>,
<a href="g.mlist.html">g.mlist</a>
<a href="g.list.html">g.list</a>
</em>

<p>
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/core/globalvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ def UpdateGRASSAddOnCommands(eList = None):
"""@Toolbar icon size"""
toolbarSize = (24, 24)

"""@Is g.mlist available?"""
if 'g.mlist' in grassCmd:
have_mlist = True
"""@Is g.list available?"""
if 'g.list' in grassCmd:
have_list = True
else:
have_mlist = False
have_list = False

"""@Check version of wxPython, use agwStyle for 2.8.11+"""
hasAgw = CheckWxVersion()
Expand Down
9 changes: 6 additions & 3 deletions gui/wxpython/gmodeler/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,14 @@ def OnDeleteData(self, event):
dlg.Destroy()

if rast:
self._gconsole.RunCmd(['g.remove', 'rast=%s' %','.join(rast)])
self._gconsole.RunCmd(['g.remove', '-f', 'type=rast',
'pattern=%s' %','.join(rast)])
if rast3d:
self._gconsole.RunCmd(['g.remove', 'rast3d=%s' %','.join(rast3d)])
self._gconsole.RunCmd(['g.remove', '-f', 'type=rast3d',
'pattern=%s' %','.join(rast3d)])
if vect:
self._gconsole.RunCmd(['g.remove', 'vect=%s' %','.join(vect)])
self._gconsole.RunCmd(['g.remove', '-f', 'type=vect',
'pattern=%s' %','.join(vect)])

self.SetStatusText(_("%d maps deleted from current mapset") % \
int(len(rast) + len(rast3d) + len(vect)))
Expand Down
18 changes: 9 additions & 9 deletions gui/wxpython/gmodeler/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,11 +709,11 @@ def DeleteIntermediateData(self, log):
rast, vect, rast3d, msg = self.GetIntermediateData()

if rast:
log.RunCmd(['g.remove', 'rast=%s' %','.join(rast)])
log.RunCmd(['g.remove', '-f', 'type=rast', 'pattern=%s' %','.join(rast)])
if rast3d:
log.RunCmd(['g.remove', 'rast3d=%s' %','.join(rast3d)])
log.RunCmd(['g.remove', '-f', 'type=rast3d', 'pattern=%s' %','.join(rast3d)])
if vect:
log.RunCmd(['g.remove', 'vect=%s' %','.join(vect)])
log.RunCmd(['g.remove', '-f', 'type=vect', 'pattern=%s' %','.join(vect)])

def GetIntermediateData(self):
"""Get info about intermediate data"""
Expand Down Expand Up @@ -2338,18 +2338,18 @@ def cleanup():
""")
if rast:
self.fd.write(
r""" run_command('g.remove',
rast=%s)
r""" run_command('g.remove', flags='f', type='rast',
pattern=%s)
"""% ','.join(map(lambda x: "'" + x + "'", rast)))
if vect:
self.fd.write(
r""" run_command('g.remove',
vect = %s)
r""" run_command('g.remove', flags='f', type='vect',
pattern=%s)
"""% ','.join(map(lambda x: "'" + x + "'", vect)))
if rast3d:
self.fd.write(
r""" run_command('g.remove',
rast3d = %s)
r""" run_command('g.remove', flags='f', type='rast3d',
pattern=%s)
"""% ','.join(map(lambda x: "'" + x + "'", rast3d)))
if not rast and not vect and not rast3d:
self.fd.write(' pass\n')
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/gui_core/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ def GetMapLayers(self):
def GetLayerType(self, cmd = False):
"""Get selected layer type
:param bool cmd: True for g.mlist
:param bool cmd: True for g.list
"""
if not cmd:
return self.layerType.GetStringSelection()
Expand Down Expand Up @@ -1575,20 +1575,20 @@ def __init__(self, parent, title, **kwargs):

def _modelerDSeries(self):
self.dseries = wx.CheckBox(parent = self, id = wx.ID_ANY,
label = _("Dynamic series (%s)") % 'g.mlist')
label = _("Dynamic series (%s)") % 'g.list')
self.dseries.SetValue(False)
self.mainSizer.Add(item = self.dseries, proportion = 0,
flag = wx.EXPAND | wx.LEFT | wx.RIGHT, border = 5)

def GetDSeries(self):
"""Used by modeler only
:return: g.mlist command
:return: g.list command
"""
if not self.dseries or not self.dseries.IsChecked():
return ''

cond = 'map in `g.mlist type=%s ' % self.GetLayerType(cmd = True)
cond = 'map in `g.list type=%s ' % self.GetLayerType(cmd = True)
patt = self.filter.GetValue()
if patt:
cond += 'pattern=%s ' % patt
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/gselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def _getElementList(self, element, mapsets = None, elements = None, exclude = Fa
# get current mapset
curr_mapset = grass.gisenv()['MAPSET']

# map element types to g.mlist types
# map element types to g.list types
elementdict = {'cell':'rast',
'raster':'rast',
'rast':'rast',
Expand Down
8 changes: 6 additions & 2 deletions gui/wxpython/iclass/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ def RemoveTempVector(self):
"""Removes temporary vector map with training areas"""
ret = RunCommand(prog = 'g.remove',
parent = self,
vect = self.trainingAreaVector)
flags = 'f',
type = 'vect',
pattern = self.trainingAreaVector)
if ret != 0:
return False
return True
Expand All @@ -265,7 +267,9 @@ def RemoveTempRaster(self, raster):
self.GetSecondMap().Clean()
ret = RunCommand(prog = 'g.remove',
parent = self,
rast = raster)
flags = 'f',
type = 'rast',
pattern = raster)
if ret != 0:
return False
return True
Expand Down
11 changes: 5 additions & 6 deletions gui/wxpython/iscatt/iscatt_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ def _updateCatRast(self, bbox, areas_cats, updated_cats):
ret = UpdateCatRast(patch_rast, region, self.scatts_dt.GetCatRastCond(cat))
if ret < 0:
GException(_("Patching category raster conditions file failed."))
RunCommand("g.remove",
rast = patch_rast)
RunCommand("g.remove", flags='f', type='rast', pattern=patch_rast)

def _rasterize(self, grass_region, layer, cat, out_rast):

Expand Down Expand Up @@ -598,8 +597,8 @@ def DeleteCategory(self, cat_id):
grass.try_remove(self.cats_rasts_conds[cat_id])
del self.cats_rasts_conds[cat_id]

RunCommand("g.remove",
rast=self.cats_rasts[cat_id])
RunCommand("g.remove", flags='f', type='rast',
pattern=self.cats_rasts[cat_id])
del self.cats_rasts[cat_id]

return True
Expand Down Expand Up @@ -709,8 +708,8 @@ def CleanUp(self):
for tmp in self.cats_rasts_conds.itervalues():
grass.try_remove(tmp)
for tmp in self.cats_rasts.itervalues():
RunCommand("g.remove",
rast=tmp,
RunCommand("g.remove", flags='f',
type='rast', pattern=tmp,
getErrorMsg=True)

self.cats_rasts = {}
Expand Down
13 changes: 8 additions & 5 deletions gui/wxpython/lmgr/datacatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _initTreeItems(self, locations = [], mapsets = []):
self.ChangeEnvironment(location)
varloc = self.AppendItem(self.root, loc)
#get list of all maps in location
maplist = RunCommand('g.mlist', flags='mt', type='rast,rast3d,vect', mapset=','.join(mapsets),
maplist = RunCommand('g.list', flags='mt', type='rast,rast3d,vect', mapset=','.join(mapsets),
quiet=True, read=True)
maplist = maplist.splitlines()
for ml in maplist:
Expand Down Expand Up @@ -414,15 +414,18 @@ def OnDelete(self, event):
label = _("Deleting") + " " + string + " ..."
self.showNotification.emit(message=label)
if (self.GetItemText(self.selected_type)=='vect'):
removed = RunCommand('g.remove', vect=string)
removed = RunCommand('g.remove', flags='f', type='vect',
pattern=string)
elif (self.GetItemText(self.selected_type)=='rast'):
removed = RunCommand('g.remove', rast=string)
removed = RunCommand('g.remove', flags='f', type='rast',
pattern=string)
else:
removed = RunCommand('g.remove', rast3d=string)
removed = RunCommand('g.remove', flags='f', type='rast3d',
pattern=string)
if (removed==0):
self.Delete(self.selected_layer)
Debug.msg(1,"LAYER "+string+" DELETED")
label = "g.remove "+self.GetItemText(self.selected_type)+"="+string+" -- completed" # generate this message (command) automatically?
label = "g.remove -f type="+self.GetItemText(self.selected_type)+" pattern="+string+" -- completed" # generate this message (command) automatically?
self.showNotification.emit(message=label)
self.RestoreBackup()

Expand Down
3 changes: 2 additions & 1 deletion gui/wxpython/rlisetup/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def convertFeature(vect, outrast, cat, origrast):
grass.run_command('g.region', vect=tmp_vect, align=origrast)
grass.run_command('v.to.rast', input=vect, output=outrast, use='cat',
cats=cat, overwrite=True, quiet=True)
grass.run_command('g.remove', vect=tmp_vect, quiet=True)
grass.run_command('g.remove', flags='f', type='vect',
pattern=tmp_vect, quiet=True)


def obtainAreaVector(outrast):
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/rlisetup/sampling_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ def writeArea(self, coords, rasterName):

marea = MaskedArea(region, rasterName)

RunCommand('g.remove', rast=tmpraster)
RunCommand('g.remove', vect=tmpvector)
RunCommand('g.remove', flags='f', type='rast', pattern=tmpraster)
RunCommand('g.remove', flags='f', type='vect', pattern=tmpvector)

os.unlink(polyfile.name)
return marea
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/vnet/vnet_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def RunAnalysis(self):

# for case there is some map with same name
# (when analysis does not produce any map, this map would have been shown as result)
RunCommand('g.remove',
vect = self.results["vect_map"].GetVectMapName())
RunCommand('g.remove', flags = 'f', type = 'vect',
pattern = self.results["vect_map"].GetVectMapName())

# save data from
self.history._saveAnInputToHist(analysis, params, flags)
Expand Down
8 changes: 4 additions & 4 deletions gui/wxpython/vnet/vnet_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,8 +938,8 @@ def DeleteTmpMap(self, vectMap):
"""
if vectMap:
vectMap.DeleteRenderLayer()
RunCommand('g.remove',
vect = vectMap.GetVectMapName())
RunCommand('g.remove', flags = 'f', type = 'vect',
pattern = vectMap.GetVectMapName())
self.RemoveFromTmpMaps(vectMap)
return True
return False
Expand All @@ -948,8 +948,8 @@ def DeleteAllTmpMaps(self):
"""Delete all temporary maps in the class"""
update = False
for tmpMap in self.tmpMaps:
RunCommand('g.remove',
vect = tmpMap.GetVectMapName())
RunCommand('g.remove', flags = 'f', type = 'vect',
pattern = tmpMap.GetVectMapName())
if tmpMap.DeleteRenderLayer():
update = True
return update
Expand Down
6 changes: 0 additions & 6 deletions gui/wxpython/xml/toolboxes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,6 @@
<module-item name="g.list">
<label>List</label>
</module-item>
<module-item name="g.mlist">
<label>List filtered</label>
</module-item>
<separator/>
<module-item name="g.rename">
<label>Rename</label>
Expand All @@ -529,9 +526,6 @@
<module-item name="g.remove">
<label>Delete</label>
</module-item>
<module-item name="g.mremove">
<label>Delete filtered</label>
</module-item>
</items>
</toolbox>
<toolbox name="MapTypeConversions">
Expand Down
6 changes: 3 additions & 3 deletions lib/gpde/test/test_arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ int io_bench_2d(void)


sprintf(buff,
"g.remove rast=gpde_lib_test_raster_1,gpde_lib_test_raster_2,gpde_lib_test_raster_3");
"g.remove -f type=rast pattern=gpde_lib_test_raster_1,gpde_lib_test_raster_2,gpde_lib_test_raster_3");
system(buff);

N_free_array_2d(data1);
Expand Down Expand Up @@ -588,7 +588,7 @@ int test_array_2d(void)


sprintf(buff,
"g.remove rast=gpde_lib_test_raster_1,gpde_lib_test_raster_2,gpde_lib_test_raster_3");
"g.remove -f type=rast pattern=gpde_lib_test_raster_1,gpde_lib_test_raster_2,gpde_lib_test_raster_3");
system(buff);


Expand Down Expand Up @@ -857,7 +857,7 @@ int test_array_3d(void)
N_free_array_3d(tmp);

sprintf(buff,
"g.remove rast3d=gpde_lib_test_volume_1,gpde_lib_test_volume_2");
"g.remove -f type=rast3d pattern=gpde_lib_test_volume_1,gpde_lib_test_volume_2");
system(buff);

N_free_array_3d(data1);
Expand Down
3 changes: 1 addition & 2 deletions lib/manage/managelib.dox
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ by GRASS Development Team (http://grass.osgeo.org)
\section manageintro Introduction

This library used for management of data base elements. See modules
<tt>g.list, g.mlist, g.remove, g.mremove, g.copy</tt> or
<tt>g.rename</tt>.
<tt>g.list, g.remove, g.copy</tt> or <tt>g.rename</tt>.

\code
#include <grass/manage.h>
Expand Down
Loading

0 comments on commit e1984e8

Please sign in to comment.