|
@@ -126,7 +126,7 @@ def print_gridded_dataset_univar_statistics(type, input, output, where, extended
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
|
-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 @@ def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
|
|
|
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 @@ def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
|
|
|
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 @@ def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
|
|
|
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()
|