USEPA / ElectricityLCI

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

Fix region mis-match between consumption and distribution mixes #237

Open dt-woods opened 3 months ago

dt-woods commented 3 months ago

Ran into errors with openLCA due to failed processes being created during the consumption and distribution mix phase of the code (i.e., run_net_trade in __init__.py). It turns out the distribution mix (or rather poorly labeled T&D losses data frames) is not capturing all the regions (e.g., balancing authority names) that are found in the regional consumption mix dictionary (i.e., ba_io_trading results from eia_io_trading.py). Since there are regions in the T&D that are not in the consumption mix, the distribution mix fails to include those missing regions, which leaves the processes without default providers.

I tracked this down to olca_schema_distribution_mix in eia_trans_dist_grid_loss.py, which was a copy-and-paste version of that samiliarly named method, olca_schema_consumption_mix, found in eia_io_trading.py. In the latter, the database is the output of the trading model, which is more or less designed to match the regions within the generation dictionary. In the former, since this is not the case, it needs re-written to guarantee that the consumption regions are preserved, so they make it to the JSON-LD.

I recommend that any consumption mix region that is not found in the T&D regions lists revert to a default T&D loss value (e.g., US average). Preliminary tests for 2021 show that only two BA regions were not matched against T&D losses, they were: