[GRASS-SVN] r71474 - grass/trunk/lib/python/docs/src
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 7 05:46:36 PDT 2017
Author: marisn
Date: 2017-09-07 05:46:36 -0700 (Thu, 07 Sep 2017)
New Revision: 71474
Modified:
grass/trunk/lib/python/docs/src/pygrass_raster.rst
Log:
PyGRASS docs: Better explain difference between _cols and .info.cols (clarifies r71472)
Modified: grass/trunk/lib/python/docs/src/pygrass_raster.rst
===================================================================
--- grass/trunk/lib/python/docs/src/pygrass_raster.rst 2017-09-07 12:07:46 UTC (rev 71473)
+++ grass/trunk/lib/python/docs/src/pygrass_raster.rst 2017-09-07 12:46:36 UTC (rev 71474)
@@ -76,14 +76,26 @@
>>> raster = reload(raster)
>>> elev = raster.RasterRow('elevation')
- >>> # the cols attribute is set from the current region only when the map is open
+ >>> # the private _cols attribute is set from the current region only when the map is open
+ >>> # the .info.cols attribute is set to total number of map cols only when the map is open
+ >>> # cols in .info.cols equals the number reported by r.info module
+ >>> elev._cols
>>> elev.info.cols
0
>>> elev.open()
>>> elev.is_open()
True
+ >>> elev._cols
+ 200
>>> elev.info.cols
1500
+ >>> elev._rows
+ 300
+ >>> # number of available rows/cols also can be determined by len()
+ >>> len(elev)
+ 300
+ >>> len(elev[0])
+ 200
>>> # we can read the elevation map, row by row
>>> for row in elev[:5]: print(row[:3])
[ 141.99613953 141.27848816 141.37904358]
More information about the grass-commit
mailing list