Repo for downloading PlanetScope data based on a set of predefined grids.
Some one time repo initialization work.
You can install miniconda if on Mac or Linux. On Windows install Anaconda.
Follow directions HERE
For Mac, perfer to install miniconda using brew.
brew doctor
brew update
brew upgrade
brew upgrade --cask --greedy
brew install --cask minicondaFollow directions HERE
On Windows, open an Andaconda Terminal, on Linux/Mac open a regular terminal.
Check if git is installed. It will return something e.g. /usr/bin/git if git is installed.
# Linux/Mac
which git
# Windows
where gitIf git is not installed, install it.
# Windows
conda install git
# Mac
brew install gitThis command will create a new folder planet_download in your terminal's current directory. If you want it installed somewhere specific, move to that folder first (cd SOMEWHERE/ELSE)
git clone git@github.com:kyle-dorman/planet_download.gitAfter cloning the repo, enter the folder
cd planet_downloadThis repo uses Conda as the primary environment setup path.
conda env create -f environment.ymlconda activate planet_downloadconda activate planet_downloadStart from the tracked example config and create a local config.yaml.
cp configs/download.example.yaml config.yamlYou MUST set the grid_dir and save_dir variables. You should also add a processing_dir if you wish the data to be copied for further Neural Network processing. Local config.yaml files are ignored by git.
grid_dir - The path to a folder of geojson grid files in the wgs84 CRS.
save_dir - The path to a folder where you want to save the data. During the download process, data will be saved to folders following the convention: save_dir/YEAR/MONTH/GRID_ID
processing_dir - The path to a folder where you process the surface reflectance and UDM data with a Neural Network. e.g. Y:\planet\stateMap\processing
Look up your API key from the Planet Account Settings.
Optionally create a local .env file:
cp .env.example .env- Launch jupyter notebook
jupyter notebook --notebook-dir=notebooks --port=8892- Open the
run.ipynb. - Set the
MONTH,YEAR,CONFIG_FILE, andPL_API_KEYvariables. - Run the remaining cells
Inpsect run.py script to see how it can be used.
python src/scripts/run.py --helpYou will be prompted to enter your Planet API Key the first time you run the script.
Download files for a single month/year combination
python src/scripts/run.py --config-file config.yaml --year 2022 --month 11This will download data for the year 2022 and the month of November (11).
Download files for multiple month/year combinations
python src/scripts/run.py --config-file config.yaml --year 2020 --year 2021 --year 2022 --month 09 --month 10 --month 11This will download data for 3 years (2020, 2021, 2022) and 3 months (Set, Oct, Nov) for a total of 9 year/month combindations. You must provide at least 1 year and 1 month.
You can inspect the results of a download using an included jupyter notebook.
Launch jupyter notebook
jupyter notebook --notebook-dir=notebooks --port=8892Run the notebook inspect.ipynb to visualize the downloaded results.
conda activate planet_download
./lint.shAfter changing the environment.yml file, run
conda activate planet_download
conda env update --file environment.yml --prune
conda activate planet_download