Skip to content

Commit

Permalink
fix: disable_progressbar in compute_availabilitymatrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Irieo authored and fneum committed Jul 11, 2024
1 parent a3f50a4 commit a3997ff
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion atlite/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,27 @@ def compute_availabilitymatrix(
total=len(shapes),
desc="Compute availability matrix",
)

if nprocesses is None:
logger.info(
"You can disable the progress bar by setting 'disable_progressbar=True'."
)

if not disable_progressbar:
tqdm_kwargs = dict(
ascii=False,
unit=" gridcells",
total=len(shapes),
desc="Compute availability matrix",
)
iterator = tqdm(shapes.index, **tqdm_kwargs)
else:
logger.info("Progress bar is disabled.")
iterator = shapes.index

with catch_warnings():
simplefilter("ignore")
for i in tqdm(shapes.index, **tqdm_kwargs):
for i in iterator:
_ = shape_availability_reprojected(shapes.loc[[i]], *args)[0]
availability.append(_)
else:
Expand Down

0 comments on commit a3997ff

Please sign in to comment.