[GRASS-SVN] r61879 - grass/trunk/lib/python/pygrass/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 12 08:42:07 PDT 2014


Author: zarch
Date: 2014-09-12 08:42:07 -0700 (Fri, 12 Sep 2014)
New Revision: 61879

Modified:
   grass/trunk/lib/python/pygrass/raster/category.py
Log:
pygrass: Fix doctest.

Modified: grass/trunk/lib/python/pygrass/raster/category.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/category.py	2014-09-12 15:41:49 UTC (rev 61878)
+++ grass/trunk/lib/python/pygrass/raster/category.py	2014-09-12 15:42:07 UTC (rev 61879)
@@ -53,19 +53,17 @@
 
     >>> import grass.lib.raster as libraster
     >>> import ctypes
-    >>> import grass.pygrass as pygrass
-    >>> land = pygrass.raster.RasterRow('geology')
-    >>> cats = pygrass.raster.Category()
-    >>> cats.read(land) # or with cats.read(land.name, land.mapset, land.mtype)
-    >>> cats.labels()
-    ['pond', 'forest', 'developed', 'bare', 'paved road', 'dirt road',
-        'vineyard', 'agriculture', 'wetland', 'bare ground path', 'grass']
-    >>> min_cat = ctypes.c_void_p()
-    >>> max_cat = ctypes.c_void_p()
-    >>> libraster.Rast_get_ith_c_cat(ctypes.byref(cats.cats), 0,
-    ...                              min_cat, max_cat)
+    >>> from grass.pygrass.raster.category import Category
+    >>> cats = Category('landuse')
+    >>> cats.read()
+    >>> cats.labels()                                     # doctest: +ELLIPSIS
+    ['undefined', 'developed', 'agriculture', ..., 'water', 'sediment']
+    >>> cats[0]
+    ('undefined', 0, None)
+    >>> cats[1]
+    ('developed', 1, None)
     """
-    def __init__(self, name, mapset='', mtype=None, *args, **kargs):
+    def __init__(self, name, mapset='', mtype='CELL', *args, **kargs):
         self.name = name
         self.mapset = mapset
         self.c_cats = libraster.Categories()



More information about the grass-commit mailing list