USEPA / ElectricityLCI

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

groupby in olcaschema_genprocess() expecting 'Balancing Authority Name' when subregion='FERC' #72

Closed WesIngwersen closed 4 years ago

WesIngwersen commented 4 years ago

I encountered the error trying to use electricitylci.write_gen_fuel_database_to_dict() to write the aggregate_df and upstream_dict to a dictionary.. its shouldn't be looking for this field I don't think but it still is

aggregate_dict = electricitylci.write_gen_fuel_database_to_dict( aggregate_df, upstream_dict, subregion=subregion ) Converting generator dataframe to dictionaries... Traceback (most recent call last): File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 2, in aggregate_df, upstream_dict, subregion=subregion File "C:\Users\wesle\ElectricityLCI\electricitylci__init__.py", line 517, in write_gen_fuel_database_to_dict gen_plus_fuel_df, upstream_dict, subregion=subregion File "C:\Users\wesle\ElectricityLCI\electricitylci\alt_generation.py", line 986, in olcaschema_genprocess database_groupby = database.groupby(by=base_cols)

WesIngwersen commented 4 years ago

I ran into this same issue in Master and the gen_altgen_unification branch

m-jamieson commented 4 years ago

I guess it depends on the context of being called. I suspect this is tied to the fact that when creating consumption mixes for FERC we need the BA generation mixes now. This was a change from a couple months ago. If this is coming from combined_build.py , I suspect there are some issues with the ordering in it.

m-jamieson commented 4 years ago

Made the fix in __init__.py to allow writing FERC and US level aggregated data to dictionaries/openLCA. combined_build.py will break once it gets to the consumption mixes because it needs balancing authority aggregated data for the consumption mix. So I guess we need to decide what combined_build.py should do. Should it provide another way that electricitylci can be used to generate openLCA data (i.e., the same thing that main.py does) or should it have a different mission? It could be used just as a demonstration of how to get "data" out of electricitylci and perform a quick plot or something.

Or since main.py exists now, maybe we just get rid of it all together. It feels like there is some utility in providing an example for people to use though.

WesIngwersen commented 4 years ago

Yes I agree that we should just removed the examples ...both build_model and combined_build - because they are antiquated and not building components in a working order... this was superseded by main.py

WesIngwersen commented 4 years ago

both have been removed