[GRASS-SVN] r66725 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 3 02:59:38 PST 2015
Author: huhabla
Date: 2015-11-03 02:59:38 -0800 (Tue, 03 Nov 2015)
New Revision: 66725
Modified:
grass/trunk/lib/python/temporal/univar_statistics.py
Log:
temporal framework: Added output file support for vector time series univar stats output
Modified: grass/trunk/lib/python/temporal/univar_statistics.py
===================================================================
--- grass/trunk/lib/python/temporal/univar_statistics.py 2015-11-03 09:34:31 UTC (rev 66724)
+++ grass/trunk/lib/python/temporal/univar_statistics.py 2015-11-03 10:59:38 UTC (rev 66725)
@@ -126,7 +126,7 @@
###############################################################################
-def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
+def print_vector_dataset_univar_statistics(input, output, twhere, layer, type, column,
where, extended, no_header=False,
fs="|"):
"""Print univariate statistics for a space time vector dataset
@@ -148,6 +148,9 @@
dbif = SQLDatabaseInterfaceConnection()
dbif.connect()
+ if output is not None:
+ out_file = open(output, "w")
+
mapset = get_current_mapset()
if input.find("@") >= 0:
@@ -187,7 +190,10 @@
string += fs + "first_quartile" + fs + "median" + fs + \
"third_quartile" + fs + "percentile_90"
- print string
+ if output is None:
+ print string
+ else:
+ out_file.write(string + "\n")
for row in rows:
id = row["name"] + "@" + row["mapset"]
@@ -247,6 +253,12 @@
else:
string += fs + fs + fs + fs
- print string
+ if output is None:
+ print string
+ else:
+ out_file.write(string + "\n")
dbif.close()
+
+ if output is not None:
+ out_file.close()
\ No newline at end of file
More information about the grass-commit
mailing list