This repository contains code, data, and documentation for SkyTruth's Mountaintop Removal Mining (MTM) related work.
- MTM2009_Archive : Data and documentaion related to the 2009 SkyTruth Decadal mine detection model
- MTM2018_Archive : Code, data, and documentaion related to the 2018 paper "Mapping the yearly extent of surface coal mining in Central Appalachia using Landsat and Google Earth Engine", published in PLOS One, which identified mines at annual intervals from 1985 - 2015.
- MTM_Annual_Mining : Code, data, and documentaion related to the current version of SkyTruth's Annual mine detection model; which is run annually and has been updated from the code in MTM2018_Archive
- CAMRA : Code, data, and documentation related to the Central Appalachian Mine Reforestation Assessment Tool
- Highwall_Detection : Code, data, and documentation related to highwall detection model
- Post-mining_Recovery : Code, data, and documentation related to the 2022 paoer "Mines to forests? Analyzing long-term recovery trends for surface coal mines in Central Appalachia", published in Restoration Ecology
- data : key datasets utilized across MTM projects
- utils : General purpose code which is project agnostic
- This repo is primarily Python-based, so ensure you have python set up. if not, follow the Python setup instructions.
- There are some Javascript codes included, written using the Google Earth Engine Code Editor, and intended to be run in the same.
- This repo is set up with Poetry. Learn how to set up and use Poetry in this section, which mainly re-format data.
- We use Google Cloud Platform resources (Google Cloud Storage) in this repo. Instructions on getting set up are here
- In this repo we use pre-commit-hooks
- Git/GitHub instructions are found in this repo
- In this repo, each MTM related project has a separate directory which contains documentation about the project. Projects are outlined broadly in Repository Layout, please see specific ReadMe files in each directory for additional information
- Python should come built in on Mac, but you can also get it from the Python downloads page. These instructions are only for Windows though.
- Install the latest stable Python version (if you do not already have it)
- Download and install from Python
- Add the Python path to your environment variables (be sure to update YourUsername and the correct python version [in this example, the version is Python3.9]) by running the following in Powershell:
$env:Path += ";C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python39\"- Test that python is set up correctly. First restart your Powershell and then run:
py --versionNote: 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 lockfiles:
poetry lock
poetry installpoetry lockbuilds the lockfile, which is the list of dependencies based on pyproject.toml (core dependencies)poetry installinstalls those dependencies
Adding 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