[GRASS-SVN] r37500 - grass/branches/releasebranch_6_4/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 26 06:25:47 EDT 2009
Author: martinl
Date: 2009-05-26 06:25:47 -0400 (Tue, 26 May 2009)
New Revision: 37500
Modified:
grass/branches/releasebranch_6_4/lib/python/db.py
grass/branches/releasebranch_6_4/lib/python/grasspythonlib.dox
grass/branches/releasebranch_6_4/lib/python/raster.py
grass/branches/releasebranch_6_4/lib/python/vector.py
Log:
grass.script doxygen updated (db, raster, vector)
(merge from devbr6, r37499)
Modified: grass/branches/releasebranch_6_4/lib/python/db.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/db.py 2009-05-26 10:24:21 UTC (rev 37499)
+++ grass/branches/releasebranch_6_4/lib/python/db.py 2009-05-26 10:25:47 UTC (rev 37500)
@@ -30,7 +30,20 @@
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
+
+ @return parsed module output
"""
s = read_command('db.describe', flags = 'c', table = table, **args)
if not s:
@@ -55,7 +68,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/branches/releasebranch_6_4/lib/python/grasspythonlib.dox
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/grasspythonlib.dox 2009-05-26 10:24:21 UTC (rev 37499)
+++ grass/branches/releasebranch_6_4/lib/python/grasspythonlib.dox 2009-05-26 10:25:47 UTC (rev 37500)
@@ -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/branches/releasebranch_6_4/lib/python/raster.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/raster.py 2009-05-26 10:24:21 UTC (rev 37499)
+++ grass/branches/releasebranch_6_4/lib/python/raster.py 2009-05-26 10:25:47 UTC (rev 37500)
@@ -49,7 +49,22 @@
# 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 raster info
+ """
s = read_command('r.info', flags = 'rgstmpud', map = map)
kv = parse_key_val(s)
for k in ['min', 'max', 'north', 'south', 'east', 'west']:
Modified: grass/branches/releasebranch_6_4/lib/python/vector.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/vector.py 2009-05-26 10:24:21 UTC (rev 37499)
+++ grass/branches/releasebranch_6_4/lib/python/vector.py 2009-05-26 10:25:47 UTC (rev 37500)
@@ -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
@@ -100,6 +107,19 @@
# 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
+ """
s = read_command('v.info', flags = 't', map = map)
return parse_key_val(s, val_type = int)
More information about the grass-commit
mailing list