Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
6 changes: 6 additions & 0 deletions threats/threat_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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',
Expand Down