"list index out of range" for downloading earth explorer data using python script

1173
2
05-15-2022 11:52 PM
sabafatima
New Contributor II

Hello Developers and Community Members, 

I really need help with a straightforward task that is not running, I hope there are many solid developers and problem solvers who could help me with the problem.

I am actually trying to download USGS Earth explorer Landsat 8 imagery using python libraries.

  1. the first library I used is "API from landsatxplore.api", but when I enter my login credentials and select the scene properties, it gives this error 
    USGSError: UNAUTHORIZED_USER: Unable to validate user API permissions.

    Whereas the code is:

from landsatxplore.api import API

api = API("sabafatima1101", "#Geoinformaticionno1")

scenes = api.search(
dataset='landsat_8_c1',
latitude=33.68,
longitude=73.03,
start_date='2020-8-01',
end_date='2020-10-29',
max_cloud_cover=10
)

  1. the second library I'm using is "EarthExplorer from landsatxplore.earthexplorer", but when I entered my credentials it simply gave an error;
IndexError: list index out of range

whereas the code I wrote is;

ee = EarthExplorer("sabafatima1101", "#Geoinformaticionno1")

 

Anyone who could help me to resolve any error I would be very thankful.

 

0 Kudos
2 Replies
VishnuK
New Contributor

You can send a request to USGS for access controls. Follow the steps below.

  1. Log on to the USGS website
  2. Go to your profile
  3. Go to "Access Request"
  4. Go to "Request Access"
  5. Fill up the form and submit

It usually takes around a week for the review process, and if things are right, they will give you permission for machine to machine access, which is API calls. This will solve the first error. Not so sure about the second one. I am also facing the same issue.

0 Kudos
Nickk1337
New Contributor

Found a fix yet?

0 Kudos