Skip to content

Commit

Permalink
implement suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
ninsbl committed Nov 10, 2022
1 parent 663eb41 commit 12eec61
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions python/grass/temporal/univar_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@
###############################################################################


def compute_univar_stats(row, stats_module, fs, rast_region=False):
def compute_univar_stats(registered_map_info, stats_module, fs, rast_region=False):
"""Compute univariate statistics for a map of a space time raster or raster3d dataset
:param row: Must be "strds" or "str3ds"
:param registered_map_info: dict or db row with tgis info for a registered map
:param stats_module: Pre-configured PyGRASS Module to compute univariate statistics with
:param fs: Field separator
:param rast_region: If set True ignore the current region settings
and use the raster map regions for univar statistical calculation.
Only available for strds.
"""
string = ""
id = row["id"]
start = row["start_time"]
end = row["end_time"]
id = registered_map_info["id"]
start = registered_map_info["start_time"]
end = registered_map_info["end_time"]
semantic_label = (
""
if stats_module.name == "r3.univar" or not row["semantic_label"]
else row["semantic_label"]
if stats_module.name == "r3.univar" or not registered_map_info["semantic_label"]
else registered_map_info["semantic_label"]
)

stats_module.inputs.map = id
Expand Down Expand Up @@ -115,7 +115,7 @@ def print_gridded_dataset_univar_statistics(
):
"""Print univariate statistics for a space time raster or raster3d dataset
:param type: Must be "strds" or "str3ds"
:param type: Type of Space-Time-Dataset, must be either strds or str3ds
:param input: The name of the space time dataset
:param output: Name of the optional output file, if None stdout is used
:param where: A temporal database where statement
Expand Down Expand Up @@ -215,8 +215,6 @@ def print_gridded_dataset_univar_statistics(
strings = pool.starmap(
compute_univar_stats, [(dict(row), univar_module, fs) for row in rows]
)
pool.close()
pool.join()

if output is None:
print("\n".join(filter(None, strings)))
Expand Down

0 comments on commit 12eec61

Please sign in to comment.