Skip to content

Commit

Permalink
fix: disable progress bar for model update
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlangrose committed Jan 18, 2024
1 parent 512ad68 commit 389fac2
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,17 +1760,23 @@ def update(self, verbose=False, progressbar=True):
f"Updating geological model. There are: \n {nfeatures} \
geological features that need to be interpolated\n"
)

from tqdm.auto import tqdm
import time

start = time.time()

# Load tqdm with size counter instead of file counter
with tqdm(total=nfeatures) as pbar:
try:
from tqdm.auto import tqdm
except ImportError:
progressbar = False
logger.warning("Failed to import tqdm, disabling progress bar")

if progressbar:
# Load tqdm with size counter instead of file counter
with tqdm(total=nfeatures) as pbar:
for f in self.features:
pbar.set_description(f"Interpolating {f.name}")
f.builder.up_to_date(callback=pbar.update)
else:
for f in self.features:
pbar.set_description(f"Interpolating {f.name}")
f.builder.up_to_date(callback=pbar.update)

f.builder.up_to_date()
if verbose:
print(f"Model update took: {time.time()-start} seconds")

0 comments on commit 389fac2

Please sign in to comment.