appabuild.database.databases#
Contains classes to import LCI databases in Brightway project.
Attributes#
Classes#
Abstract class of a Database. Defines two mandatory methods for import. |
|
Abstract class of a Database. Defines two mandatory methods for import. |
|
Handles foreground data. Use datasets must have .json, .yaml or .yml extension to |
|
Impact proxies are datasets used to generate impacts without communicating with |
Module Contents#
- class appabuild.database.databases.Database(name: str)#
Abstract class of a Database. Defines two mandatory methods for import.
Initializes a Database from its name and optionally its path. :param name: name of the database. Should be consistent with the name used in datasets.
- execute_at_startup() None#
Method to be executed when running Appa Build to import the database. Default behavior is to reset all params, and to run import method only if its not already present in Brightway project. :return:
- abstractmethod import_in_project() None#
Import the database in Brightway project. :return:
- name#
- class appabuild.database.databases.EcoInventDatabase(version: str, system_model: str, replace: bool | None = False)#
Bases:
DatabaseAbstract class of a Database. Defines two mandatory methods for import.
Initializes a Database from its name and optionally its path. :param name: name of the database. Should be consistent with the name used in datasets.
- execute_at_startup()#
Method to be executed when running Appa Build to import the database. Default behavior is to reset all params, and to run import method only if its not already present in Brightway project. :return:
- import_in_project()#
Import the database in Brightway project. :return:
- replace = False#
- system_model#
- version#
- class appabuild.database.databases.ForegroundDatabase(name, path)#
Bases:
DatabaseHandles foreground data. Use datasets must have .json, .yaml or .yml extension to be imported. Dataset uuid is dataset file’s name without extension.
Initializes a UserDatabase from its name, its path, its reference flow, and parameters if any. Reference flow has to be specified as import is done in a tree way with reference flow as a root. :param name: user database name :param path: user datasets root location
- execute_at_build_time()#
- execute_at_startup()#
Method to be executed when running Appa Build to import the database. Default behavior is to reset all params, and to run import method only if its not already present in Brightway project. :return:
- find_activities_on_disk() None#
Scans database’s path to import every matching file as a SerializedActivity. Results are stored in object’s context. :return:
- import_in_project() None#
Import user database in Brightway project. Database is declared as foreground for lca_algebraic. This method will transform each used dataset from SerializedActivity and SerializedExchange to Activity and Exchange objects. Parameters are then propagated from the reference flow to the leaf activities. :return:
- set_functional_unit(fu_name: str, parameters: apparun.parameters.ImpactModelParams)#
- context#
- fu_name = ''#
- parameters = None#
- path#
- class appabuild.database.databases.ImpactProxiesDatabase(biosphere_name: str | None = None, replace: bool | None = False)#
Bases:
DatabaseImpact proxies are datasets used to generate impacts without communicating with real biosphere flows and corresponding characterization factors. It can be used to easily import datasets from a database not compatible with Brightway by using another LCA software to do impact computation, or to use data from literature which are often given at the impact level, and not the LCI level. One proxy will be created for each LCIA method. Proxy’s name is “{bw_method_name}_technosphere_proxy”.
Initializes a Database from its name and optionally its path. :param name: name of the database. Should be consistent with the name used in datasets.
- execute_at_startup()#
Method to be executed when running Appa Build to import the database. Default behavior is to reset all params, and to run import method only if its not already present in Brightway project. :return:
- import_in_project() None#
For each LCIA method, one dataset will be created with type biosphere, and another one with type technosphere which will have one unit of the corresponding biosphere proxy as input exchange. Both are necessary as characterization factor has to be connected with a biosphere dataset, and a technosphere dataset is necessary to be used by other technosphere datasets. A characterization factor of one is then added between each method and the corresponding proxy. :return:
- biosphere_name = None#
- replace = False#
- with_ecoinvent#
- appabuild.database.databases.DATA_MODULE = 'appabuild.data'#