[GRASS-SVN] r57263 - grass-addons/grass7/vector/v.area.weigh

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 24 10:20:56 PDT 2013


Author: mmetz
Date: 2013-07-24 10:20:56 -0700 (Wed, 24 Jul 2013)
New Revision: 57263

Modified:
   grass-addons/grass7/vector/v.area.weigh/v.area.weigh.py
Log:
v.area.weigh: check options

Modified: grass-addons/grass7/vector/v.area.weigh/v.area.weigh.py
===================================================================
--- grass-addons/grass7/vector/v.area.weigh/v.area.weigh.py	2013-07-24 15:47:25 UTC (rev 57262)
+++ grass-addons/grass7/vector/v.area.weigh/v.area.weigh.py	2013-07-24 17:20:56 UTC (rev 57263)
@@ -65,7 +65,20 @@
     weight = options['weight']
     output = options['output']
 
+    # vector exists?
+    result = grass.find_file(vector, element='vector')
+    if len(result['name']) == 0:
+	grass.fatal(_("Input vector <%s> not found") % vector)
 
+    # raster exists?
+    result = grass.find_file(weight, element='cell')
+    if len(result['name']) == 0:
+	grass.fatal(_("Input weight raster <%s> not found") % weight)
+
+    # column exists ?
+    if column not in grass.vector_columns(vector, layer).keys():
+	grass.fatal(_("Column does not exist for vector <%s>, layer %s") % (vector, layer))
+
     # is column numeric?
     coltype = grass.vector_columns(vector, layer)[column]['type']
     



More information about the grass-commit mailing list