[GRASS-SVN] r45066 - grass/branches/develbranch_6/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 17 12:19:13 EST 2011
Author: martinl
Date: 2011-01-17 09:19:13 -0800 (Mon, 17 Jan 2011)
New Revision: 45066
Removed:
grass/branches/develbranch_6/lib/python/array.py
Modified:
grass/branches/develbranch_6/lib/python/Makefile
grass/branches/develbranch_6/lib/python/pythonlib.dox
Log:
array.py removed (broken, requires changes in r.in.bin)
Modified: grass/branches/develbranch_6/lib/python/Makefile
===================================================================
--- grass/branches/develbranch_6/lib/python/Makefile 2011-01-17 17:05:12 UTC (rev 45065)
+++ grass/branches/develbranch_6/lib/python/Makefile 2011-01-17 17:19:13 UTC (rev 45066)
@@ -10,7 +10,7 @@
GDIR = $(PYDIR)/grass
DSTDIR = $(GDIR)/script
-MODULES = core db raster vector array setup
+MODULES = core db raster vector setup
PYFILES := $(patsubst %,$(DSTDIR)/%.py,$(MODULES) __init__)
PYCFILES := $(patsubst %,$(DSTDIR)/%.pyc,$(MODULES) __init__)
Deleted: grass/branches/develbranch_6/lib/python/array.py
===================================================================
--- grass/branches/develbranch_6/lib/python/array.py 2011-01-17 17:05:12 UTC (rev 45065)
+++ grass/branches/develbranch_6/lib/python/array.py 2011-01-17 17:19:13 UTC (rev 45066)
@@ -1,115 +0,0 @@
-"""!@package grass.script.array
-
- at brief GRASS Python scripting module
-
-Functions to use GRASS rasters with NumPy.
-
-Usage:
-
- at code
-from grass.script import array as garray
-...
- at endcode
-
-(C) 2010 by Glynn Clements and the GRASS Development Team
-This program is free software under the GNU General Public
-License (>=v2). Read the file COPYING that comes with GRASS
-for details.
-
- at author Glynn Clements
-"""
-
-import os
-import numpy
-
-import core as grass
-
-# i18N
-import gettext
-gettext.install('grasslibs', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
-
-class array(numpy.memmap):
- def __new__(cls, dtype = numpy.double):
- reg = grass.region()
- r = reg['rows']
- c = reg['cols']
- shape = (r, c)
-
- filename = grass.tempfile()
-
- self = numpy.memmap.__new__(
- cls,
- filename = filename,
- dtype = dtype,
- mode = 'w+',
- shape = shape)
-
- self.filename = filename
- return self
-
- def _close(self):
- numpy.memmap._close(self)
- if isinstance(self, array):
- grass.try_remove(self.filename)
-
- def read(self, mapname, null = None):
- kind = self.dtype.kind
- size = self.dtype.itemsize
-
- if kind == 'f':
- flags = 'f'
- elif kind in 'biu':
- flags = 'i'
- else:
- raise ValueError(_('invalid kind <%s>') % kind)
-
- if size not in [1,2,4,8]:
- raise ValueError(_('invalid size <%d>') % size)
-
- return grass.run_command(
- 'r.out.bin',
- flags = flags,
- input = mapname,
- output = self.filename,
- bytes = size,
- null = null,
- quiet = True)
-
-
- def write(self, mapname, title = None, null = None, overwrite = None):
- kind = self.dtype.kind
- size = self.dtype.itemsize
-
- if kind == 'f':
- if size == 4:
- flags = 'f'
- elif size == 8:
- flags = 'd'
- else:
- raise ValueError(_('invalid FP size <%d>') % size)
- size = None
- elif kind in 'biu':
- if size not in [1,2,4]:
- raise ValueError(_('invalid integer size <%d>') % size)
- flags = None
- else:
- raise ValueError(_('invalid kind <%s>') % kind)
-
- reg = grass.region()
-
- return grass.run_command(
- 'r.in.bin',
- flags = flags,
- input = self.filename,
- output = mapname,
- title = title,
- bytes = size,
- anull = null,
- overwrite = overwrite,
- verbose = True,
- north = reg['n'],
- south = reg['s'],
- east = reg['e'],
- west = reg['w'],
- rows = reg['rows'],
- cols = reg['cols'])
Modified: grass/branches/develbranch_6/lib/python/pythonlib.dox
===================================================================
--- grass/branches/develbranch_6/lib/python/pythonlib.dox 2011-01-17 17:05:12 UTC (rev 45065)
+++ grass/branches/develbranch_6/lib/python/pythonlib.dox 2011-01-17 17:19:13 UTC (rev 45066)
@@ -1,4 +1,4 @@
-/*! \page pythonlib GRASS Python Scripting Library
+/*! \mainpage pythonlib GRASS Python Scripting Library
by GRASS Development Team (http://grass.osgeo.org)
More information about the grass-commit
mailing list