[GRASS-SVN] r59236 - in grass/trunk/scripts: d.rast.leg r.buffer.lowmem r.mask v.db.addcolumn v.db.addtable v.db.dropcolumn v.db.renamecolumn v.db.update v.in.mapgen v.rast.stats v.report

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 12 03:29:56 PDT 2014


Author: marisn
Date: 2014-03-12 03:29:56 -0700 (Wed, 12 Mar 2014)
New Revision: 59236

Modified:
   grass/trunk/scripts/d.rast.leg/d.rast.leg.py
   grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py
   grass/trunk/scripts/r.mask/r.mask.py
   grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py
   grass/trunk/scripts/v.db.addtable/v.db.addtable.py
   grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
   grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
   grass/trunk/scripts/v.db.update/v.db.update.py
   grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
   grass/trunk/scripts/v.rast.stats/v.rast.stats.py
   grass/trunk/scripts/v.report/v.report.py
Log:
Remove tab and space mixture in Python scripts before message cleanup

Modified: grass/trunk/scripts/d.rast.leg/d.rast.leg.py
===================================================================
--- grass/trunk/scripts/d.rast.leg/d.rast.leg.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/d.rast.leg/d.rast.leg.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -1,33 +1,33 @@
 #!/usr/bin/env python
 
 ##############################################################################
-# d.rast.leg	(GRASS Shell Script)
+# d.rast.leg        (GRASS Shell Script)
 #
 # displays a raster map and its legend on a graphics window. 
 #
-# Usage: 	d.rast.leg
-#	or	d.rast.leg help
-#	or	d.rast.leg rast_map [num_of_lines]
+# Usage:         d.rast.leg
+#        or      d.rast.leg help
+#        or      d.rast.leg rast_map [num_of_lines]
 #
-# Description:	d.rast.leg clears the entire screen, divides it into a main
-#		(left) and a minor (right) frames, and then display a raster 
-#		map in the main frame and the map legend in the minor frame.
-#		The user can run the program interactively or 
-#		non-interactively.
+# Description:   d.rast.leg clears the entire screen, divides it into a main
+#                (left) and a minor (right) frames, and then display a raster 
+#                map in the main frame and the map legend in the minor frame.
+#                The user can run the program interactively or 
+#                non-interactively.
 #
-# Parameters: 	rast_map 	A raster map to be displayed.
+# Parameters:    rast_map         A raster map to be displayed.
 #
-#	 	num_of_lines 	Number of lines to appear in the legend. 
-#				If this number is not given, the legend frame 
-#				will display as many lines as number of 
-#				categories in the map, otherwise, it will
-#				display the first num_of_lines minus 1  
-#				categories with the rest being truncated. 
+#                num_of_lines         Number of lines to appear in the legend. 
+#                                If this number is not given, the legend frame 
+#                                will display as many lines as number of 
+#                                categories in the map, otherwise, it will
+#                                display the first num_of_lines minus 1  
+#                                categories with the rest being truncated. 
 # 
-# Note:		The user may adjust the num_of_lines parameter or the size of 
-#		graphics window to get an appropriate result.
+# Note:          The user may adjust the num_of_lines parameter or the size of 
+#                graphics window to get an appropriate result.
 #
-# See also:	d.rast, d.legend.
+# See also:      d.rast, d.legend.
 #
 # Jianping Xu and Scott Madry, Rutgers University. October 19, 1993
 # Markus Neteler 8/2002: added simple d.legend logic
@@ -144,7 +144,7 @@
     if kv['datatype'] is 'CELL':
         leg_at = None
     else:
-        leg_at = '%f,95,5,15' %VSpacing	
+        leg_at = '%f,95,5,15' %VSpacing        
 
 # checking for histogram causes more problems than it solves
 #    histfiledir = grass.find_file(lmap, 'cell_misc')['file']

Modified: grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py
===================================================================
--- grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -2,15 +2,15 @@
 #
 ############################################################################
 #
-# MODULE:	r.buffer.lowmem
-# AUTHOR(S):	Glynn Clements
-# PURPOSE:	Low-memory replacement for r.buffer using r.grow.distance
+# MODULE:    r.buffer.lowmem
+# AUTHOR(S): Glynn Clements
+# PURPOSE:   Low-memory replacement for r.buffer using r.grow.distance
 #
-# COPYRIGHT:	(C) 2008, 2010 by Glynn Clements
+# COPYRIGHT: (C) 2008, 2010 by Glynn Clements
 #
-#		This program is free software under the GNU General Public
-#		License (>=v2). Read the file COPYING that comes with GRASS
-#		for details.
+#   This program is free software under the GNU General Public
+#   License (>=v2). Read the file COPYING that comes with GRASS
+#   for details.
 #
 #############################################################################
 
@@ -77,7 +77,7 @@
 
     #check if input file exists
     if not grass.find_file(input)['file']:
-	grass.fatal(_("<%s> does not exist.") % input)
+        grass.fatal(_("<%s> does not exist.") % input)
 
     scale = scales[units]
 
@@ -88,28 +88,28 @@
     s = grass.read_command("g.proj", flags='j')
     kv = grass.parse_key_val(s)
     if kv['+proj'] == 'longlat':
-	metric = 'geodesic'
+        metric = 'geodesic'
     else:
-	metric = 'squared'
+        metric = 'squared'
 
     grass.run_command('r.grow.distance',  input = input, metric = metric,
-		      distance = temp_dist, flags = 'm')
+                      distance = temp_dist, flags = 'm')
 
     if zero:
-	exp = "$temp_src = if($input == 0,null(),1)"
+        exp = "$temp_src = if($input == 0,null(),1)"
     else:
-	exp = "$temp_src = if(isnull($input),null(),1)"
+        exp = "$temp_src = if(isnull($input),null(),1)"
 
     grass.message(_("Extracting buffers (1/2)..."))
     grass.mapcalc(exp, temp_src = temp_src, input = input)
 
     exp = "$output = if(!isnull($input),$input,%s)"
     if metric == 'squared':
-	for n, dist2 in enumerate(distances2):
-	    exp %= "if($dist <= %f,%d,%%s)" % (dist2,n + 2)
+        for n, dist2 in enumerate(distances2):
+            exp %= "if($dist <= %f,%d,%%s)" % (dist2,n + 2)
     else:
-	for n, dist2 in enumerate(distances1):
-	    exp %= "if($dist <= %f,%d,%%s)" % (dist2,n + 2)
+        for n, dist2 in enumerate(distances1):
+            exp %= "if($dist <= %f,%d,%%s)" % (dist2,n + 2)
     exp %= "null()"
 
     grass.message(_("Extracting buffers (2/2)..."))
@@ -120,8 +120,8 @@
     p.stdin.write("1:distances calculated from these locations\n")
     d0 = "0"
     for n, d in enumerate(distances):
-	p.stdin.write("%d:%s-%s %s\n" % (n + 2, d0, d, units))
-	d0 = d
+        p.stdin.write("%d:%s-%s %s\n" % (n + 2, d0, d, units))
+        d0 = d
     p.stdin.close()
     p.wait()
 

Modified: grass/trunk/scripts/r.mask/r.mask.py
===================================================================
--- grass/trunk/scripts/r.mask/r.mask.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/r.mask/r.mask.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -3,16 +3,16 @@
 ############################################################################
 #
 # MODULE:       r.mask
-# AUTHOR(S):	Michael Barton, Arizona State University
+# AUTHOR(S):    Michael Barton, Arizona State University
 #               Markus Neteler
 #               Converted to Python by Glynn Clements
 #               Markus Metz
 # PURPOSE:      Facilitates creation of raster MASK
-# COPYRIGHT:	(C) 2005-2013 by the GRASS Development Team
+# COPYRIGHT:    (C) 2005-2013 by 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.
+#               This program is free software under the GNU General Public
+#               License (>=v2). Read the file COPYING that comes with GRASS
+#               for details.
 #
 #############################################################################
 
@@ -155,15 +155,15 @@
                               output = 'MASK', use = 'val', val = '1',
                               type = 'area', cats = cats, where = where, env = env)
         
-	if invert:
-	    global tmp
-	    tmp = "r_mask_%d" % os.getpid()
-	    grass.run_command('g.rename', rast = ('MASK', tmp), quiet = True)
+        if invert:
+            global tmp
+            tmp = "r_mask_%d" % os.getpid()
+            grass.run_command('g.rename', rast = ('MASK', tmp), quiet = True)
             grass.message(_("Creating inverted raster MASK..."))
-	    grass.mapcalc("MASK = if(isnull($tmp), 1, null())", tmp = tmp)
-	    grass.verbose(_("Inverted raster MASK created"))
-	else:
-	    grass.verbose(_("Raster MASK created"))
+            grass.mapcalc("MASK = if(isnull($tmp), 1, null())", tmp = tmp)
+            grass.verbose(_("Inverted raster MASK created"))
+        else:
+            grass.verbose(_("Raster MASK created"))
 
         grass.message(_("All subsequent raster operations will be limited to "
                         "the MASK area. Removing or renaming raster map named "

Modified: grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -3,7 +3,7 @@
 ############################################################################
 #
 # MODULE:       v.db.addcolumnumn
-# AUTHOR(S):   	Moritz Lennert 
+# AUTHOR(S):    Moritz Lennert 
 #               Converted to Python by Glynn Clements
 # PURPOSE:      interface to db.execute to add a column to the attribute table
 #               connected to a given vector map
@@ -53,12 +53,12 @@
     exists = bool(grass.find_file(map, element = 'vector', mapset = mapset)['file'])
     
     if not exists:
-	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
+        grass.fatal(_("Vector map <%s> not found in current mapset") % map)
     
     try:
         f = grass.vector_db(map)[int(layer)]
     except KeyError:
-	grass.fatal(_("There is no table connected to this map. Run v.db.connect or v.db.addtable first."))
+        grass.fatal(_("There is no table connected to this map. Run v.db.connect or v.db.addtable first."))
     
     table    = f['table']
     database = f['database']
@@ -66,19 +66,19 @@
     column_existing = grass.vector_columns(map, int(layer)).keys()    
     
     for col in columns:
-	if not col:
-	    grass.fatal(_("There is an empty column. Did you leave a trailing comma?"))
+        if not col:
+            grass.fatal(_("There is an empty column. Did you leave a trailing comma?"))
         col_name = col.split(' ')[0].strip()
         if col_name in column_existing:
             grass.error(_("Column <%s> is already in the table. Skipping.") % col_name)
             continue
         grass.verbose(_("Adding column <%s> to the table") % col_name)
-	p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
-	p.stdin.write("ALTER TABLE %s ADD COLUMN %s" % (table, col))
+        p = grass.feed_command('db.execute', input = '-', database = database, driver = driver)
+        p.stdin.write("ALTER TABLE %s ADD COLUMN %s" % (table, col))
         grass.debug("ALTER TABLE %s ADD COLUMN %s" % (table, col))
-	p.stdin.close()
-	if p.wait() != 0:
-	    grass.fatal(_("Unable to add column <%s>.") % col)
+        p.stdin.close()
+        if p.wait() != 0:
+            grass.fatal(_("Unable to add column <%s>.") % col)
     
     # write cmd history:
     grass.vector_history(map)

Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable.py
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -3,7 +3,7 @@
 ############################################################################
 #
 # MODULE:       v.db.addtable
-# AUTHOR(S):   	Markus Neteler 
+# AUTHOR(S):    Markus Neteler 
 #               Converted to Python by Glynn Clements
 #               Key column added by Martin Landa <landa.martin gmail.com>
 # PURPOSE:      interface to db.execute to creates and add a new table to given vector map
@@ -66,20 +66,20 @@
     # does map exist in CURRENT mapset?
     mapset = grass.gisenv()['MAPSET']
     if not grass.find_file(vector, element = 'vector', mapset = mapset)['file']:
-	grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
+        grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
     
     map_name = vector.split('@')[0]
     
     if not table:
-	if layer == '1':
-	    grass.verbose(_("Using vector map name as table name: <%s>") % map_name)
-	    table = map_name
-	else:
-	    # to avoid tables with identical names on higher layers
+        if layer == '1':
+            grass.verbose(_("Using vector map name as table name: <%s>") % map_name)
+            table = map_name
+        else:
+            # to avoid tables with identical names on higher layers
             table = "%s_%s" % (map_name, layer)
-	    grass.verbose(_("Using vector map name extended by layer number as table name: <%s>") % table)
+            grass.verbose(_("Using vector map name extended by layer number as table name: <%s>") % table)
     else:
-	grass.verbose(_("Using user specified table name: %s") % table)
+        grass.verbose(_("Using user specified table name: %s") % table)
     
     # check if DB parameters are set, and if not set them.
     grass.run_command('db.connect', flags = 'c')
@@ -93,7 +93,7 @@
     nuldev = file(os.devnull, 'w')
     try:
         grass.vector_db(map_name, stderr = nuldev)[int(layer)]
-	grass.fatal(_("There is already a table linked to layer <%s>") % layer)
+        grass.fatal(_("There is already a table linked to layer <%s>") % layer)
     except KeyError:
         pass
     
@@ -107,13 +107,13 @@
         else:
             column_def = []
         
-	# if not existing, create it:
+        # if not existing, create it:
         column_def_key = "%s integer" % key
-	if column_def_key not in column_def:
-	    column_def.insert(0, column_def_key)
+        if column_def_key not in column_def:
+            column_def.insert(0, column_def_key)
         column_def = ','.join(column_def)
         
-	grass.verbose(_("Creating table with columns (%s)...") % column_def)
+        grass.verbose(_("Creating table with columns (%s)...") % column_def)
         
         sql = "CREATE TABLE %s (%s)" % (table, column_def)
         if grass.run_command('db.execute', database = database, driver = driver, sql = sql) != 0:
@@ -124,7 +124,7 @@
         table = '%s.%s' (schema, table)
     grass.run_command('v.db.connect', quiet = True,
                       map = map_name, database = database, driver = driver,
-		      layer = layer, table = table, key = key)
+                      layer = layer, table = table, key = key)
     
     # finally we have to add cats into the attribute DB to make modules such as v.what.rast happy:
     # (creates new row for each vector line):
@@ -133,7 +133,7 @@
     
     grass.verbose(_("Current attribute table links:"))
     if grass.verbosity() > 2:
-	grass.run_command('v.db.connect', flags = 'p', map = map_name)
+        grass.run_command('v.db.connect', flags = 'p', map = map_name)
     
     # write cmd history:
     grass.vector_history(map_name)

Modified: grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -51,7 +51,7 @@
     
     # does map exist in CURRENT mapset?
     if not grass.find_file(map, element = 'vector', mapset = mapset):
-	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
+        grass.fatal(_("Vector map <%s> not found in current mapset") % map)
     
     f = grass.vector_layer_db(map, layer)
     
@@ -61,11 +61,11 @@
     driver = f['driver']
     
     if not table:
-	grass.fatal(_("There is no table connected to the input vector map. "
+        grass.fatal(_("There is no table connected to the input vector map. "
                       "Unable to delete any column. Exiting."))
     
     if keycol in columns:
-	grass.fatal(_("Unable to delete <%s> column as it is needed to keep table <%s> "
+        grass.fatal(_("Unable to delete <%s> column as it is needed to keep table <%s> "
                       "connected to the input vector map <%s>") % \
                         (keycol, table, map))
     

Modified: grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py
===================================================================
--- grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.db.renamecolumn/v.db.renamecolumn.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -51,7 +51,7 @@
     mapset = grass.gisenv()['MAPSET']
 
     if not grass.find_file(map, element = 'vector', mapset = mapset):
-	grass.fatal(_("Vector map <%s> not found in current mapset") % map)
+        grass.fatal(_("Vector map <%s> not found in current mapset") % map)
 
     f = grass.vector_layer_db(map, layer)
 
@@ -61,45 +61,45 @@
     driver = f['driver']
 
     if not table:
-	grass.fatal(_("There is no table connected to the input vector map. Cannot rename any column"))
+        grass.fatal(_("There is no table connected to the input vector map. Cannot rename any column"))
 
     cols = column.split(',')
     oldcol = cols[0]
     newcol = cols[1]
 
     if driver == "dbf":
-	if len(newcol) > 10:
-	    grass.fatal(_("Column name <%s> too long. The DBF driver supports column names not longer than 10 characters") % newcol)
+        if len(newcol) > 10:
+            grass.fatal(_("Column name <%s> too long. The DBF driver supports column names not longer than 10 characters") % newcol)
 
     if oldcol == keycol:
-	grass.fatal(_("Cannot rename column <%s> as it is needed to keep table <%s> connected to the input vector map") % (oldcol, table))
+        grass.fatal(_("Cannot rename column <%s> as it is needed to keep table <%s> connected to the input vector map") % (oldcol, table))
 
     # describe old col
     oldcoltype = None
     for f in grass.db_describe(table)['cols']:
-	if f[0] != oldcol:
-	    continue
-	oldcoltype = f[1]
-	oldcollength = f[2]
+        if f[0] != oldcol:
+            continue
+        oldcoltype = f[1]
+        oldcollength = f[2]
 
     # old col there?
     if not oldcoltype:
-	grass.fatal(_("Column <%s> not found in table <%s>") % (oldcol, table))
+        grass.fatal(_("Column <%s> not found in table <%s>") % (oldcol, table))
 
     # some tricks
     if driver in ['sqlite', 'dbf']:
-	if oldcoltype.upper() == "CHARACTER":
-	    colspec = "%s varchar(%s)" % (newcol, oldcollength)
-	else:
-	    colspec = "%s %s" % (newcol, oldcoltype)
+        if oldcoltype.upper() == "CHARACTER":
+            colspec = "%s varchar(%s)" % (newcol, oldcollength)
+        else:
+            colspec = "%s %s" % (newcol, oldcoltype)
 
-	grass.run_command('v.db.addcolumn', map = map, layer = layer, column = colspec)
-	sql = "UPDATE %s SET %s=%s" % (table, newcol, oldcol)
-	grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
-	grass.run_command('v.db.dropcolumn', map = map, layer = layer, column = oldcol)
+        grass.run_command('v.db.addcolumn', map = map, layer = layer, column = colspec)
+        sql = "UPDATE %s SET %s=%s" % (table, newcol, oldcol)
+        grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
+        grass.run_command('v.db.dropcolumn', map = map, layer = layer, column = oldcol)
     else:
-	sql = "ALTER TABLE %s RENAME %s TO %s" % (table, oldcol, newcol)
-	grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
+        sql = "ALTER TABLE %s RENAME %s TO %s" % (table, oldcol, newcol)
+        grass.write_command('db.execute', input = '-', database = database, driver = driver, stdin = sql)
 
     # write cmd history:
     grass.vector_history(map)

Modified: grass/trunk/scripts/v.db.update/v.db.update.py
===================================================================
--- grass/trunk/scripts/v.db.update/v.db.update.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.db.update/v.db.update.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -60,12 +60,12 @@
 
     # does map exist in CURRENT mapset?
     if not grass.find_file(vector, element = 'vector', mapset = mapset)['file']:
-	grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
+        grass.fatal(_("Vector map <%s> not found in current mapset") % vector)
 
     try:
         f = grass.vector_db(vector)[int(layer)]
     except KeyError:
-	grass.fatal(_('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
+        grass.fatal(_('There is no table connected to this map. Run v.db.connect or v.db.addtable first.'))
 
     table = f['table']
     database = f['database']
@@ -75,23 +75,23 @@
     try:
         coltype = grass.vector_columns(vector, layer)[column]['type']
     except KeyError:
-	grass.fatal(_('Column <%s> not found') % column)
+        grass.fatal(_('Column <%s> not found') % column)
 
     if qcolumn:
-	if value:
-	    grass.fatal(_('<value> and <qcolumn> are mutually exclusive'))
-	# special case: we copy from another column
-	value = qcolumn
+        if value:
+            grass.fatal(_('<value> and <qcolumn> are mutually exclusive'))
+        # special case: we copy from another column
+        value = qcolumn
     else:
-	if not value:
-	    grass.fatal(_('Either <value> or <qcolumn> must be given'))
-	# we insert a value
-	if coltype.upper() not in ["INTEGER", "DOUBLE PRECISION"]:
-	    value = "'%s'" % value
+        if not value:
+            grass.fatal(_('Either <value> or <qcolumn> must be given'))
+        # we insert a value
+        if coltype.upper() not in ["INTEGER", "DOUBLE PRECISION"]:
+            value = "'%s'" % value
 
     cmd = "UPDATE %s SET %s=%s" % (table, column, value)
     if where:
-	cmd += " WHERE " + where
+        cmd += " WHERE " + where
 
     grass.verbose("SQL: \"%s\"" % cmd)
 

Modified: grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
===================================================================
--- grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -93,16 +93,16 @@
     grass.message(_("Importing data..."))
     cat = 1   
     if matlab:
-	## HB:  OLD v.in.mapgen.sh Matlab import command follows.
-	##    I have no idea what it's all about, so "new" matlab format will be
-	##    a series of x y with "nan nan" breaking lines. (as NOAA provides)
-	##  Old command:
-	#  tac $infile | $AWK 'BEGIN { FS="," ; R=0 }
-	#    $1~/\d*/   { printf("L %d\n", R) }
-	#    $1~/   .*/ { printf(" %lf %lf\n", $2, $1) ; ++R }
-	#    $1~/END/   { }' | tac > "$TMP"
+        ## HB:  OLD v.in.mapgen.sh Matlab import command follows.
+        ##    I have no idea what it's all about, so "new" matlab format will be
+        ##    a series of x y with "nan nan" breaking lines. (as NOAA provides)
+        ##  Old command:
+        #  tac $infile | $AWK 'BEGIN { FS="," ; R=0 }
+        #    $1~/\d*/   { printf("L %d\n", R) }
+        #    $1~/   .*/ { printf(" %lf %lf\n", $2, $1) ; ++R }
+        #    $1~/END/   { }' | tac > "$TMP"
 
-	## matlab format.
+        ## matlab format.
         points = []
  
         for line in inf:
@@ -174,7 +174,7 @@
     host = os.getenv('COMPUTERNAME') or os.uname()[1]
     
     s = t.substitute(prog = prog, name = name, date = date, year = year,
-		     user = user, host = host)
+                     user = user, host = host)
     outf.write(s)
     
     #### process points list to ascii vector file (merge in vertices)
@@ -193,7 +193,7 @@
         #### import to binary vector file
         grass.message(_("Importing with v.in.ascii...")) 
         if grass.run_command('v.in.ascii', flags = do3D, input = digfile,
-			     output = name, format = 'standard') != 0:
+                             output = name, format = 'standard') != 0:
             grass.fatal(_('An error occurred on creating "%s", please check') % name)
 
 if __name__ == "__main__":

Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats.py
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -2,18 +2,18 @@
 
 ############################################################################
 #
-# MODULE:	v.rast.stats
-# AUTHOR(S):	Markus Neteler
-#		converted to Python by Glynn Clements
-#		speed up by Markus Metz
-#           add column choose by Luca Delucchi
-# PURPOSE:	Calculates univariate statistics from a GRASS raster map
-#		only for areas covered by vector objects on a per-category base
-# COPYRIGHT:	(C) 2005-2010 by the GRASS Development Team
+# MODULE:       v.rast.stats
+# AUTHOR(S):    Markus Neteler
+#               converted to Python by Glynn Clements
+#               speed up by Markus Metz
+#               add column choose by Luca Delucchi
+# PURPOSE:      Calculates univariate statistics from a GRASS raster map
+#               only for areas covered by vector objects on a per-category base
+# COPYRIGHT:    (C) 2005-2010 by 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.
+#               This program is free software under the GNU General Public
+#               License (>=v2). Read the file COPYING that comes with GRASS
+#               for details.
 #
 #############################################################################
 
@@ -76,7 +76,7 @@
         grass.run_command('g.rename', rast=(tmpname + "_origmask", 'MASK'),
                           quiet=True)
 #    for f in [tmp, tmpname, sqltmp]:
-#	grass.try_remove(f)
+#        grass.try_remove(f)
 
 
 def main():

Modified: grass/trunk/scripts/v.report/v.report.py
===================================================================
--- grass/trunk/scripts/v.report/v.report.py	2014-03-11 16:58:46 UTC (rev 59235)
+++ grass/trunk/scripts/v.report/v.report.py	2014-03-12 10:29:56 UTC (rev 59236)
@@ -2,14 +2,14 @@
 #
 ############################################################################
 #
-# MODULE:	v.report
-# AUTHOR(S):	Markus Neteler, converted to Python by Glynn Clements
-# PURPOSE:	Reports geometry statistics for vector maps
-# COPYRIGHT:	(C) 2005, 2007-2009 by MN and the GRASS Development Team
+# MODULE:       v.report
+# AUTHOR(S):    Markus Neteler, converted to Python by Glynn Clements
+# PURPOSE:      Reports geometry statistics for vector maps
+# COPYRIGHT:    (C) 2005, 2007-2009 by MN 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.
+#               This program is free software under the GNU General Public
+#               License (>=v2). Read the file COPYING that comes with GRASS
+#               for details.
 #
 #############################################################################
 
@@ -50,9 +50,9 @@
     result = []
     last = None
     for i in l:
-	if i != last:
-	    result.append(i)
-	    last = i
+        if i != last:
+            result.append(i)
+            last = i
     return result
 
 def main():
@@ -64,43 +64,43 @@
     nuldev = file(os.devnull, 'w')
 
     if not grass.find_file(mapname, 'vector')['file']:
-	grass.fatal(_("Vector map '%s' not found in mapset search path.") % mapname)
+        grass.fatal(_("Vector map '%s' not found in mapset search path.") % mapname)
 
     colnames = grass.vector_columns(mapname, layer, getDict = False, stderr = nuldev)
     
     if not colnames:
-	colnames = ['cat']
+        colnames = ['cat']
 
     if option == 'coor':
-	columns = ['dummy1','dummy2','dummy3']
-	extracolnames = ['x','y','z']
+        columns = ['dummy1','dummy2','dummy3']
+        extracolnames = ['x','y','z']
     else:
-	columns = ['dummy1']
-	extracolnames = [option]
+        columns = ['dummy1']
+        extracolnames = [option]
 
     if units in ['p','percent']:
-	unitsp = 'meters'
+        unitsp = 'meters'
     elif units:
-	unitsp = units
+        unitsp = units
     else:
-	unitsp = None
+        unitsp = None
 
     # NOTE: we suppress -1 cat and 0 cat
     if colnames:
-	p = grass.pipe_command('v.db.select', quiet = True, flags='c', map = mapname, layer = layer)
-	records1 = []
-	for line in p.stdout:
-	    cols = line.rstrip('\r\n').split('|')
-	    if cols[0] == '0':
-		continue
-	    records1.append([int(cols[0])] + cols[1:])
-	p.wait()
+        p = grass.pipe_command('v.db.select', quiet = True, flags='c', map = mapname, layer = layer)
+        records1 = []
+        for line in p.stdout:
+            cols = line.rstrip('\r\n').split('|')
+            if cols[0] == '0':
+                continue
+            records1.append([int(cols[0])] + cols[1:])
+        p.wait()
         if p.returncode != 0:
             sys.exit(1)
         
-	records1.sort()
+        records1.sort()
 
-	if len(records1) == 0:
+        if len(records1) == 0:
             try:
                 f = grass.vector_db(map = mapname)[int(layer)]
                 grass.fatal(_("There is a table connected to input vector map '%s', but"
@@ -109,45 +109,45 @@
             except KeyError:
                 pass
 
-	#fetch the requested attribute sorted by cat:
-	p = grass.pipe_command('v.to.db', flags = 'p',
+        #fetch the requested attribute sorted by cat:
+        p = grass.pipe_command('v.to.db', flags = 'p',
                                quiet = True,
-			       map = mapname, option = option, columns = columns,
-			       layer = layer, units = unitsp)
-	records2 = []
-	for line in p.stdout:
-	    fields = line.rstrip('\r\n').split('|')
-	    if fields[0] in ['cat', '-1', '0']:
-		continue
-	    records2.append([int(fields[0])] + fields[1:-1] + [float(fields[-1])])
-	p.wait()
-	records2.sort()
+                               map = mapname, option = option, columns = columns,
+                               layer = layer, units = unitsp)
+        records2 = []
+        for line in p.stdout:
+            fields = line.rstrip('\r\n').split('|')
+            if fields[0] in ['cat', '-1', '0']:
+                continue
+            records2.append([int(fields[0])] + fields[1:-1] + [float(fields[-1])])
+        p.wait()
+        records2.sort()
 
-	#make pre-table
-	records3 = [r1 + r2[1:] for r1, r2 in zip(records1, records2)]
+        #make pre-table
+        records3 = [r1 + r2[1:] for r1, r2 in zip(records1, records2)]
     else:
-	records1 = []
+        records1 = []
         p = grass.pipe_command('v.category', inp = mapname, layer = layer, option = 'print')
-	for line in p.stdout:
-	    field = int(line.rstrip())
-	    if field > 0:
-		records1.append(field)
-	p.wait()
-	records1.sort()
-	records1 = uniq(records1)
+        for line in p.stdout:
+            field = int(line.rstrip())
+            if field > 0:
+                records1.append(field)
+        p.wait()
+        records1.sort()
+        records1 = uniq(records1)
 
         #make pre-table
-	p = grass.pipe_command('v.to.db', flags = 'p',
-			       map = mapname, option = option, columns = columns,
-			       layer = layer, units = unitsp)
-	records3 = []
-	for line in p.stdout:
-	    fields = line.split('|')
-	    if fields[0] in ['cat', '-1', '0']:
-		continue
-	    records3.append([int(fields[0])] + fields[1:])
-	p.wait()
-	records3.sort()
+        p = grass.pipe_command('v.to.db', flags = 'p',
+                               map = mapname, option = option, columns = columns,
+                               layer = layer, units = unitsp)
+        records3 = []
+        for line in p.stdout:
+            fields = line.split('|')
+            if fields[0] in ['cat', '-1', '0']:
+                continue
+            records3.append([int(fields[0])] + fields[1:])
+        p.wait()
+        records3.sort()
 
     # print table header
     sys.stdout.write('|'.join(colnames + extracolnames) + '\n')
@@ -157,14 +157,14 @@
 
     # calculate percents if requested
     if units != '' and units in ['p','percent']:
-	# calculate total area value
-	areatot = 0
-	for r in records3:
-	    areatot += float(r[-1])
+        # calculate total area value
+        areatot = 0
+        for r in records3:
+            areatot += float(r[-1])
 
-	# calculate area percentages
-	records4 = [float(r[-1]) * 100 / areatot for r in records3]
-	records3 = [r1 + [r4] for r1, r4 in zip(records1, records4)]
+        # calculate area percentages
+        records4 = [float(r[-1]) * 100 / areatot for r in records3]
+        records3 = [r1 + [r4] for r1, r4 in zip(records1, records4)]
 
     # sort results
     if options['sort']:
@@ -174,7 +174,7 @@
             records3.sort(key = lambda r: r[-1], reverse = True)
     
     for r in records3:
-	sys.stdout.write('|'.join(map(str,r)) + '\n')
+        sys.stdout.write('|'.join(map(str,r)) + '\n')
 
 if __name__ == "__main__":
     options, flags = grass.parser()



More information about the grass-commit mailing list