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

tropo_pyaps3: parallel downloads #1195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/mintpy/tropo_pyaps3.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,22 @@ def check_pyaps_account_config(tropo_model):


###############################################################
from concurrent.futures import ThreadPoolExecutor


def dload_grib_files(grib_files, tropo_model='ERA5', snwe=None):
# import pdb; pdb.set_trace()
with ThreadPoolExecutor(max_workers=64) as worker:
futures = []
for grib_file in grib_files:
future = worker.submit(dload_grib_files_worker, [grib_file], tropo_model, snwe)
futures.append(future)
for future in futures:
future.result()

return dload_grib_files_worker(grib_files, tropo_model, snwe)

def dload_grib_files_worker(grib_files, tropo_model='ERA5', snwe=None):
"""Download weather re-analysis grib files using PyAPS
Parameters: grib_files : list of string of grib files
Returns: grib_files : list of string
Expand Down