From c67e5f365c7511f9c89af813726a0c0a788a828f Mon Sep 17 00:00:00 2001 From: ninsbl Date: Mon, 21 Oct 2024 09:29:50 +0200 Subject: [PATCH] fix pol attribute name --- src/temporal/t.avalanche.stats/t.avalanche.stats.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/temporal/t.avalanche.stats/t.avalanche.stats.py b/src/temporal/t.avalanche.stats/t.avalanche.stats.py index 6cff32b3..a240be9c 100644 --- a/src/temporal/t.avalanche.stats/t.avalanche.stats.py +++ b/src/temporal/t.avalanche.stats/t.avalanche.stats.py @@ -117,6 +117,11 @@ def process_avalanche_map(avalanche_map_row, **kwargs): gs.use_temp_region() Module("g.region", align=avalanche_map, raster=avalanche_map) + # ToDo: use r.clump to get same ID across raster and vector + # allows to + # - remove v.to.rast and v.edit step, + # - filter areas by size before vectorization, and + # - to clump diagonal Module( "r.mapcalc", expression=f"{reclass_map}=int(if({avalanche_map_id}==1,1,null()))", @@ -165,10 +170,9 @@ def process_avalanche_map(avalanche_map_row, **kwargs): area_attributes["algoritme"] = "unet" area_attributes["t_0"] = t_0.strftime("%Y%m%dT%H%M%S") area_attributes["t_1"] = t_1.strftime("%Y%m%dT%H%M%S") - # area_attributes["polarization"] = polarization area_attributes["direction"] = direction area_attributes["sat_geom"] = sat_geom - area_attributes["polarization"] = polarization + area_attributes["pol"] = polarization gs.use_temp_region() Module( "g.region", @@ -216,6 +220,7 @@ def process_avalanche_map(avalanche_map_row, **kwargs): } for method in ("min", "mean", "max"): area_attributes[f"{prefix}_{method}"] = univar_stats.get(method) + # Write new attributes to DB area_attributes.commit() gs.del_temp_region()