[GRASS-SVN] r44049 - grass/trunk/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 26 10:35:13 EDT 2010
Author: glynn
Date: 2010-10-26 07:35:13 -0700 (Tue, 26 Oct 2010)
New Revision: 44049
Modified:
grass/trunk/lib/python/raster.py
Log:
Fix raster_info() to handle min/max = NULL.
Modified: grass/trunk/lib/python/raster.py
===================================================================
--- grass/trunk/lib/python/raster.py 2010-10-25 23:29:15 UTC (rev 44048)
+++ grass/trunk/lib/python/raster.py 2010-10-26 14:35:13 UTC (rev 44049)
@@ -70,9 +70,18 @@
@return parsed raster info
"""
+
+ def float_or_null(s):
+ if s == 'NULL':
+ return None
+ else:
+ return float(s)
+
s = read_command('r.info', flags = 'rgstmpud', map = map)
kv = parse_key_val(s)
- for k in ['min', 'max', 'north', 'south', 'east', 'west']:
+ for k in ['min', 'max']:
+ kv[k] = float_or_null(kv[k])
+ for k in ['north', 'south', 'east', 'west']:
kv[k] = float(kv[k])
for k in ['nsres', 'ewres']:
kv[k] = float_or_dms(kv[k])
More information about the grass-commit
mailing list