Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scenes found, but "EarthExplorerError: Download is not available" error comes while downloading #58

Open
abhilashsinghimd opened this issue Apr 27, 2021 · 0 comments

Comments

@abhilashsinghimd
Copy link

abhilashsinghimd commented Apr 27, 2021

import json
from landsatxplore.api import API
from landsatxplore.earthexplorer import EarthExplorer

Initialize a new API instance and get an access key

usgs_username = ""
usgs_password = "
"

api = API(usgs_username, usgs_password)

Search for Landsat TM scenes

scenes = api.search(
dataset='landsat_ot_c2_l1',
latitude=30.9,
longitude=75.85,
#bbox= (70, 28, 80, 32), #(xmin, ymin, xmax, ymax),
start_date='2017-01-01',
end_date='2017-04-01',
max_cloud_cover=10
)

print(f"{len(scenes)} scenes found.")

Process the result

for scene in scenes:
print(scene['acquisition_date'].strftime('%Y-%m-%d'))
# Write scene footprints to disk
fname = f"{scene['landsat_product_id']}.geojson"
with open(fname, "w") as f:
json.dump(scene['spatial_coverage'].geo_interface, f)
print(f)

api.logout()

output

3 scenes found.
2017-03-19
<_io.TextIOWrapper name='LC08_L1TP_148038_20170319_20200904_02_T1.geojson' mode='w' encoding='cp1252'>
2017-03-19
<_io.TextIOWrapper name='LC08_L1TP_148039_20170319_20200904_02_T1.geojson' mode='w' encoding='cp1252'>
2017-02-15
<_io.TextIOWrapper name='LC08_L1TP_148039_20170215_20200905_02_T1.geojson' mode='w' encoding='cp1252'>

Downloading Scenes

ee = EarthExplorer(usgs_username, usgs_password)

ee.download('LC08_L1TP_148038_20170319_20200904_02_T1', output_dir=r'D:\RF_Paper\JAM\MODIS')

ee.logout()

error


EarthExplorerError Traceback (most recent call last)
in
2 ee = EarthExplorer(usgs_username, usgs_password)
3
----> 4 ee.download('LC08_L1TP_148038_20170319_20200904_02_T1', output_dir=r'D:\RF_Paper\JAM\MODIS')
5
6 ee.logout()

~\Anaconda3\lib\site-packages\landsatxplore\earthexplorer.py in download(self, identifier, output_dir, dataset, timeout, skip)
148 data_product_id=DATA_PRODUCTS[dataset], entity_id=entity_id
149 )
--> 150 filename = self._download(url, output_dir, timeout=timeout, skip=skip)
151 return filename

~\Anaconda3\lib\site-packages\landsatxplore\earthexplorer.py in _download(self, url, output_dir, timeout, chunk_size, skip)
90 error_msg = r.json().get("errorMessage")
91 if error_msg:
---> 92 raise EarthExplorerError(error_msg)
93 download_url = r.json().get("url")
94

EarthExplorerError: Download is not available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant