REGISTER NOW: Brightway Spring School! 🇨🇦 Québec City (Canada) 🗓️ 20.-24. May 2024

bw2data.method#

Module Contents#

Classes#

Method

A manager for an impact assessment method. This class can register or deregister methods, write intermediate data, process data to parameter arrays, validate, and copy methods.

class bw2data.method.Method[source]#

Bases: bw2data.ia_data_store.ImpactAssessmentDataStore

Inheritance diagram of bw2data.method.Method

A manager for an impact assessment method. This class can register or deregister methods, write intermediate data, process data to parameter arrays, validate, and copy methods.

The Method class never holds intermediate data, but it can load or write intermediate data. The only attribute is name, which is the name of the method being managed.

Instantiation does not load any data. If this method is not yet registered in the metadata store, a warning is written to stdout.

Methods are hierarchally structured, and this structure is preserved in the method name. It is a tuple of strings, like ('ecological scarcity 2006', 'total', 'natural resources').

The data schema for IA methods is:

Schema([Any(
    [valid_tuple, maybe_uncertainty],         # site-generic
    [valid_tuple, maybe_uncertainty, object]  # regionalized
)])
where:
  • valid_tuple (tuple): A dataset identifier, like ("biosphere", "CO2").

  • maybe_uncertainty (uncertainty dict or number): Either a number or an uncertainty dictionary.

  • object (object, optional) is a location identifier, used only for regionalized LCIA.

Args:
  • name (tuple): Name of impact assessment method to manage.

_metadata[source]#
matrix = 'characterization_matrix'[source]#
validator[source]#
add_geomappings(data)[source]#
process(**extra_metadata)[source]#

Processes the impact assessment method and updates the metadata, including the identifier.

Parameters#

**extra_metadata

Additional metadata to be included during processing.

Notes#

The method updates the metadata with the list form of the method’s identifier.

process_row(row)[source]#

Given (flow, amount, maybe location), return a dictionary for array insertion.

write(data, process=True)[source]#

Serialize intermediate data to disk.

Sets the metadata key num_cfs automatically.