for band in bands:
try:
key = feature['assets'][f'SR_{band}.TIF']['href'].replace(
'https://landsatlook.usgs.gov/data/',
'')
output_file = os.path.join(
f's3://maap-ops-dataset/alexdevseed/landsat8/sample2/{feature["id"]}/'
, os.path.basename(key))
#print(key)
## Uncomment next line to actually download the data as a local sample
#s3.Bucket('usgs-landsat').download_file(key, output_file, ExtraArgs={'RequestPayer':'requester'})
feature['assets'][f'SR_{band}.TIF']['href'] = output_file
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == "404":
print("The object does not exist.")
else:
raise
The s3 path will obviously change once we can use the usgs bucket directly.
I think you're looking for this code
The s3 path will obviously change once we can use the usgs bucket directly.