|
15 | 15 | import pycurl
|
16 | 16 | from boto.exception import NoAuthHandlerFound
|
17 | 17 |
|
18 |
| -from downloader import Downloader, IncorrectSceneId |
| 18 | +from downloader import Downloader, IncorrectSceneId, RemoteFileDoesntExist, USGSInventoryAccessMissing |
19 | 19 | from search import Search
|
20 | 20 | from uploader import Uploader
|
21 | 21 | from utils import reformat_date, convert_to_integer_list, timer, exit, get_file, convert_to_float_list
|
|
109 | 109 |
|
110 | 110 | --force-unzip Force unzip tar file
|
111 | 111 |
|
| 112 | + --username USGS Eros account Username (only works if the account has special |
| 113 | + inventory access). Username and password as a fallback if the image |
| 114 | + is not found on AWS S3 or Google Storage |
| 115 | +
|
| 116 | + --password USGS Eros account Password |
| 117 | +
|
112 | 118 | Process:
|
113 | 119 | landsat.py process path [-h] [-b --bands] [-p --pansharpen]
|
114 | 120 |
|
@@ -220,6 +226,10 @@ def args_options():
|
220 | 226 | '50.2682767372753')
|
221 | 227 | parser_download.add_argument('-u', '--upload', action='store_true',
|
222 | 228 | help='Upload to S3 after the image processing completed')
|
| 229 | + parser_download.add_argument('--username', help='USGS Eros account Username (only works if the account has' + |
| 230 | + ' special inventory access). Username and password as a fallback if the image' + |
| 231 | + 'is not found on AWS S3 or Google Storage') |
| 232 | + parser_download.add_argument('--password', help='USGS Eros username, used as a fallback') |
223 | 233 | parser_download.add_argument('--key', help='Amazon S3 Access Key (You can also be set AWS_ACCESS_KEY_ID as '
|
224 | 234 | 'Environment Variables)')
|
225 | 235 | parser_download.add_argument('--secret', help='Amazon S3 Secret Key (You can also be set AWS_SECRET_ACCESS_KEY '
|
@@ -368,7 +378,7 @@ def main(args):
|
368 | 378 | return json.dumps(result)
|
369 | 379 |
|
370 | 380 | elif args.subs == 'download':
|
371 |
| - d = Downloader(download_dir=args.dest) |
| 381 | + d = Downloader(download_dir=args.dest, usgs_user=args.username, usgs_pass=args.password) |
372 | 382 | try:
|
373 | 383 | bands = convert_to_integer_list(args.bands)
|
374 | 384 |
|
@@ -415,6 +425,8 @@ def main(args):
|
415 | 425 | return ['Download Completed', 0]
|
416 | 426 | except IncorrectSceneId:
|
417 | 427 | return ['The SceneID provided was incorrect', 1]
|
| 428 | + except (RemoteFileDoesntExist, USGSInventoryAccessMissing) as e: |
| 429 | + return [e.message, 1] |
418 | 430 |
|
419 | 431 |
|
420 | 432 | def process_image(path, bands=None, verbose=False, pansharpen=False, ndvi=False, force_unzip=None,
|
|
0 commit comments