Installation

Note

Python must already be installed in your current working environment. Instructions to create a new environment for planetsca are available here.

Attention

For data access, you must have an API key from Planet.

Installing with pip

To install the package, use

pip install --extra-index-url https://test.pypi.org/simple planetsca

Setting up an environment

Setting up a conda environment in the terminal

Find detailed instructions here.

  1. Open a terminal

  2. Create a new environment called “planetenv” with python version 3.8 or greater:

conda create -n planetenv python=3.9
  1. Activate your new environment:

conda activate planetenv
  1. Install planetsca from pip

pip install --extra-index-url https://test.pypi.org/simple planetsca

To use jupyter notebooks with this conda environment:

  1. Activate your new environment:

conda activate planetenv
  1. Install ipykernel:

pip install --user ipykernel
  1. Connect this environment to notebooks:

python -m ipykernel install --user --name=planetenv
  1. When you start a jupyter notebook, you can now select the planetenv environment kernel

Setting up a Virtual Environment (VENV) on VSCode

Creating a VENV is recommended for this project as it ensures that there are no package conflicts and that troubleshooting is much easier. The following instructions are summarized from [here](https://code.visualstudio.com/docs/python/environments).

  1. Open Command Palette (Ctrl + Shift + P)

  2. Select Venv

  3. Select Desired Interpreter Path (I use 3.12.2, minimum version is 3.8)

  4. Notification should show up on the bottom right corner titled “Creating environment (Show logs): Creating venv…

  5. The venv is set up and activated if you see “ _Python Version_ (.’venv’:venv)”

Note

After setting up a venv once, VScode will automatically start up the virtual environment alongside with VScode. There is no need to repeat these steps unless you do not see step 5.

More information on using environments in VScode is available here

Installing for contributors

We welcome new contributions, improvements, and bug fixes! New features and ideas for the package within the scope of snow remote sensing using Planet imagery are also welcome. Please create an issue to discuss a new feature of bug fix.

To contribute code addressing new features or bug fixes, follow these steps:

  1. Clone the repository (or a fork of the repository)

git clone https://github.com/DSHydro/planetsca.git
  1. Go to the repository

cd planetsca
  1. Install the development version of planetsca

pip install -e ".[dev]"
  1. Setup pre-commit

pre-commit install
  1. Create a feature branch with a descriptive name (e.g. bug-fix-planet-api-change). This command will also switch you to this new branch.

git checkout -b new-branch-name
  1. After making your changes, run pre-commit before pushing those changes to your new branch (example below)

git add your_updated_file_here.py
pre-commit
.
.
.
git commit -m 'Bug fixes for planet api change'
git push -u origin bug-fix-planet-api-change
  1. Then submit a pull request (PR) from the feature branch of your fork to DSHydro/planetsca:main

  2. The PR will be reviewed by at least one maintainer, discussed, then merged

Additional information

This package was developed from code by Kehan Yang

Check out the package on TestPyPi: PyPi

Pre-trained Models hosted on Hugging Face: Models

Sample Data hosted on Hugging Face: Data

Find your API Key for accessing Planet imagery: Planet