From d7307d90a27a92af537e0781ca108712506a9fa5 Mon Sep 17 00:00:00 2001 From: Emma Ai Date: Wed, 21 Aug 2024 13:55:58 +0000 Subject: [PATCH] add tolerance --- docker/requirements.txt | 2 +- odc/stats/plugins/lc_tf_urban.py | 6 ++-- odc/stats/plugins/lc_treelite_cultivated.py | 39 ++++++++++----------- odc/stats/plugins/lc_treelite_woody.py | 6 ++-- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/docker/requirements.txt b/docker/requirements.txt index db250598..bde82288 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -11,7 +11,7 @@ odc-dscache>=0.2.3 odc-stac @ git+https://github.com/opendatacube/odc-stac@69bdf64 # odc-stac is in PyPI -odc-stats[ows] @ git+https://github.com/opendatacube/odc-stats@eee2ed1 +odc-stats[ows] @ git+https://github.com/opendatacube/odc-stats@4480ab1 # For ML tflite-runtime diff --git a/odc/stats/plugins/lc_tf_urban.py b/odc/stats/plugins/lc_tf_urban.py index b941fca7..1cf2135b 100644 --- a/odc/stats/plugins/lc_tf_urban.py +++ b/odc/stats/plugins/lc_tf_urban.py @@ -178,7 +178,7 @@ def aggregate_results_from_group(self, urban_masks): urban_masks = urban_masks[0] urban_masks = expr_eval( - "where((a/nodata)>=_l, nodata, a%nodata)", + "where((a/nodata)+0.5>=_l, nodata, a%nodata)", {"a": urban_masks}, name="mark_nodata", dtype="float32", @@ -186,7 +186,7 @@ def aggregate_results_from_group(self, urban_masks): ) urban_masks = expr_eval( - "where((a>0)&(a0.5)&(a=_l, nodata, m%nodata)", + "where((m/nodata)+0.5>=_l, nodata, m%nodata)", {"m": predict_output}, name="mark_nodata", dtype="float32", @@ -296,7 +295,7 @@ def aggregate_results_from_group(self, predict_output): ) predict_output = expr_eval( - "where((m>0)&(m0.5)&(m=_l, nodata, a%nodata)", + "where((a/nodata)+0.5>=_l, nodata, a%nodata)", {"a": predict_output}, name="summary_over_classes", dtype="float32", @@ -77,7 +77,7 @@ def aggregate_results_from_group(self, predict_output): ) predict_output = expr_eval( - "where((a>0)&(a0.5)&(a