ImpactIndicator

class qsdsan.ImpactIndicator(ID='', alias='', method='', category='', unit='', description='', **kwargs)

To handle different impact indicators in life cycle assessment.

Parameters:
  • ID (str) – ID of this impact indicator.

  • alias (str) – Alternative name of this impact indicator.

  • method (str) – Impact assessment method, e.g., ‘TRACI’.

  • category (str) – Category of this impact indicator, e.g., ‘human health’.

  • unit (str) – Unit of this impact indicator, e.g., ‘kg CO2-eq’.

  • description (str) – Supplementary explanation.

Examples

Make an impact indicator for global warming potential.

>>> import qsdsan as qs
>>> GWP = qs.ImpactIndicator('GlobalWarming', method='TRACI',
...                          category='environmental impact',
...                          unit='kg CO2-eq',
...                          description='Effect of climate change measured as     ...                                      global warming potential.')

See relevant information.

>>> GWP.show()
ImpactIndicator: GlobalWarming as kg CO2-eq
 Alias      : None
 Method     : TRACI
 Category   : environmental impact
 Description: Effect of climate change ...
>>> # Add an alias
>>> GWP.alias = 'GWP'
>>> GWP.show()
ImpactIndicator: GlobalWarming as kg CO2-eq
 Alias      : GWP
 Method     : TRACI
 Category   : environmental impact
 Description: Effect of climate change ...
>>> # Add another impact indicator
>>> FEC = qs.ImpactIndicator('FossilEnergyConsumption', alias='FEC', unit='MJ')
>>> # Get all impact indicators
>>> qs.ImpactIndicator.get_all_indicators()
{'GlobalWarming': <ImpactIndicator: GlobalWarming>,
 'FossilEnergyConsumption': <ImpactIndicator: FossilEnergyConsumption>}

Manage the registry.

>>> GWP.deregister()
The impact indicator "GlobalWarming" has been removed from the registry.
>>> qs.ImpactIndicator.get_all_indicators()
{'FossilEnergyConsumption': <ImpactIndicator: FossilEnergyConsumption>}
>>> GWP.register()
The impact indicator "GlobalWarming" has been added to the registry.
>>> qs.ImpactIndicator.get_all_indicators()
{'FossilEnergyConsumption': <ImpactIndicator: FossilEnergyConsumption>,
 'GlobalWarming': <ImpactIndicator: GlobalWarming>}
>>> qs.ImpactIndicator.clear_registry()
All impact indicators have been removed from the registry.
>>> qs.ImpactIndicator.get_all_indicators()
{}
>>> # Clear all registries for testing purpose
>>> from qsdsan.utils import clear_lca_registries
>>> clear_lca_registries()
property ID

Unique identification (str). If set as ‘’, it will choose a default ID.

property alias

[str] Alias of this impact indicator.

property category

[str] Impact category of this impact indicator.

classmethod clear_registry(print_msg=True)

Remove all existing impact indicators from the registry.

copy(new_ID='')

Return a new ImpactIndicator object with the same settings.

Parameters:

new_ID (str) – ID of the new impact indicator.

Examples

>>> import qsdsan as qs
>>> GWP = qs.ImpactIndicator('GlobalWarming', alias='GWP', method='TRACI',
...                          category='environmental impact',
...                          unit='kg CO2-eq',
...                          description='Effect of climate change measured as         ...                                      global warming potential.')
>>> GWP.show() 
ImpactIndicator: GlobalWarming as kg CO2-eq
 Alias      : GWP
 Method     : TRACI
 Category   : environmental impact
 Description: Effect of climate change ...
>>> GWP_cp = GWP.copy()
>>> GWP_cp.show() 
ImpactIndicator: ind1 as kg CO2-eq
 Alias      : None
 Method     : TRACI
 Category   : environmental impact
 Description: Effect of climate change ...
deregister(print_msg=True)

Remove this impact indicator from the registry.

property description

[str] Description of this impact indicator.

classmethod get_all_indicators(include_alias=False)

Get all defined impact indicator as a dict.

Parameters:

include_alias (bool) – If True, aliases will be included as keys in the dict as well.

classmethod get_indicator(ID_or_alias)

Get an impact indicator by its ID or alias.

classmethod load_from_file(path_or_df, sheet=None, index_col=None, **kwargs)

Load impact indicator from a datasheet.

The first row of this datasheet should have “indicator” (it is used as the ID, e.g., GlobalWarming), “alias” (e.g., GWP), “unit” (e.g., kg CO2-eq), “method” (e.g., TRACI), “category” (e.g., environmental impact), and “description”. Aside from “indicator”, other information is optional.

Each row should be a data entry.

Note

This function is just one way to batch-load impact indicators, you can always write your own function that fits your datasheet format, as long as it provides all the information to construct the impact indicator.

Parameters:

path_or_df (str or pandas.DataFrame) – DataFrame or complete path of the datasheet, currently support tsv, csv, and xls/xlsx.

See also

Refer, in, Refer

classmethod load_indicators_from_file(path_or_dict, index_col=None)

Same as load_from_file(), has been deprecated.

property method

[str] Impact assessment method of this impact indicator.

register(print_msg=True)

Add this impact indicator to the registry.

property registered

[bool] If this impact indicator is registered in the record.

show()

Show basic information about this impact indicator.

property unit

[str] Unit of this impact indicator.