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

Unexpected mis-matched flows in eLCI.csv #274

Open
dt-woods opened this issue Oct 11, 2024 · 5 comments
Open

Unexpected mis-matched flows in eLCI.csv #274

dt-woods opened this issue Oct 11, 2024 · 5 comments
Assignees

Comments

@dt-woods
Copy link
Collaborator

In the latest eLCI model inventories (e.g., solar, solarthermal, wind), emissions are already mapped to the FEDEFL, which is causing our flow mapping to fail. For example, '1,3-Butadiene' does not match any source flows in eLCI, but matches a target flow.

https://github.com/USEPA/fedelemflowlist/blob/7f2550a383a026ade3d23c8b0e3f6d1ba411bdd3/fedelemflowlist/flowmapping/eLCI.csv#L1206

The result is that mapped flows are being dropped from our inventories.

It would be nice if all the mapped FEDEFL flows were also listed in the sources (i.e., no change; map to itself). If there is an alternative recommendation to updating the CSV, I'm happy to take suggestions.

@bl-young
Copy link
Collaborator

Can you remind me where this is done in the code? I think it could make more sense to pull out the flows in the dataframe which are already in the FEDEFL or have UUID's and only map the remaining? rather than change the mapping file to try to map flows to itself

@dt-woods
Copy link
Collaborator Author

dt-woods commented Oct 16, 2024

Starts on L232 in the current development branch of combinator.py's concat_map_upstream_databases method:

https://github.com/KeyLogicLCA/ElectricityLCI/blob/c2c7194ee1d3adf79ab0705d4149e7b6f57f1521/electricitylci/combinator.py#L154

This basically throws away all non-mapped flows, including those already mapped because they're not in the target list.

Your solution seems practical.

@bl-young
Copy link
Collaborator

Another option would be to use esupy's apply_flow_mapping() which was intended to help streamline mapping operations across packages. I think in this case you could use keep_unmapped_rows=True, but that would only work if you want to keep all unmapped flows, not just those flows that are already FEDEFL.

Though seems reasonable to add to that function another parameter to ignore existing FEDEFL before mapping, much like I suggest above.

@bl-young bl-young closed this as completed Nov 6, 2024
@bl-young bl-young transferred this issue from USEPA/fedelemflowlist Dec 16, 2024
@bl-young bl-young reopened this Dec 16, 2024
@bl-young bl-young self-assigned this Dec 16, 2024
@bl-young
Copy link
Collaborator

bl-young commented Dec 16, 2024

@dt-woods - any tips on the setup to be able to get to a place to test this?

I am trying to run:
df = get_upstream_process_df(2020)

but get a KeyError: 'fuel_group' in
File ~\Code\src\electricitylci\electricitylci\coal_upstream.py:617 in generate_upstream_coal_map
coal_criteria = eia_fuel_receipts_df['fuel_group']=='Coal'

This is on KeyLogic dev branch

ETA: nevermind I needed to remove old f923 downloads

@bl-young
Copy link
Collaborator

Another option would be to use esupy's apply_flow_mapping() which was intended to help streamline mapping operations across packages. I think in this case you could use keep_unmapped_rows=True, but that would only work if you want to keep all unmapped flows, not just those flows that are already FEDEFL.

Because of how the flow names were adjusted (made lowercase) and contexts were added, but FEDEFL UUIDs were not maintained, I determined this solution above is not possible at this time. In the future it would be good to revisit when and how different input files are integrated and mapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants