Skip to content

Python function that allows you to subset Landsat Collection 2 metadata (by row, path, tier, cloud cover, dates, and mission) and save image IDs in a txt file for later ingestion by M2M Landsat API. Compatible with Landsat 4,5,7,8 Level 1 and Level 2.

Notifications You must be signed in to change notification settings

cez2020/usgs_landsat_collection_2_metadata_subsetting_made_easy

Repository files navigation

Generate a LIST of USGS Collection 2 Image IDs for ingestion by USGS/EROS Machine-to-Machine API for BULK download.

Metadata subsetting tool in the form of a Python function.
The tool allows a user to subset a USGS Collection 2 metadata CSV file using the following parameters:

  • Path
  • Row
  • Tier (1 or 2)
  • Cloud Cover (<= than %)
  • Timeframe (from/to)
  • Previous Image ID list (if available--to avoid repeated image downloads)
  • Mission (Landsat 4-5,7,8 Level-1 or Level-2)

Requires

  • User credentials to login to USGS EarthExplorer (free).
  • Approved access to USGS machine-to-machine API (request for free here).
  • A USGS metadata CSV file (may be obtained here). screenshot1
  • Alternatively, a smaller metada CSV file may be obtained in Earth Explorer: screenshot2
  • Row and Path information may be obtained in the attached kml file or in this link. Examples:
    Catalunya, Spain:
    usgsPaths = [197, 198, 199]
    usgsRows = [30, 31, 32] screenshot3

Big Island, Hawaii:
usgsPaths = [62, 63]
usgsRows = [46, 47] screenshot4

Uruguay:
usgsPaths = [222, 223, 224, 225]
usgsRows = [81, 82, 83, 84] screenshot5

Output

A clean TXT file that can be used as input in the USGS/EROS Machine-to-Machine API for BULK download.
TXT file will contain required header and image IDs. screenshot6

Machine-to-Machine API

  • Link here
  • In API, enter the name of TXT file as input in the code:
    scenesFile = 'scenes.txt'
  • Pay attention to directories.
  • Have fun!
    screenshot7

About

Python function that allows you to subset Landsat Collection 2 metadata (by row, path, tier, cloud cover, dates, and mission) and save image IDs in a txt file for later ingestion by M2M Landsat API. Compatible with Landsat 4,5,7,8 Level 1 and Level 2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages