Skip to content

Commit

Permalink
adds new parameters to PylcaCelavi class definition and instantiation…
Browse files Browse the repository at this point in the history
… statement in scenario.py #220
  • Loading branch information
rjhanes committed Jan 21, 2025
1 parent 3e3574b commit 3840eca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions celavi/pylca_celavi/des_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
class PylcaCelavi:
def __init__(
self,
data_dir,
liaison_params,
lcia_des_filename,
shortcutlca_filename,
use_shortcut_lca_calculations,
Expand All @@ -29,6 +31,10 @@ def __init__(
lcia_des_filename: str
Path to file that stores calculated impacts for passing back to the
discrete event simulation.
data_dir: str
Path to outer directory of data repository.
liaison_params: Dict
Dictionary of liaison-specific parameters
shortcutlca_filename: str
Path to file where previously calculated impacts are stored. This file
can be used instead of re-calculating impacts from the inventory.
Expand All @@ -42,6 +48,15 @@ def __init__(
Model run. Defaults to zero.
"""
# filepaths for files used in the pylca calculations
self.generated_dir = os.path.join(data_dir, 'generated','liaison')
self.inputs_dir = os.path.join(data_dir, 'inputs','liaison')
# create liaison-specific input directories if they don't exist
for _dir in [self.generated_dir, self.inputs_dir]:
if not os.path.isdir(_dir):
os.makedirs(
_dir
)
self.liaison_params = liaison_params
self.lcia_des_filename = lcia_des_filename
self.shortcutlca_filename = shortcutlca_filename
self.use_shortcut_lca_calculations = use_shortcut_lca_calculations
Expand Down
2 changes: 2 additions & 0 deletions celavi/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ def setup(self):
if self.case["model_run"].get("warning_verbose") == 0:
warnings.filterwarnings('ignore')
self.lca = PylcaCelavi(
data_dir=self.args.data,
liaison_params=self.case['liaison'],
lcia_des_filename=self.files["lcia_to_des"],
shortcutlca_filename=self.files["lcia_shortcut_db"],
use_shortcut_lca_calculations=self.scen["flags"].get(
Expand Down

0 comments on commit 3840eca

Please sign in to comment.