This repository contains preliminary code related to the development of a Terrestrial Protected Area Effectiveness (TPAE) model. TPAE is part of SkyTruth's 30x30 progress tracking initiative.
- src/absolute_effectiveness/: Class-based analysis components for evaluating absolute effectiveness.
SiteSelector: Retrieves selected test sites and derives site-specific variables.DataProcessor: Loads and processes Earth Engine datasets (GLC, GPW, NFW, HGFC) for the selected sites and analysis period.HabitatConditionAnalyzer: Calculates habitat extent, intactness, and overall habitat condition score.HabitatLossAnalyzer: Calculates habitat loss score and summarizes the drivers and types of habitat loss.VisualizationService: Builds cloud-masked Sentinel-2 composites to aid map visualization.
- notebooks/run_absolute_effectiveness.ipynb: Notebook for testing absolute effectiveness code individually on various test sites and visualizing results.
- src/utils/variables.py: Constants related to absolute effectiveness code. s
- This repository uses ruff pre-commit hooks.
- This repository uses Poetry for package and dependency management (see below for installation and set-up).
Note: Python needs to be installed before poetry.
- Install Poetry
- After installing poetry, add the Poetry bin to PATH by adding the following line to .zshrc:
export PATH="$HOME/.local/bin:$PATH"- Open PowerShell in Administrator mode (windows menu > Powershell > right click > Administrator)
- Install Poetry:
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -- It is probably possible (and better) to add the PATH to the Poetry app to your environment somehow, but we could not figure out how to make that work so instead we set up an Alias so that we could run poetry commands
- Set execution policy (this makes your computer slightly less secure, but if you aren't downloading potential malware via Powershell, you're alright)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process- create user profile: open $PROFILE in notepad:
notepad $PROFILE- Add the following to that file (replace YourUsername with the correct identifier):
Set-Alias poetry "C:\Users\<YourUsername>\AppData\Roaming\Python\Scripts\poetry.exe"
This repo already has a pyproject.toml and a poetry.lock file. These define the virtual environment (sort of like how requirements.txt defines a pip environment, but these files resolve dependencies and ensure everyone has the same dependencies, since those are defined in the lockfile).
To work in the poetry virtual environment, you just need to prepend all command line statements with poetry run (i.e. instead of python hello_world.py you would simply run poetry run python hello_world.py)
Alternatively, you can work work entirely in the environment (similar to conda activate) with the command poetry shell, and then you can just run python hello_world.py
Do this each time you pull the repo in case there have been changes to the dependencies:
poetry installAdding a new library:
poetry add <new-package>Deleting a library
poetry remove <old-package>This work is licensed under the Apache License, Version 2.0. See LICENSE.txt