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

Download failed with dataset id 1 of 2. Re-trying with the next one. None of the archived ids succeeded! Update necessary! #117

Closed
iliasmachairas opened this issue Mar 27, 2024 · 2 comments

Comments

@iliasmachairas
Copy link

iliasmachairas commented Mar 27, 2024

I try to download some landsat images on a loop but it does not work out. I got the following error.

Download failed with dataset id 1 of 2. Re-trying with the next one.
None of the archived ids succeeded! Update necessary!
Error downloading LC08_L1TP_203025_20240323_20240323_02_RT - LC82030252024083LGN00:

I have attached the code I used.

username = 'xxxxxxxx'
password = 'xxxxxxxx'

import time
from landsatxplore.api import API
from landsatxplore.earthexplorer import EarthExplorer
ee = EarthExplorer(username, password)
import os 
api = API(username, password)

api = API(username, password)

scenes = api.search(
    dataset='landsat_ot_c2_l1',
    latitude=50.85,
    longitude=-4.35,
    start_date='2024-03-20',
    end_date='2024-03-25',
    # max_cloud_cover=10,
)

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

max_retries = 3  # Maximum number of download retries

for scene in scenes[:2]:
    landsat_product_id = scene['landsat_product_id']
    landsat_scene_id = scene['landsat_scene_id']
    
    print(f"Downloading {landsat_product_id} - {landsat_scene_id}")
    
    retries = 0
    while retries < max_retries:
        try:
            ee.download(landsat_scene_id, output_dir='new_attempt')
            print("Download completed successfully!")
            break  # Break out of the retry loop if download is successful
        except Exception as e:
            print(f"Error downloading {landsat_product_id} - {landsat_scene_id}: {e}")
            retries += 1
            if retries < max_retries:
                print(f"Retrying... (Attempt {retries})")
                time.sleep(5)  # Add a delay before retrying to avoid overloading the server
            else:
                print("Max retries reached. Skipping this scene.")
    
print("Downloads for the first two scenes completed.")
@Ylken
Copy link

Ylken commented Jul 23, 2024

did you fix that issue? i've encountered the same problem

@iliasmachairas
Copy link
Author

iliasmachairas commented Jul 23, 2024

The package is not maintained. I used the following code to automate the process. https://code.usgs.gov/eros-user-services/machine_to_machine/m2m_landsat_bands_bundle_download

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

2 participants