pyeo

Contents:

Introduction

Python For Earth Observation is a collection of functions for downloading, manipulating, combining and classifying geospatial raster and vector data.

Installation

With Git and Miniconda or Anaconda installed, cd to an install location then run the following lines

git clone https://github.com/clcr/pyeo.git
cd pyeo
conda env create --file environment.yml --name pyeo_env
conda activate pyeo_env
python -m pip install . -vv

In a Python prompt, try import pyeo - you should see no errors.

Quick start

Before you start, you will need:

  • Git

  • Anaconda/Miniconda

  • A raster of your window area

  • A shapefile of polygons over your training areas with a field containing class labels

  • A raster to classify. This can be the same as your original raster.

    • All rasters and shapefiles should be in the same projection; ideally in the local projection of your satellite data.

Use

You can use pyeo’s command-line functions to create and apply a pixel classification model from a set of polygons and a raster. The below example:

  • saves the training data defined in your_raster.tif and your_shapefile.tif into signatures.csv

  • creates a model from signatures.csv named model.pkl

  • Classifies the whole of your_raster.tif using model.pkl, and saves the result into output_image.tif

conda activate pyeo_env
extract_signatures your_raster.tif your_shapefile.shp signatures.csv
create_model_from_signatures signatures.csv model.pkl
classify_image your_raster model.pkl output_image.tif

A small test suite is located in pyeo/tests/pyeo_tests.py; this is designed for use with py.test. Some example applications and demos are in pyeo/apps; for an illustration of the use of the library, pyeo/apps/change_detection/simple_s2_change_detection.py is recommended.