Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CED method #126

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The LCIA Formatter v1 was peer-reviewed internally at USEPA and externally throu
|ImpactWorld+ Endpoint*|International Reference Center for Life Cycle of Products, Services and Systems (CIRAIG)|[ImpactWorld+](http://www.impactworldplus.org/en/team.php)|
|IPCC GWP|Intergovernmental Panel on Climate Change (IPCC)| |
|FEDEFL Inventory Methods|US Environmental Protection Agency|[FEDEFL Inventory Methods](https://github.com/USEPA/LCIAformatter/wiki/Inventory-Methods)|
|Cumulative Energy Demand|Federal LCA Commons|[FEDEFL Inventory Methods](https://github.com/USEPA/LCIAformatter/wiki/Inventory-Methods)|

\* only works on Windows installations

Expand Down
4 changes: 4 additions & 0 deletions lciafmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pandas as pd

import lciafmt.cache as cache
import lciafmt.ced as ced
import lciafmt.fmap as fmap
import lciafmt.jsonld as jsonld
import lciafmt.traci as traci
Expand All @@ -34,6 +35,7 @@ class Method(Enum):
TRACI = "TRACI 2.1"
RECIPE_2016 = "ReCiPe 2016"
FEDEFL_INV = "FEDEFL Inventory"
CED = "Cumulative Energy Demand"
ImpactWorld = "ImpactWorld"
IPCC = "IPCC"

Expand Down Expand Up @@ -122,6 +124,8 @@ def get_method(method_id, add_factors_for_missing_contexts=True,
return ipcc.get()
if method_id == Method.FEDEFL_INV:
return fedefl_inventory.get(subset)
if method_id == Method.CED:
return ced.get()


def clear_cache():
Expand Down
60 changes: 60 additions & 0 deletions lciafmt/ced.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# ced.py (lciafmt)
# !/usr/bin/env python3
# coding=utf-8
"""
Generate method for Cumulative Energy Demand (CED)
"""

import numpy as np
import pandas as pd

import lciafmt
from lciafmt.util import store_method


def get() -> pd.DataFrame():

inv_orig = lciafmt.get_method(method_id = 'FEDEFL_INV', subset = ['ced'])
inv = inv_orig.copy()
inv['Indicator'] = ''
inv['Method'] = 'Cumulative Energy Demand'

conditions = [
inv['Flowable'].isin(['Wood, primary forest']),
inv['Flowable'].isin(['Biomass', 'Softwood', 'Hardwood', 'Wood']),
inv['Flowable'].isin(['Energy, hydro']),
inv['Flowable'].str.contains('|'.join(['wind', 'solar', 'geothermal'])),
inv['Flowable'].str.contains('Uranium'),
inv['Flowable'].str.contains('|'.join(['Coal', 'Oil', 'Crude',
'gas', 'Methane'])),
]

indicators = ['Non-renewable, biomass',
'Renewable, biomass',
'Renewable, water',
'Renewable, wind, solar, geothermal',
'Non-renewable, nuclear',
'Non-renewable, fossil',
]
inv['Indicator'] = np.select(conditions, indicators, default='')

## Original CED Method included the
# "Energy, fossil, unspecified" technosphere flow;
# this has been dropped
# https://www.lcacommons.gov/lca-collaboration/National_Renewable_Energy_Laboratory/USLCI_Database_Public/dataset/FLOW/46dc4693-2f24-39d2-b69f-dd059737fd5e

## Original CED Method used HHV for biomass/wood flows
# Some wood flows were removed after the original method in FEDEFLv1.0.8

# Dropped flows from FEDEFL inv method: "Hydrogen", "Energy, heat"
inv = inv.query('Indicator != ""').reset_index(drop=True)

return inv


if __name__ == "__main__":
method = lciafmt.Method.CED
df = get()
store_method(df, method)
lciafmt.util.save_json(method, df)
# lciafmt.util.save_json(method, df, write_flows=True)
1 change: 1 addition & 0 deletions lciafmt/data/description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: >+

Source citation: [citation]

mapping: >+
[Method] flowable and context input files are maintained in the FEDEFL
GitHub Repository: https://github.com/USEPA/fedelemflowlist

Expand Down
9 changes: 9 additions & 0 deletions lciafmt/data/lcia.bib
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ @incollection{smith_earths_2021
author = {Smith, Chris and Nicholls, Zebedee R. J. and Armour, Kyle and Collins, William and Forster, Piers and Meinshausen, Malte and Palmer, Matthew D. and Watanabe, Masahiro},
year = {2021},
}

@report{frischknecht_implementation_2007,
title = {Implementation of life cycle impact assessment methods},
url = {https://esu-services.ch/fileadmin/download/publicLCI/03_LCIA-Implementation.pdf},
number = {ecoinvent report No. 3},
author = {Frischknecht, Rolf and Jungbluth, Niels and Althaus, H. J. and Bauer, C. and Doka, G. and Dones, R. and Hischier, R. and Hellweg, S. and Humbert, S. and Köllner, T.},
urldate = {2024-11-13},
year = {2007},
}
13 changes: 12 additions & 1 deletion lciafmt/data/methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"name": "FEDEFL Inventory",
"version": "1.0.0",
"path": "fedefl",
"url": "http://www.github.com/usepa//Federal-LCA-Commons-Elementary-Flow-List",
"url": "https://github.com/USEPA/fedelemflowlist/blob/master/fedelemflowlist/subset_list.py",
"citation": "",
"source_type": "FEDEFL Python function"
},
Expand Down Expand Up @@ -67,6 +67,17 @@
},
"citation": "Forster and Ramaswamy 2007 (AR4), Myhre and Shindell 2013 (AR5), Forster and Storelvmo 2021 (AR6)",
"source_type": "csv"
},
{
"id": "CED",
"name": "Cumulative Energy Demand",
"version": "1.0",
"detail_note": "All heating values are per the FEDEFL, and the list of external references is found on the EPA FEDEFL GitHub at: https://github.com/USEPA/fedelemflowlist. This CED method is based on the categorization scheme used in Frischknecht et al. (2007) found in the ecoinvent report 'Implementation of Life Cycle Impact Assessment Methods.'",
"path": "fedefl",
"bib_id": "frischknecht_implementation_2007",
"url": "https://github.com/USEPA/fedelemflowlist/blob/master/fedelemflowlist/subset_list.py",
"citation": "Frischknecht et al. 2007",
"source_type": ""
}

]
5 changes: 4 additions & 1 deletion lciafmt/fedefl_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get(subset=None) -> pd.DataFrame:
axis=1, inplace=True)
flows['Indicator'] = inventory
flows['Indicator unit'] = subsets.get_inventory_unit(inventory)
flows['Characterization Factor'] = 1
flows['Characterization Factor'] = 1.0

# Apply unit conversions where flow unit differs from indicator unit
flows_w_conversion = pd.merge(flows, alt_units, how='left',
Expand All @@ -56,3 +56,6 @@ def get(subset=None) -> pd.DataFrame:

method['Method'] = 'FEDEFL Inventory'
return method

if __name__ == "__main__":
df = get()
2 changes: 2 additions & 0 deletions lciafmt/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def generate_method_description(name: str,
else:
method_meta = method.get_metadata()
desc += generic['description']
if 'mapping' in method_meta:
desc += generic['mapping']
if 'detail_note' in method_meta:
desc += method_meta['detail_note']
if 'methods' in method_meta:
Expand Down
Loading