USEPA / ElectricityLCI

Creative Commons Zero v1.0 Universal
24 stars 10 forks source link

Fix output exchange flows mislabeled as resources #233

Open dt-woods opened 4 months ago

dt-woods commented 4 months ago

After noticing the red in the validate database in openLCA, ran a unit test against exchange flows that are outputs with 'resource' in their flow categories. This is what I found:

2024-03-01 18:20:49.465:WARNING:Found resource flow in output exchange! 'Water, fresh' in power plant construction - coal_const (ba733e1a-3d28-3bc7-8bcc-2d23982b6bf0)
2024-03-01 18:20:49.465:WARNING:Found resource flow in output exchange! 'Water, saline' in power plant construction - coal_const (ba733e1a-3d28-3bc7-8bcc-2d23982b6bf0)
2024-03-01 18:20:49.484:WARNING:Found resource flow in output exchange! 'Water, fresh' in power plant construction - ngcc_const (edb67176-ca7d-3370-aa8f-56d1c6f58c1c)
2024-03-01 18:20:49.484:WARNING:Found resource flow in output exchange! 'Water, saline' in power plant construction - ngcc_const (edb67176-ca7d-3370-aa8f-56d1c6f58c1c)

It appears fresh and saline water are labeled as resources but categorized as outputs. The validation error notes these flows are found in both inputs and outputs.

They have positive values (I recall seeing negative emissions in renewable inventories to signify water use, rather than water discharge).

Should these be reclassified as emissions?

dt-woods commented 3 months ago

@m-jamieson

m-jamieson commented 3 months ago

I think it's fine to classify them as output flows (e.g., Elementary flows/emission/water/water, fresh). I'm not aware of any "official" water use metrics using the fedelemflow systems that would be impacted by this type of change.

bl-young commented 3 months ago

Just noting that we have two FEDEFL-inventory impact categories for water consumption, defined here, that capture total water resource use. I don't actually know off the top of my head how resource flows as outputs would be characterized with this method.

dt-woods commented 3 months ago

I tracked down the culprit to the last five lines in this CSV file: https://github.com/USEPA/ElectricityLCI/blob/master/electricitylci/data/plant_construction_inventory.csv

For whatever reason, the compartment mapping dictionary found here: https://github.com/USEPA/ElectricityLCI/blob/2232c41f2cb4fd333ad59c8710aa55906e6a7ed3/electricitylci/power_plant_construction.py#L56 creates two columns: 'Compartment_path' and 'Compartment'.

Compartment_path is correctly labeled as "resource" for both water flows, but "Compartment" is split between "resource" and "water," which might be what's throwing off the compartment mapping done here: https://github.com/USEPA/ElectricityLCI/blob/2232c41f2cb4fd333ad59c8710aa55906e6a7ed3/electricitylci/combinator.py#L147 where "water" is mapped to emission, not resource.

Any ideas on what's going on in the "Compartment" labeling in power_plant_construction.py?

m-jamieson commented 3 months ago

I believe the differences in approaches were just based on the limitations of the data at the time. Almost no resource flows were considered for Power plants as the data sources were all based on emissions - eGRID, AMPD, NEI, etc. I think this results in an emissions-focused mapping for combinator.py.

For power plant construction, that looks like it's in part trying to translate between openLCA reference flows and federal elementary flows, as well as trying to comply with previously established nomenclature for elci (a generic "resource" vs speicifc compartments for emissions).

This is all kind of speculation at this point. The construction pieces were some of the last added and I think the development timeline was such that I was just trying to get it working.

If it's easiest to revisit the whole mapping, I'd maybe suggest doing that - or changing the construction inventory to be natively in fedefl, so that we don't have to do any of this.