developmentseed / landsat-util

A utility to search, download and process Landsat 8 satellite imagery
Creative Commons Zero v1.0 Universal
689 stars 147 forks source link

Problem to download LC8 image #244

Closed diogocaribe closed 6 years ago

diogocaribe commented 6 years ago

My frieds,

I tried to run code to download LC8 images with python program. However occurred some trouble that I couldn't solve. When I run my code was showed up this massage:

Traceback (most recent call last): File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 73, in download raise RemoteFileDoesntExist landsat.downloader.RemoteFileDoesntExist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 78, in download files.append(self.google_storage(scene, self.download_dir)) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 127, in google_storage self.remote_file_exists(url) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 258, in remote_file_exists raise RemoteFileDoesntExist landsat.downloader.RemoteFileDoesntExist

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/dogsousa/opt/pycharm-community-2017.2.4/helpers/pydev/pydevd.py", line 1599, in globals = debugger.run(setup['file'], None, None, is_module) File "/home/dogsousa/opt/pycharm-community-2017.2.4/helpers/pydev/pydevd.py", line 1026, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/dogsousa/opt/pycharm-community-2017.2.4/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/dogsousa/PycharmProjects/download_landsat/landsat_utils_teste.py", line 22, in d.download([sceneID]) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 80, in download files.append(self.usgs_eros(scene, self.download_dir)) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/landsat/downloader.py", line 99, in usgs_eros download_url = api.download('LANDSAT_8', 'EE', [scene], api_key=api_key) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/usgs/api.py", line 136, in download _check_for_usgs_error(response) File "/home/dogsousa/virtualenviroment/lib/python3.5/site-packages/usgs/api.py", line 35, in _check_for_usgs_error raise USGSError('%s: %s' % (error_code, error)) usgs.USGSError: AUTH_UNAUTHORIZED: Forbidden - Approved role required for access to 'download' method.

I don't know what to do and I need some help to overcome this situation well.

# My code
from landsat import downloader, search

s = search.Search()

ls = s.search(paths_rows="215, 068",
             lat=None,
             lon=None,
             address=None,
             start_date="2015-01-01",
             end_date="2017-11-01",
             cloud_min=None,
             cloud_max=10,
             limit=1,
             geojson=True)

sceneID = ls["features"][0]["properties"]["sceneID"]
# I put the correct user/password to login into USGS site
# I did it with the same user/pass that I used to usgs earthexplorer
d = downloader.Downloader(usgs_user='XXXX',
                          usgs_pass='XXXX',
                          download_dir='~/Download/LC8')

d.download([sceneID])
SalmaSabour commented 6 years ago

Hi :)

I have the same problem, could you please let me know if you found a solution?

Thank you very much.

diogocaribe commented 6 years ago

Hi Salma Sabor,

If you want only image from USGS you have to do what answered me in it (https://gis.stackexchange.com/questions/265660/why-my-sceneid-doesnt-work-to-download-in-landsat-utils).

However if you can download landsat only in Amazon or Google, remove login and password from your python script and it will collect the file in them.

Regards