From a3997ffbbc2424c608d94bd5a7178be0d452928d Mon Sep 17 00:00:00 2001 From: Irieo Date: Wed, 10 Jul 2024 18:52:38 +0200 Subject: [PATCH] fix: disable_progressbar in compute_availabilitymatrix --- atlite/gis.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/atlite/gis.py b/atlite/gis.py index d68755d7..d9fa967b 100644 --- a/atlite/gis.py +++ b/atlite/gis.py @@ -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: