[GRASS-SVN] r45901 - grass/branches/develbranch_6/doc/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Apr 10 19:57:01 EDT 2011
Author: hamish
Date: 2011-04-10 16:57:01 -0700 (Sun, 10 Apr 2011)
New Revision: 45901
Modified:
grass/branches/develbranch_6/doc/python/raster_example_ctypes.py
Log:
grass 6 libgis fn names
Modified: grass/branches/develbranch_6/doc/python/raster_example_ctypes.py
===================================================================
--- grass/branches/develbranch_6/doc/python/raster_example_ctypes.py 2011-04-10 22:39:47 UTC (rev 45900)
+++ grass/branches/develbranch_6/doc/python/raster_example_ctypes.py 2011-04-10 23:57:01 UTC (rev 45901)
@@ -40,7 +40,7 @@
sys.exit("Raster map <%s> not found" % input)
# determine the inputmap type (CELL/FCELL/DCELL)
-data_type = Rast_map_type(input, mapset)
+data_type = G_raster_map_type(input, mapset)
if data_type == CELL_TYPE:
ptype = POINTER(c_int)
@@ -54,24 +54,24 @@
print "Raster map <%s> contains data type %s." % (input, type_name)
-in_fd = Rast_open_old(input, mapset)
-in_rast = Rast_allocate_buf(data_type)
+in_fd = G_open_cell_old(input, mapset)
+in_rast = G_allocate_raster_buf(data_type)
in_rast = cast(c_void_p(in_rast), ptype)
-rows = Rast_window_rows()
-cols = Rast_window_cols()
+rows = G_window_rows()
+cols = G_window_cols()
print "Current region is %d rows x %d columns" % (rows, cols)
# iterate through map rows
print "Map data:"
for row_n in xrange(rows):
# read a row of raster data into memory, then print it
- Rast_get_row(in_fd, in_rast, row_n, data_type)
+ G_get_raster_row(in_fd, in_rast, row_n, data_type)
print row_n, in_rast[0:cols]
# TODO check for NULL
# closed map and cleanup memory allocation
-Rast_close(in_fd)
+G_close_cell(in_fd)
G_free(in_rast)
def check_null(value):
More information about the grass-commit
mailing list