grass.pygrass.modules package

Submodules

grass.pygrass.modules.shortcuts module

class grass.pygrass.modules.shortcuts.MetaModule(prefix, cls=None)[source]

Bases: object

Example how to use MetaModule

>>> g = MetaModule('g')
>>> g_list = g.list
>>> g_list.name
'g.list'
>>> g_list.required
['type']
>>> g_list.inputs.type = 'raster'
>>> g_list.inputs.mapset = 'PERMANENT'
>>> g_list.stdout_ = -1
>>> g_list.run()
Module('g.list')
>>> g_list.outputs.stdout                         # doctest: +ELLIPSIS
'...basin...elevation...'
>>> r = MetaModule('r')
>>> what = r.what
>>> what.description
'Queries raster maps on their category values and category labels.'
>>> what.inputs.map = 'elevation'
>>> what.inputs.coordinates = [640000,220500]          # doctest: +SKIP
>>> what.run()                                         # doctest: +SKIP
>>> v = MetaModule('v')
>>> v.import                                      # doctest: +ELLIPSIS
  File "<doctest grass.pygrass.modules.shortcuts.MetaModule[16]>", line 1
   v.import
        ^
SyntaxError: invalid syntax
>>> v.import_
Module('v.import')