From e78cea9caa72de54f3bd6d11adea5eedc54e4089 Mon Sep 17 00:00:00 2001 From: Michael Dales Date: Tue, 13 May 2025 09:55:46 +0100 Subject: [PATCH 1/2] Fix for OGR ignoring complex polygons --- threats/threat_processing.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/threats/threat_processing.py b/threats/threat_processing.py index 370fcac..2a0adca 100644 --- a/threats/threat_processing.py +++ b/threats/threat_processing.py @@ -38,9 +38,13 @@ def threat_processing_per_species( weighted_species = proportional_aoh_per_pixel * category_weight total_threat_weight = sum(x[1] for x in threat_data) + print(threat_data) + print(total_threat_weight) for threat_id, weight in threat_data: + print(threat_id, weight) proportional_threat_weight = weight / total_threat_weight per_threat_per_species_score = weighted_species * proportional_threat_weight + print(per_threat_per_species_score.sum()) threat_dir_path = os.path.join(output_directory_path, str(threat_id)) os.makedirs(threat_dir_path, exist_ok=True) @@ -49,6 +53,8 @@ def threat_processing_per_species( per_threat_per_species_score.save(result) def main() -> None: + os.environ["OGR_GEOJSON_MAX_OBJ_SIZE"] = "0" + parser = argparse.ArgumentParser(description="Calculate per species threat layers") parser.add_argument( '--speciesdata', From 61620654b0e4e2b16f326f263e876b8bddc00a55 Mon Sep 17 00:00:00 2001 From: Michael Dales Date: Tue, 13 May 2025 10:05:55 +0100 Subject: [PATCH 2/2] CI fix --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0746930..aad935b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,6 +33,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install gdal[numpy]==3.10.3 python -m pip install -r requirements.txt - name: Lint with pylint run: |