-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
111 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
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 | ||
--------------------------------------------------- | ||
|
||
.. code:: python | ||
from lsru import Usgs | ||
import datetime | ||
# Define query extent | ||
bbox = (3.5, 43.4, 4, 44) | ||
# Instantiate Usgs class and login | ||
usgs = Usgs() | ||
usgs.login() | ||
# Query the Usgs api to find scene intersecting with the spatio-temporal window | ||
scene_list = usgs.search(collection='LANDSAT_8_C1', | ||
bbox=bbox, | ||
begin=datetime.datetime(2013,1,1), | ||
end=datetime.datetime(2016,1,1), | ||
max_results=10, | ||
max_cloud_cover=40) | ||
# 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. | ||
|
||
.. code:: python | ||
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']) | ||
print(order.orderid) | ||
# [email protected]' | ||
Check current orders status | ||
--------------------------- | ||
|
||
.. code:: python | ||
for order in espa.orders: | ||
# Orders have their own class with attributes and methods | ||
print('%s: %s' % (order.orderid, order.status)) | ||
# [email protected]: ordered | ||
# [email protected]: complete | ||
# [email protected]: complete | ||
# [email protected]: complete | ||
# [email protected]: complete | ||
Download completed orders | ||
------------------------- | ||
|
||
When Espa finishes pre-processing an order, its status | ||
changes to ``complete``, we can then download the processed scenes. | ||
|
||
.. code:: python | ||
for order in espa.orders: | ||
if order.is_complete: | ||
order.download_all_complete('/media/landsat/download/dir') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
User Guide | ||
========== | ||
|
||
Installation | ||
------------ | ||
|
||
Activate a virtualenv (optional but preferable) and run: | ||
|
||
.. code:: sh | ||
pip install lsru | ||
Setup | ||
----- | ||
|
||
The package requires a configuration file in which usgs credentials are written. | ||
By default the file is called ``~/.lsru`` (this can be modified if you want to join | ||
this configuration with the configuration of another project) and has the following structure. | ||
|
||
:: | ||
|
||
[usgs] | ||
username=your_usgs_username | ||
password=your_very_secure_password | ||
|