Skip to content

Commit

Permalink
add multiprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
ninsbl committed Nov 3, 2022
1 parent da34cfc commit f1cc6d3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions temporal/t.rast.univar/testsuite/test_t_rast_univar.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,33 @@ def test_with_semantic_label(self):
b_2@PERMANENT|S2_B1|2001-04-01 00:00:00|2001-07-01 00:00:00|220|220|220|220|0|0|0|2112000|0|9600|9600
b_3@PERMANENT|S2_B1|2001-07-01 00:00:00|2001-10-01 00:00:00|330|330|330|330|0|0|0|3168000|0|9600|9600
b_4@PERMANENT|S2_B1|2001-10-01 00:00:00|2002-01-01 00:00:00|440|440|440|440|0|0|0|4224000|0|9600|9600
"""
for ref, res in zip(
univar_text.split("\n"), t_rast_univar.outputs.stdout.split("\n")
):
if ref and res:
ref_line = ref.split("|", 1)[1]
res_line = res.split("|", 1)[1]
self.assertLooksLike(ref_line, res_line)

def test_with_semantic_label_parallel(self):
"""Test semantic labels"""
t_rast_univar = SimpleModule(
"t.rast.univar",
input="B.S2_B1",
where="start_time >= '2001-01-01'",
nprocs=2,
overwrite=True,
verbose=True,
)
self.runModule("g.region", res=1)
self.assertModule(t_rast_univar)

univar_text = """id|semantic_label|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells|non_null_cells
b_1@PERMANENT|S2_B1|2001-01-01 00:00:00|2001-04-01 00:00:00|110|110|110|110|0|0|0|1056000|0|9600|9600
b_2@PERMANENT|S2_B1|2001-04-01 00:00:00|2001-07-01 00:00:00|220|220|220|220|0|0|0|2112000|0|9600|9600
b_3@PERMANENT|S2_B1|2001-07-01 00:00:00|2001-10-01 00:00:00|330|330|330|330|0|0|0|3168000|0|9600|9600
b_4@PERMANENT|S2_B1|2001-10-01 00:00:00|2002-01-01 00:00:00|440|440|440|440|0|0|0|4224000|0|9600|9600
"""
for ref, res in zip(
univar_text.split("\n"), t_rast_univar.outputs.stdout.split("\n")
Expand Down

0 comments on commit f1cc6d3

Please sign in to comment.