Skip to content

Commit

Permalink
Merge pull request #7 from jesserobertson/master
Browse files Browse the repository at this point in the history
Fix __enter__ error when show_progress = False in parallel get
  • Loading branch information
Jess Robertson authored Mar 9, 2019
2 parents 58d4774 + dab9b7e commit 778d989
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions explore_australia/stamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,20 @@ def get_coverages(name, lat, lon, angle, distance, no_crs, show_progress=True):
folder.mkdir(parents=True)

# Download data
with tqdm(total=TOTAL_COVERAGES, desc='Downloading coverages') \
if show_progress else None as pbar:
if show_progress:
with tqdm(total=TOTAL_COVERAGES, desc='Downloading coverages') as pbar:
for endpoints, folder in folders:
for layer, endpoint in endpoints.items():
output_tif = folder / f'{layer}.tif'
if not output_tif.exists():
get_stamp(output_tif, endpoint, **kwargs)
pbar.update(1)
else:
for endpoints, folder in folders:
for layer, endpoint in endpoints.items():
output_tif = folder / f'{layer}.tif'
if not output_tif.exists():
get_stamp(output_tif, endpoint, **kwargs)
if show_progress:
pbar.update(1)

def get_coverages_parallel(stamps, logfile='get_stamps.log'):
"""
Expand Down

0 comments on commit 778d989

Please sign in to comment.