|
@@ -53,19 +53,17 @@ class Category(list):
|
|
|
|
|
|
>>> 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()
|