[GRASS-SVN] r37498 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 26 06:19:33 EDT 2009
Author: martinl
Date: 2009-05-26 06:19:33 -0400 (Tue, 26 May 2009)
New Revision: 37498
Modified:
grass/trunk/lib/python/db.py
grass/trunk/lib/python/grasspythonlib.dox
grass/trunk/lib/python/raster.py
grass/trunk/lib/python/vector.py
Log:
grass.script doxygen updated (db, raster, vector)
Modified: grass/trunk/lib/python/db.py
===================================================================
--- grass/trunk/lib/python/db.py 2009-05-26 09:03:43 UTC (rev 37497)
+++ grass/trunk/lib/python/db.py 2009-05-26 10:19:33 UTC (rev 37498)
@@ -28,8 +28,16 @@
def db_describe(table, **args):
"""Return the list of columns for a database table
- (interface to `db.describe -c').
+ (interface to `db.describe -c'). Example:
+ \code
+ >>> grass.db_describe('lakes')
+ {'nrows': 15279, 'cols': [['cat', 'INTEGER', '11'], ['AREA', 'DOUBLE PRECISION', '20'],
+ ['PERIMETER', 'DOUBLE PRECISION', '20'], ['FULL_HYDRO', 'DOUBLE PRECISION', '20'],
+ ['FULL_HYDR2', 'DOUBLE PRECISION', '20'], ['FTYPE', 'CHARACTER', '24'],
+ ['FCODE', 'INTEGER', '11'], ['NAME', 'CHARACTER', '99']], 'ncols': 8}
+ \endcode
+
@param table table name
@param args
@@ -58,7 +66,14 @@
def db_connection():
"""Return the current database connection parameters
- (interface to `db.connect -p').
+ (interface to `db.connect -p'). Example:
+
+ \code
+ >>> grass.db_connection()
+ {'group': 'x', 'schema': '', 'driver': 'dbf', 'database': '$GISDBASE/$LOCATION_NAME/$MAPSET/dbf/'}
+ \endcode
+
+ @return parsed output of db.connect
"""
s = read_command('db.connect', flags = 'p')
return parse_key_val(s, sep = ':')
Modified: grass/trunk/lib/python/grasspythonlib.dox
===================================================================
--- grass/trunk/lib/python/grasspythonlib.dox 2009-05-26 09:03:43 UTC (rev 37497)
+++ grass/trunk/lib/python/grasspythonlib.dox 2009-05-26 10:19:33 UTC (rev 37498)
@@ -189,5 +189,49 @@
- float_or_dms()
+\section db Database
+
+Interface for <tt>db.*</tt> modules.
+
+\code
+from grass.script import db as grass
+\endcode
+
+ - db_connection()
+
+ - db_describe()
+
+\section raster Raster
+
+Interface for <tt>r.*</tt> modules.
+
+\code
+from grass.script import raster as grass
+\endcode
+
+ - raster_history()
+
+ - raster_info()
+
+ - mapcalc()
+
+\section vector Vector
+
+Interface for <tt>v.*</tt> modules.
+
+\code
+from grass.script import vector as grass
+\endcode
+
+ - vector_columns()
+
+ - vector_db()
+
+ - vector_history()
+
+ - vector_info_topo()
+
+ - vector_layer_db()
+
*/
Modified: grass/trunk/lib/python/raster.py
===================================================================
--- grass/trunk/lib/python/raster.py 2009-05-26 09:03:43 UTC (rev 37497)
+++ grass/trunk/lib/python/raster.py 2009-05-26 10:19:33 UTC (rev 37498)
@@ -51,11 +51,21 @@
# run "r.info -rgstmpud ..." and parse output
def raster_info(map):
- """Return information about a raster map (interface to `r.info').
+ """Return information about a raster map (interface to
+ `r.info'). Example:
+ \code
+ >>> grass.raster_info('elevation')
+ {'north': 228500.0, 'timestamp': '"none"', 'min': 55.578792572021499,
+ 'datatype': 'FCELL', 'max': 156.32986450195301, 'ewres': 10.0,
+ 'vertical_datum': '', 'west': 630000.0, 'units': '',
+ 'title': 'South-West Wake county: Elevation NED 10m (elev_ned10m)',
+ 'east': 645000.0, 'nsres': 10.0, 'south': 215000.0}
+ \endcode
+
@param map map name
- @return parsed modile output
+ @return parsed raster info
"""
s = read_command('r.info', flags = 'rgstmpud', map = map)
kv = parse_key_val(s)
Modified: grass/trunk/lib/python/vector.py
===================================================================
--- grass/trunk/lib/python/vector.py 2009-05-26 09:03:43 UTC (rev 37497)
+++ grass/trunk/lib/python/vector.py 2009-05-26 10:19:33 UTC (rev 37498)
@@ -32,7 +32,14 @@
def vector_db(map, **args):
"""Return the database connection details for a vector map
- (interface to `v.db.connect -g').
+ (interface to `v.db.connect -g'). Example:
+
+ \code
+ >>> grass.vector_db('lakes')
+ {1: {'layer': '1', 'name': '',
+ 'database': '/home/martin/grassdata/nc_spm_08/PERMANENT/dbf/',
+ 'driver': 'dbf', 'key': 'cat', 'table': 'lakes'}}
+ \endcode
@param map vector map
@param args
@@ -117,8 +124,16 @@
# run "v.info -t" and parse output
def vector_info_topo(map):
- """Return information about a vector map (interface to `v.info -t').
+ """Return information about a vector map (interface to `v.info
+ -t'). Example:
+ \code
+ >>> grass.vector_info_topo('lakes')
+ {'kernels': 0, 'lines': 0, 'centroids': 15279,
+ 'boundaries': 27764, 'points': 0, 'faces': 0,
+ 'primitives': 43043, 'islands': 7470, 'nodes': 35234, 'map3d': 0, 'areas': 15279}
+ \endcode
+
@param map map name
@return parsed output
More information about the grass-commit
mailing list