[GRASS-SVN] r44051 - grass/branches/releasebranch_6_4/lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 26 11:55:23 EDT 2010


Author: martinl
Date: 2010-10-26 08:55:23 -0700 (Tue, 26 Oct 2010)
New Revision: 44051

Modified:
   grass/branches/releasebranch_6_4/lib/python/raster.py
Log:
glynn: Fix raster_info() to handle min/max = NULL.


Modified: grass/branches/releasebranch_6_4/lib/python/raster.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/raster.py	2010-10-26 15:54:15 UTC (rev 44050)
+++ grass/branches/releasebranch_6_4/lib/python/raster.py	2010-10-26 15:55:23 UTC (rev 44051)
@@ -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