Basic Usage

This example shows how to query the data from a bounding box, order surface reflectance processing for full scenes without reprojection and download.

Define variables and query available scenes to Usgs

from lsru import Usgs
import datetime

# Define query extent
bbox = (3.5, 43.4, 4, 44)

# Instantiate Usgs class and login
usgs = Usgs()

# Query the Usgs api to find scene intersecting with the spatio-temporal window
scene_list ='LANDSAT_8_C1',

# Extract Landsat scene ids for each hit from the metadata
scene_list = [x['displayId'] for x in scene_list]

Place a processing order to Espa

The scene list can be used to send a processing order to Espa via the Espa API.

from lsru import Espa
from pprint import print

# Instantiate Espa class
espa = Espa()

# Place order (full scenes, no reprojection, sr and pixel_qa)
order = espa.order(scene_list=scene_list, products=['sr', 'pixel_qa'])


Check current orders status

for order in espa.orders:
    # Orders have their own class with attributes and methods
    print('%s: %s' % (order.orderid, order.status))

# ordered
# complete
# complete
# complete
# complete

Download completed orders

When Espa finishes pre-processing an order, its status changes to complete, we can then download the processed scenes.

for order in espa.orders:
    if order.is_complete: