[GRASS-SVN] r59192 - grass/trunk/lib/python/pygrass/raster
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 4 07:23:21 PST 2014
Author: zarch
Date: 2014-03-04 07:23:21 -0800 (Tue, 04 Mar 2014)
New Revision: 59192
Modified:
grass/trunk/lib/python/pygrass/raster/__init__.py
Log:
Before closing the RasterNumpy class check if is open or not and add an additional parameter to set the name of the raster map.
Modified: grass/trunk/lib/python/pygrass/raster/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/__init__.py 2014-03-04 09:41:21 UTC (rev 59191)
+++ grass/trunk/lib/python/pygrass/raster/__init__.py 2014-03-04 15:23:21 UTC (rev 59192)
@@ -640,10 +640,15 @@
# if the map is open or not
self._fd = 1
- def close(self):
- self._write()
- os.remove(self.filename)
- self._fd = None
+ def close(self, name=''):
+ if self.is_open():
+ name = name if name else self.name
+ if not name:
+ raise RuntimeError('Raster name not set neither '
+ 'given as parameter.')
+ self._write()
+ os.remove(self.filename)
+ self._fd = None
def get_value(self, point, region=None):
"""This method returns the pixel value of a given pair of coordinates:
More information about the grass-commit
mailing list