kapadia / usgs

Client library for interfacing with USGS datasets
http://kapadia.github.io/usgs/
ISC License
110 stars 38 forks source link

Error Running Sample code from docs #31

Closed TheRizzock closed 7 years ago

TheRizzock commented 7 years ago

I was just trying to use the sample code for the api in the docs and I get this error.

usgs.USGSError: SEARCH_ERROR: Could not complete data field request

kapadia commented 7 years ago

Hi, assuming you mean the following code from the doc, I don't encounter the search error that you post. Please be more specific. Also, ensure that you are logged in using EarthExplorer credentials with machine to machine privileges.

from usgs import api

# Set the EarthExplorer catalog
node = 'EE'

# Set the Hyperion and Landsat 8 dataset
hyperion_dataset = 'EO1_HYP_PUB'
landsat8_dataset = 'LANDSAT_8'

# Set the scene ids
hyperion_scene_id = 'EO1H1820422014302110K2_SG1_01'
landsat8_scene_id = 'LC80290462015135LGN00'

# Submit requests to USGS servers
api.metadata(hyperion_dataset, node, [hyperion_scene_id])
api.metadata(landsat8_dataset, node, [landsat8_scene_id])
TheRizzock commented 7 years ago

Ok, I just browsed the source and realized I get the api key by calling the login function. Didnt know this was a necessary step.

kapadia commented 7 years ago

Great!