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

Better communication of scenario processing message #181

Merged
merged 2 commits into from
Sep 26, 2024
Merged
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
11 changes: 6 additions & 5 deletions premise/new_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,11 +926,14 @@ def update(self, sectors: [str, list, None] = None) -> None:
}

if isinstance(sectors, str):
description = f"Processing scenarios for sector '{sectors}'"
sectors = [
sectors,
]

if sectors is None:
elif isinstance(sectors, list):
description = f"Processing scenarios for {len(sectors)} sectors"
elif sectors is None:
description = "Processing scenarios for all sectors"
sectors = [s for s in list(sector_update_methods.keys())]

assert isinstance(sectors, list), "sector_name should be a list of strings"
Expand All @@ -943,9 +946,7 @@ def update(self, sectors: [str, list, None] = None) -> None:
[item for item in sectors if item not in sector_update_methods]
)

with tqdm(
total=len(self.scenarios), desc="Processing scenarios", ncols=70
) as pbar_outer:
with tqdm(total=len(self.scenarios), desc=description, ncols=70) as pbar_outer:
for scenario in self.scenarios:
# add database to scenarios
try:
Expand Down
Loading