bw2data.method#

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.

Module Contents#

class bw2data.method.Method[source]#

Bases: bw2data.ia_data_store.ImpactAssessmentDataStore

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.

Parameters:

name (*) โ€“ Name of impact assessment method to manage.

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.

_metadata[source]#
matrix = 'characterization_matrix'[source]#
validator[source]#