This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def get_download_url(product: dict, protocol: str) -> str: | |
if protocol not in ['https', 's3']: | |
raise ValueError(f'Unknown protocol {protocol}; must be https or s3') | |
for url in product['umm']['RelatedUrls']: | |
if url['Type'].startswith('GET DATA') and url['URL'].startswith(protocol): | |
return url['URL'] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statistics import mean | |
from datetime import timedelta, datetime | |
import requests | |
from dateutil.parser import parse | |
SESSION = requests.Session() | |
def get_granules(day): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import Session | |
search_url = 'https://cmr.earthdata.nasa.gov/search/granules' | |
parameters = { | |
'scroll': 'true', | |
'provider': 'ASF', | |
'page_size': 2000, | |
# set any search criteria here | |
#'short_name': ['SENTINEL-1A_SP_GRD_HIGH','SENTINEL-1B_SP_GRD_HIGH','SENTINEL-1A_DP_GRD_HIGH','SENTINEL-1B_DP_GRD_HIGH'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route(....) | |
def list_zip_contents(): | |
try: | |
return do_it() | |
except RemoteIoError as e: | |
status_code = get_status_code(e) | |
abort(status_code) | |
except KeyError as e: | |
return 'no such file...', 400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"zip_url": "https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.zip", | |
"zip_filename": "S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.zip", | |
"zip_size": 3799270867, | |
"list_url": "https://unzip-test.asf.alaska.edu/SLC/SA/S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.zip/", | |
"contents": [{ | |
"filename": "S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.SAFE/", | |
"size": 0, | |
"url": "https://unzip-test.asf.alaska.edu/SLC/SA/S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.zip/S1A_IW_SLC__1SDV_20200127T193344_20200127T193411_030990_038F2E_9EF2.SAFE/" | |
}, { |