Meta-Process¶
- class metaprocess.MetaProcess(name, outputs, chain, cuts, output_based_scaling=True, **kwargs)¶
- A description of one or several processes from a life cycle inventory database.
- It has the following characteristics:
- It produces one or several output products
- It has at least one process from an inventory database
- It has one or several scaling activities that are linked to the output of the system. They are calculated automatically based on the product output (exception: if output_based_scaling=False, see below).
- Inputs may be cut-off. Cut-offs are remembered and can be used in a linked meta-process to recombine meta-processes to form supply chains (or several, alternative supply chains).
- Args:
- name (str): Name of the meta-process
- outputs ([(key, str, optional float)]): A list of products produced by the meta-process. Format is (key into inventory database, product name, optional amount of product produced).
- chain ([key]): A list of inventory processes in the supply chain (not necessarily in order).
- cuts ([(parent_key, child_key, str, float)]): A set of linkages in the supply chain that should be cut. These will appear as negative products (i.e. inputs) in the process-product table. The float amount is determined automatically. Format is (input key, output key, product name, amount).
- output_based_scaling (bool): True: scaling activities are scaled by the user defined product outputs. False: the scaling activities are set to 1.0 and the user can define any output. This may not reflect reality or original purpose of the inventory processes.
- construct_graph(db)¶
Construct a list of edges.
- Args:
- db (dict): The supply chain database
- Returns:
- A list of (in, out, amount) edges.
- getFilteredDatabase(depending_databases, chain)¶
Extract the supply chain for this process from larger database.
- Args:
- nodes (set): The datasets to extract (keys in db dict)
- db (dict): The inventory database, e.g. ecoinvent
- Returns:
- A filtered database, in the same dict format
- getScalingActivities(chain, edges)¶
Which are the scaling activities (at least one)?
Calculate by filtering for processes which are not used as inputs.
- Args:
- chain (set): The supply chain processes
- edges (list): The list of supply chain edges
- Returns:
- Boolean isSimple, List heads.
- get_edge_lists()¶
Get lists of external and internal edges with original flow values or scaled to the meta-process.
- get_product_inputs_and_outputs()¶
Returns a list of product inputs and outputs.
- get_supply_vector(chain, edges, scaling_activities, outputs)¶
Construct supply vector (solve linear system) for the supply chain of this simplified product system.
- Args:
- chain (list): Nodes in supply chain
- edges (list): List of edges
- scaling_activities (key): Scaling activities
- Returns:
- Mapping from process keys to supply vector indices Supply vector (as list)
- lca(method, amount=1.0, factorize=False)¶
Calculates LCA results for a given LCIA method and amount. Returns the LCA score.
- mp_data¶
Returns a dictionary of meta-process data as specified in the data format.
- pad_cuts()¶
Makes sure that each cut includes the amount that is cut. This is retrieved from self.internal_scaled_edges_with_cuts.
- pad_outputs(outputs)¶
If not given, adds default values to outputs:
- output name: “Unspecified Output”
- amount: 1.0
- Args:
- outputs (list): outputs
- Returns:
- Padded outputs
- pp¶
Property shortcut for returning a list of product intputs and outputs.
- remove_cuts_from_chain(chain, cuts)¶
Remove chain items if they are the parent of a cut. Otherwise this leads to unintended LCIA results.
- save_as_bw2_dataset(db_name='MP default', unit=None, location=None, categories=, []save_aggregated_inventory=False)¶
Save simplified process to a database.
Creates database if necessary; otherwise adds to existing database. Uses the unit and location of self.scaling_activities[0], if not otherwise provided. Assumes that one unit of the scaling activity is being produced.
- Args:
- db_name (str): Name of Database
- unit (str, optional): Unit of the simplified process
- location (str, optional): Location of the simplified process
- categories (list, optional): Category/ies of the scaling activity
- save_aggregated_inventory (bool, optional): Saves in output minus input style by default (True), otherwise aggregated inventory of all inventories linked within the meta-process