[GRASS-SVN] r61148 - grass/trunk/lib/python/pygrass/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 4 00:56:38 PDT 2014
Author: zarch
Date: 2014-07-04 00:56:38 -0700 (Fri, 04 Jul 2014)
New Revision: 61148
Modified:
grass/trunk/lib/python/pygrass/gis/region.py
Log:
pygrass: Add documentation and indent code blocks
Modified: grass/trunk/lib/python/pygrass/gis/region.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/region.py 2014-07-04 06:27:14 UTC (rev 61147)
+++ grass/trunk/lib/python/pygrass/gis/region.py 2014-07-04 07:56:38 UTC (rev 61148)
@@ -15,11 +15,11 @@
class Region(object):
- """
- ::
+ """This class is design to easily access and modify GRASS computational
+ region. ::
>>> default = Region(default=True)
- >>> current_good = Region()
+ >>> current_original = Region()
>>> current = Region()
>>> current.align('elevation')
>>> default == current
@@ -41,7 +41,7 @@
>>> default = Region(default=True)
>>> default == current
True
- >>> current_good.set_current()
+ >>> current_original.set_current()
..
"""
@@ -233,11 +233,27 @@
return True
def keys(self):
+ """Return a list of valid keys. ::
+
+ >>> reg = Region()
+ >>> reg.keys() # doctest: +ELLIPSIS
+ [u'proj', u'zone', ..., u'cols', u'cells']
+
+ ..
+ """
return ['proj', 'zone', 'north', 'south', 'west', 'east',
'top', 'bottom', 'nsres', 'ewres', 'tbres', 'rows',
'cols', 'cells']
def items(self):
+ """Return a list of tuple with key and value. ::
+
+ >>> reg = Region()
+ >>> reg.items() # doctest: +ELLIPSIS
+ [(u'proj', 99), ..., (u'cells', 2025000)]
+
+ ..
+ """
return [(k, self.__getattribute__(k)) for k in self.keys()]
#----------METHODS----------
@@ -274,11 +290,11 @@
::
- >>> reg = Region()
- >>> reg.vect('census')
- >>> reg.get_bbox()
- Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
- >>> reg.get_default()
+ >>> reg = Region()
+ >>> reg.vect('census')
+ >>> reg.get_bbox()
+ Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
+ >>> reg.get_default()
..
"""
@@ -313,11 +329,11 @@
raise GrassError("Cannot change region (DEFAUL_WIND file).")
def get_bbox(self):
- """Return a Bbox object with the extension of the region ::
+ """Return a Bbox object with the extension of the region. ::
- >>> reg = Region()
- >>> reg.get_bbox()
- Bbox(228500.0, 215000.0, 645000.0, 630000.0)
+ >>> reg = Region()
+ >>> reg.get_bbox()
+ Bbox(228500.0, 215000.0, 645000.0, 630000.0)
..
"""
@@ -334,13 +350,13 @@
::
- >>> from grass.pygrass.vector.basic import Bbox
- >>> b = Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
- >>> reg = Region()
- >>> reg.set_bbox(b)
- >>> reg.get_bbox()
- Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
- >>> reg.get_current()
+ >>> from grass.pygrass.vector.basic import Bbox
+ >>> b = Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
+ >>> reg = Region()
+ >>> reg.set_bbox(b)
+ >>> reg.get_bbox()
+ Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
+ >>> reg.get_current()
..
"""
More information about the grass-commit
mailing list