This repo contains a range of example for working with hyperspectral data.
Note that on EASI, you must save your Earthdata token as a text file and set up a custom Python environment with some extra packages installed. See below for instructions on how to do these two steps.
Notebooks that have been developed include the following:
- 01_EMIT_Basic.ipynb: A basic demonstration of loading data, plotting with holoviews and saving to disk.
- 02_EMIT_Animations.ipynb: Use holoviews to render animations including interactive and video outputs.
- 03_EMIT_Interactive_Points.ipynb: This notebook includes an RGB visualisation that allows the digitisation of points and outputs the spectra at those points.
- 04_EMIT_Interactive_Polygons.ipynb: Interactive visualisation of the mean spectra over a polygon, including variance.
- 05_EMIT_Waterbody_Extraction.ipynb: A worked example that describes a process of identifying waterbodies that may have an algal bloom. This notebook ties together a range of principles from the previous examples.
- 06_EMIT_Segment_Anything.ipynb: Basic example of the use of the Segment Geospatial library.
- 07_S2_Segment_anything.ipynb: Another simple example of the use of Segment Geospatial but using Sentinel-2 data.
There are examples in the pixxel folder that show how to use
that data. And there are some notebooks with XX
at the start of their name that
are less developed.
Code in this repository is available under the Apache 2.0 license unless otherwise noted in the file.
Each notebook has a cell at the top that loads data. You can change the granule
variable to
load a difference granule. To find other granules, you can explore the
STAC API
or the Data Portal.
A selection of reasonably cloud-free scenes have been listed below.
EMIT_L2A_RFL_001_20230316T045211_2307503_006 # Canberra
EMIT_L2A_RFL_001_20230330T000831_2308815_009 # Menindee
EMIT_L2A_RFL_001_20230312T230451_2307115_002 # Chowilla
EMIT_L2A_RFL_001_20230111T084724_2301105_003 # Jurien Bay
EMIT_L2A_RFL_001_20230316T045133_2307503_005 # Lake Hume
EMIT_L2A_RFL_001_20230401T014442_2309101_005 # Pilbara Coast west of Port Hedland
EMIT_L2A_RFL_001_20230316T045223_2307503_007 # Warragamba Dam and hazard reduction burn
EMIT_L2A_RFL_001_20230401T232248_2309115_011 # Coopers Creek
EMIT_L2A_RFL_001_20230116T044730_2301603_002 # Coorong
EMIT_L2A_RFL_001_20220901T022845_2224402_005 # Limmen Bight
EMIT_L2A_RFL_001_20230115T053714_2301503_007 # Lake Frome
EMIT_L2A_RFL_001_20230111T084712_2301105_002 # Pinnacles Cal/Val site
EMIT_L2A_RFL_001_20230322T031752_2308102_008 # St Vincent Gulf seagrass
EMIT_L2A_RFL_001_20230202T222219_2303314_009 # Bowen
EMIT_L2A_RFL_001_20230324T014237_2308301_002 # Melbourne
EMIT_L2A_RFL_001_20230112T062510_2301204_003 # Murray Mouth
EMIT_L2A_RFL_001_20230303T021147_2306201_022 # Quilpie
EMIT_L2A_RFL_001_20230310T012147_2306901_002 # Hamelin Pools
EMIT_L2A_RFL_001_20230401T014249_2309101_003 # Shark Bay Mid
EMIT_L2A_RFL_001_20230401T014301_2309101_004 # Shark Bay North
EMIT_L2A_RFL_001_20230131T221923_2303114_008 # Kerang Lakes
To set up authentication so that you can load EMIT data, do the following:
- Register for an account at https://urs.earthdata.nasa.gov/home
- Visit the
user_tokens
page (the "Generate Token" tab) - Generate a token and copy/save the string
- Either:
- Export it as an environment variable,
export EARTHDATA_TOKEN=abcd...
or add it to your.bashrc
so that it's permanently exported; or - Save it to a text file in your home directory,
echo "abcd..." > ~/EARTHDATA_TOKEN.txt
(or the equivalent on your platform)
- Export it as an environment variable,
- There's a function in the utils.py file that will load the token from these two locations for use in the notebooks.
To use Segment Anything you need to use a GPU instance on EASI. To start a GPU instance, you'll need to stop your current notebook environment (go to the "Hub Control Panel" in the "File" menu and choose "Stop My Server") and then when that's finished shutting down, launch a new server and choose a "Resource Request" that includes a GPU. If you don't have a GPU option, please contact EASI Support.
When you have a GPU instance running, you should activate your custom environment (see below) and then the example notebooks should work.
For local development, you should be able to install the requirements listed in
requirements.txt by running pip install -r requirements.txt
.
Using EASI (the CSIRO Jupyter platform) you can set up a virtual environment following their instructions.
Custom requirements we need include:
pip install segment-geospatial leafmap localtileserver python-geohash odc-stac>=0.3.6