[GRASS-SVN] r73439 - in grass/branches/releasebranch_7_6: lib/python/temporal temporal/t.rast.univar/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 27 12:15:59 PDT 2018
Author: lucadelu
Date: 2018-09-27 12:15:58 -0700 (Thu, 27 Sep 2018)
New Revision: 73439
Modified:
grass/branches/releasebranch_7_6/lib/python/temporal/univar_statistics.py
grass/branches/releasebranch_7_6/temporal/t.rast.univar/testsuite/test_univar.py
Log:
t.rast.univar: added non-null cells, see #3375 (backport r73438)
Modified: grass/branches/releasebranch_7_6/lib/python/temporal/univar_statistics.py
===================================================================
--- grass/branches/releasebranch_7_6/lib/python/temporal/univar_statistics.py 2018-09-27 19:04:26 UTC (rev 73438)
+++ grass/branches/releasebranch_7_6/lib/python/temporal/univar_statistics.py 2018-09-27 19:15:58 UTC (rev 73439)
@@ -69,6 +69,7 @@
string += "min" + fs + "max" + fs
string += "mean_of_abs" + fs + "stddev" + fs + "variance" + fs
string += "coeff_var" + fs + "sum" + fs + "null_cells" + fs + "cells"
+ string += fs + "non_null_cells"
if extended is True:
string += fs + "first_quartile" + fs + "median" + fs
string += "third_quartile" + fs + "percentile_90"
@@ -111,6 +112,7 @@
string += fs + str(stats["stddev"]) + fs + str(stats["variance"])
string += fs + str(stats["coeff_var"]) + fs + str(stats["sum"])
string += fs + str(stats["null_cells"]) + fs + str(stats["cells"])
+ string += fs + str(int(stats["cells"]) - int(stats["null_cells"]))
if extended is True:
string += fs + str(stats["first_quartile"]) + fs + str(stats["median"])
string += fs + str(stats["third_quartile"]) + fs + str(stats["percentile_90"])
Modified: grass/branches/releasebranch_7_6/temporal/t.rast.univar/testsuite/test_univar.py
===================================================================
--- grass/branches/releasebranch_7_6/temporal/t.rast.univar/testsuite/test_univar.py 2018-09-27 19:04:26 UTC (rev 73438)
+++ grass/branches/releasebranch_7_6/temporal/t.rast.univar/testsuite/test_univar.py 2018-09-27 19:15:58 UTC (rev 73439)
@@ -48,11 +48,11 @@
self.runModule("g.region", res=1)
self.assertModule(t_rast_univar)
- univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
-a_1 at testing|2001-01-01 00:00:00|2001-04-01 00:00:00|100|100|100|100|0|0|0|960000|0|9600
-a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600
-a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600
-a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600
+ univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells|non_null_cells
+a_1 at testing|2001-01-01 00:00:00|2001-04-01 00:00:00|100|100|100|100|0|0|0|960000|0|9600|9600
+a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600|9600
+a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
+a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
for ref, res in zip(univar_text.split("\n"), t_rast_univar.outputs.stdout.split("\n")):
if ref and res:
@@ -68,10 +68,10 @@
self.runModule("g.region", res=1)
self.assertModule(t_rast_univar)
- univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
-a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600
-a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600
-a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600
+ univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells|non_null_cells
+a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600|9600
+a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
+a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
for ref, res in zip(univar_text.split("\n"), t_rast_univar.outputs.stdout.split("\n")):
if ref and res:
@@ -87,10 +87,10 @@
self.runModule("g.region", res=10)
self.assertModule(t_rast_univar)
- univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
-a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|19200|0|96
-a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|28800|0|96
-a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|38400|0|96
+ univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells|non_null_cells
+a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|19200|0|96|96
+a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|28800|0|96|96
+a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|38400|0|96|96
"""
for ref, res in zip(univar_text.split("\n"), t_rast_univar.outputs.stdout.split("\n")):
if ref and res:
@@ -106,10 +106,10 @@
where="start_time >= '2001-03-01'",
overwrite=True, verbose=True)
- univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
-a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600
-a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600
-a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600
+ univar_text="""id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells|non_null_cells
+a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600|9600
+a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
+a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
univar_output = open("univar_output.txt", "r").read()
@@ -127,9 +127,9 @@
where="start_time >= '2001-03-01'",
overwrite=True, verbose=True)
- univar_text="""a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600
-a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600
-a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600
+ univar_text="""a_2 at testing|2001-04-01 00:00:00|2001-07-01 00:00:00|200|200|200|200|0|0|0|1920000|0|9600|9600
+a_3 at testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
+a_4 at testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
univar_output = open("univar_output.txt", "r").read()
More information about the grass-commit
mailing list