• Stars
    star
    611
  • Rank 72,899 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

interactive notebooks from Planet Engineering

Planet Interactive Guides

Join the chat at https://gitter.im/planetlabs/notebooks

In this repository, you'll find a collection of Jupyter notebooks from the software developers, data scientists, and developer advocates at Planet. These interactive, open-source (APLv2) guides are designed to help you explore Planet data, work with our APIs and tools, and learn how to extract information from our massive archive of high-cadence satellite imagery. We hope these guides will inspire you to ask interesting questions of Planet data. Need help? Find a bug? Please file an issue and we'll get back to you.

Install and use these notebooks

System Prerequisites

NOTE: After installing Docker, Windows users should install WSL2 Backend when prompted.

Clone or update repo:

If you've never cloned the Planet notebooks repo, run the following:

git clone https://github.com/planetlabs/notebooks.git
cd notebooks

If you have previously cloned the Planet notebooks repo in the past, make sure to update to pull any changes locally that might have happened since you last interacted with the Planet notebooks:

cd notebooks
git pull

Authentication

Access your Planet API Key in Python

Authentication with Planet's API Key can be achieved by using a valid Planet API Key.

You can export your API Key as an environment variable on your system:

export PL_API_KEY="YOUR-API-KEY"

If you wish to have your API Key be persistent (forever stored as PL_API_KEY), then you may enter this export command in your ~/.bashrc or ~/.zshrc file. If you are using our Docker environment, as is defined below, it will already be set.

In Python, we set up an API Key variable, PLANET_API_KEY, from an environment variable to use with our API requests:

# Import the os module in order to access environment variables
import os

# Set up the API Key from the `PL_API_KEY` environment variable
PLANET_API_KEY = os.getenv('PL_API_KEY')

Now, your Planet API Key is stored in the variable PLANET_API_KEY and is ready to use in your Python code.

Run Planet Notebooks in Docker

Planet Notebooks rely on a complex stack of technologies that are not always easy to install and properly configure. To ease this complexity we provide a docker container for running the notebook on docker compatible systems. To install docker on your system please see docker's documentation for your operating system.

Download prebuilt Docker image (recommended)

The Docker image for these notebooks is hosted in the planetlabs/notebooks repo on DockerHub. To download and prepare the image for use, run:

cd notebooks
docker pull planetlabs/notebooks
docker tag planetlabs/notebooks planet-notebooks

# If you get errors running the above, you might have to add sudo to the beginning:
#sudo docker pull planetlabs/notebooks
#sudo docker tag planetlabs/notebooks planet-notebooks

If you want to re-build the Docker image yourself, this is documented below in the "Appendix: Build the Docker image" section.

Run the container

To run the container (after building or downloading it), add your Planet API key below and issue the following command from the git repository root directory:

docker run -it --rm -p 8888:8888 -v $PWD:/home/jovyan/work -e PL_API_KEY='[YOUR-API-KEY]' planet-notebooks

# If you get a permissions error running the above, you should add sudo to the front:
# sudo docker run -it --rm -p 8888:8888 -v $PWD:/home/jovyan/work -e PL_API_KEY='[YOUR-API-KEY]' planet-notebooks
# Windows users run: winpty docker run -it --rm -p 8888:8888 -v "/$PWD":/home/joyvan/work -e PL_API_KEY='[YOUR-API-KEY]' planet-notebooks

This does several things:

  1. Maps the docker container's 8888 port to your system's 8888 port. This makes the container available to your host systems web browser.

  2. Maps a host system path $PWD to the docker container's working directory. This ensures that the notebooks you create, edit, and save are available on your host system under the jupyter-notebooks sub-directory and are not destroyed when you exit the container. This also allows for running tests in the tests sub-directory.

  3. Ensures that the directory in the Docker container named /home/jovyan/work that has the notebooks in them is accessible to the Jupyter notebook server.

  4. Starts an interactive terminal that is accessible through http://localhost:8888.

  5. Sets an environment variable with your unique Planet API key for authenticating against the API.

  6. Includes the --rm option to clean up the notebook after you exit the process.

Open Jupyter notebooks

Once the Docker container is running, the CLI output will display a URL that you will use to access Jupyter notebooks with your browser.

http://localhost:8888/?token=<UNIQUE-TOKEN>

NOTE: This security token will change every time you start your Docker container.

Available notebooks

NOTE: PSScene3Band and PSScene4Band item type and assets will be deprecated by January 2023. These item types will not be available for new customers provisioned after March 1, 2022. We recommend all customers who are interested in medium resolution imagery use the PSScene item type as soon as possible.

Search, activate, download with the Data API

Ordering, delivery, and tools with the Orders API

Process Planet data

Analyze and visualize Planet data

Soon we hope to add notebooks from the researchers, technologists, geographers, and entrepreneurs who are already using Planet data to ask interesting and innovative questions about our changing Earth. If you're working with our imagery and have a notebook (or just an idea for a notebook) that you'd like to share, please file an issue and let us know.

Appendix: Build the Docker image

This documents how to build the docker image yourself, rather than using the recommended step of downloading pre-built Docker images. This is useful if you are a developer adding dependencies or a new Jupyter notebook to this repo, for example.

First you must build the docker image. Note, this only has to be done the first time you use it. After checking out the repository, you run:

cd planet-notebook-docker
docker build --rm -t planet-notebooks .
cd ..

This will build and install the Docker image on your system, making it available to run. This may take some time (from 10 minutes to an hour) depending on your network connection and how long Anaconda takes to configure its environment.

More Repositories

1

draino

Automatically cordon and drain Kubernetes nodes based on node conditions
Go
614
star
2

planet-client-python

Python client for Planet APIs
Python
270
star
3

gpq

Utility for working with GeoParquet
Go
137
star
4

plcompositor

seamless and cloudless image mosaics from deep stacks of satellite imagery
C++
101
star
5

kubehook

A JWT based Kubernetes webhook authentication service.
Go
83
star
6

planet-amazon-deforestation

Jupyter Notebook
68
star
7

viewpoints

Viewpoints is a tool for visualizing high dimensionality data using linked scatter plots.
JavaScript
63
star
8

staccato

Java implementation of the STAC spec
Java
49
star
9

maxrect

Find the maximally inscribed, axis-aligned rectangle for a given polygon
Python
48
star
10

maps

Declarative mapping components for React
JavaScript
48
star
11

stratus

Java
46
star
12

qgis-planet-plugin

Browse, filter, preview and download Planet Inc imagery in QGIS.
Python
45
star
13

radiometric_normalization

Implementation of radiometric normalization workflows
Python
33
star
14

color_balance

Balance your colors!
Python
30
star
15

fio-planet

Python
26
star
16

client

JavaScript client for the Planet imagery API
JavaScript
25
star
17

numpytiles-spec

23
star
18

go-stac

Utilities for working with STAC resources
Go
17
star
19

datalake

a metadata-aware file archive
JavaScript
17
star
20

planet-view

Extension for Google Chrome displaying Planet Labs imagery
JavaScript
16
star
21

training-workshop

Jupyter Notebook
12
star
22

ol-maps

Custom builds of OpenLayers 3
Makefile
11
star
23

ol-numpytiles

JavaScript
11
star
24

go-ogc

Utilities for working with OGC APIs
Go
11
star
25

cloudshadow

Attempt to detect cloud shadows
Python
9
star
26

stac-extension

STAC extension for Planet data
JavaScript
9
star
27

planet-tmask

Python
8
star
28

legion

Legion serves a Kubernetes mutating admission webhook that mutates pods. Pods are mutated according to a PodMutation, which configures how pod fields are set, altered, or appended during mutation.
Go
8
star
29

datalake-ingester

Python
7
star
30

hal5d

An haproxy shim for linkerd Kubernetes ingress
Go
7
star
31

planet_stack_finder

Find locations of overlapping geometries
Python
6
star
32

eslint-config-planet

ESLint config for Planet projects
JavaScript
6
star
33

klondike

Python
6
star
34

dta

DekTek driver for Ubuntu
C
6
star
35

kostanza

Go
6
star
36

planet-order-ps

Open a downloaded Planet order in Photoshop
JavaScript
5
star
37

flake8-continuation

Python
4
star
38

spectastic

Request and response validation against swagger schemas.
Python
4
star
39

colorCorrection

A small demo of client-side color correction of an image
JavaScript
4
star
40

cosmolog

Python
4
star
41

crtime

simple utility for determining the creation time of a file on Linux
Shell
4
star
42

es_fluent

A fluent API for ES query construction.
Python
3
star
43

homebrew-tap

Planet Labs Homebrew Formulae
Ruby
3
star
44

feature_finder

Find scenes that overlap OSM features by feature category (e.g. airports)
Python
3
star
45

pyqspline

C
3
star
46

planetcoveragefinder

Tool to find cloud-free coverages of an area using PlanetScope scenes
Python
3
star
47

datalake-api

JavaScript
2
star
48

web-dev

Tips, tech, and tactics for Planet web developers
2
star
49

linkin

linkerd flavoured Zipkin trace propagation for Opencensus
Go
2
star
50

pl-cartodb-source

C++
1
star
51

chrome-wikipedia-linkerizer

Add a scenes link to wikipedia lat/long links.
JavaScript
1
star
52

datalake-common

Python
1
star
53

open-stac

Open STAC Resources
Makefile
1
star
54

planet-css

CSS reset and some basic styles that comply with Planet design
CSS
1
star
55

orders-workshop

1
star