Skip to content

csiro-easi/hyperspectral-notebooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hyperspectral Notebook Examples

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:

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.

Selecting granules to load

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

Authentication using a token from NASA Earth Data

To set up authentication so that you can load EMIT data, do the following:

  1. Register for an account at https://urs.earthdata.nasa.gov/home
  2. Visit the user_tokens page (the "Generate Token" tab)
  3. Generate a token and copy/save the string
  4. Either:
    1. Export it as an environment variable, export EARTHDATA_TOKEN=abcd... or add it to your .bashrc so that it's permanently exported; or
    2. Save it to a text file in your home directory, echo "abcd..." > ~/EARTHDATA_TOKEN.txt (or the equivalent on your platform)
  5. There's a function in the utils.py file that will load the token from these two locations for use in the notebooks.

Using Segment Anything on EASI

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.

Installing extra packages

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