Step 1: Setup

Introduction

Setting things up to use bw2preagg is done through a single function, setup_project, which is imported in the namespace with from bw2preagg import *. This function does multiple things to ready your system for sample generation:

  • sets up a brightway2 project. To use an existing project, simply pass overwrite_project=False
  • imports an ecoinvent database from ecoSpold files. To use an existing imported LCI database, simply pass overwrite_database=False. If the database does not exist in the project, or if overwrite_database=True, you must pass a valid path database_dir pointing to a directory with ecoSpold2 files.
  • generates a number of files that are used later and store these in the common_files subdirectory of the result_dir directory. To skip generation of these files if they exist already, simply pass force_write_common_files=False.
  • generates deterministic LCI results for all activities, stored in the deterministic subdirectory of the result_dir directory.

Technical reference

bw2preagg.setup_project.setup_project(project_name, database_name, result_dir, database_dir=None, overwrite_project=False, overwrite_database=False, save_det_lci=True, force_write_common_files=False, default_bw2setup=True)

Create project, import databases and generate common files as required

Parameters:
  • project_name (str) – Name of the brightway2 project in which to import data. If project does not exist, it will be created.
  • database_name (str) – Name of the existing LCI database or to give to the LCI database being imported.
  • result_dir (str) – Path to the directory where data used or generated by bw2preagg is saved.
  • database_dir (str, default=None) – Path to directory with ecoSpold2 data to be imported, None if LCI database is not to be imported (i.e. if it exists already).
  • overwrite_project (bool, default=False) – If True, then the existing project with the name project_name is deleted first, and all data is reimported for a clean slate import.
  • overwrite_database (bool, default=False) – If True, then the existing LCI database with name database_name in the brightway2 project is deleted first, and LCI data is reimported
  • force_write_common_files (bool, default=True) – If True, then the common files are generated even if they already exist at given location
  • save_det_lci (bool, default=True) – If True, deterministic LCI arrays are saved in the deterministic subfolder of the result_dir
  • default_bw2setup (bool, default=True) – If True, run bw2setup to include default elementary flows and LCIA methods
Returns:

Return type:

None