-
Notifications
You must be signed in to change notification settings - Fork 11
__init__.py
Description: This is the file containing the main API functions, the functions to be used by the end user. This is also the place where the logging configuration is stored, so if you would like to change the logging level for debugging purposes, it's done here.
Functions:
-
get_generation_process_df()
- Create a dataframe of emissions from power generation by fuel type in each region. kwargs would include the upstream emissions dataframe (upstream_df) if upstream emissions are being included.Parameters:
regions : bool, optional
Regions to include in the analysis (the default is None, which uses the value read from a settings YAML file). Other options include "eGRID", "NERC", "BA", "US", "FERC", and "EIA" -
get_generation_mix_process_df
- Create a dataframe of generation mixes by fuel type in each subregion. This function imports and uses the parameter 'replace_egrid' and 'gen_mix_from_model_generation_data' from model_config.py. If 'replace_egrid' is true or the specified 'regions' is true, then the generation mix will come from EIA 923 data. If 'replace_egrid' is false then the generation mix will either come from the eGRID reference data ('gen_mix_from_model_generation_data' is false) or from the generation data from this model ('gen_mix_from_model_generation_data' is true). -
write_generation_process_database_to_dict
- Create olca formatted dictionaries of individual processes for the dataframe returned byget_generation_process_df
. -
write_generation_mix_database_to_dict
- Create olca formatted dictionaries for the dataframe returned byget_generation_mix_process_df
. Must pass both the generation mix dataframe and the dictionary fromwrite_generation_process_database_to_dict
to properly create the links to the power plant types. -
write_surplus_pool_and_consumption_mix_dict
- Create olca formatted dictionaries for the consumption mix as calculated by consumption_mix.py. Note that this funcion directly pulls the dataframes, converts the data into the dictionary and then returns the dictionary. -
write_distribution_dict
- Create olca formatted dictionaries for the creation of processes that account for electricity distribution losses. -
write_process_dicts_to_jsonld
- Send one or more process dictionaries to be written to json-ld. Multiple dictionaries can be sent to this process at once. -
get_upstream_process_df()
- Automatically loads all of the upstream emissions data from the various modules. Will return a dataframe with upstream emissions from coal, natural gas, petroleum, nuclear, and power plant construction. -
write_upstream_process_database_to_dict
- Convert the upstream dataframe generated byget_upstream_process_df
to dictionaries to be written to json-ld. -
write_upstream_dicts_to_jsonld
- Write the upstream dictionaries, created bywrite_upstream_process_database_to_dict
to jsonld. -
combine_upstream_and_gen_df
- Combine the generation and upstream dataframes (passed as parameters) into a single dataframe. The emissions represented here are the annual emissions for all power plants. This dataframe would be suitable for further analysis. This function should return a dataframe with approximately 5 million rows. -
get_alternate_gen_plus_netl
- This will combine the netl life cycle data for solar, solar thermal, geothermal, wind, and hydro and will include impacts from construction, etc. that would be omitted from the regular sources of emissions. It also uses generation.py to get reported power plant emissions. The two different dataframes are combined to provide a single dataframe representing annual emissions or life cycle emissions apportioned over the appropriate number of years for all reporting power plants. -
aggregate_gen
- Runs the alternate aggregation routine to place all emissions and fuel inputs on the basis of a MWh generated at the power plant gate. This is in preparation for generating power plant unit processes for openLCA. -
add_fuels_to_gen
- Add the upstream fuels to the generation dataframe as fuel inputs. This dataframe is suitable for converting into a dictionary and writing to jsonld to see a complete system in openLCA. Note that 4 different items must be passed to this function: dataframes fromget_alternate_gen_plus_netl
(the generation and Canadian dataframes),get_upstream_process_df
, and the upstream dictionary as returned bywrite_upstream_process_database_to_dict
. The reason for the dictionary is to ensure UUIDs can be used for default providers. -
write_gen_fuel_database_to_dict
- Write the generation dataframe that has been augmented with fuel inputs to a dictionary for conversion to openlca. -
get_distribution_mix_df
- Alternative towrite_distribution_dict
. This function uses EIA data for state-level loss factors. These state-level factors are applied to each plant and then aggregated to the appropriate level. This function returns a dataframe rather than a dictionary. -
write_distribution_mix_to_dict
- Convert the dataframe fromget_distribution_mix_df
into an openLCA formatted dictionary. Must provide the dataframe fromget_distribution_mix_df
and the dictionary as returned bywrite_process_dicts_to_jsonld
, again to allow the use of UUIDs for default providers. -
get_consumption_mix_df
- Alternative towrite_surplus_pool_and_consumption_mix_dict
. This function uses EIA trading data to calculate the consumption mix for balancing authority areas or FERC region. The aggregation choices are limited to these 2 because the data is available only at the balancing authority area. -
write_consumption_mix_to_dict
- Convert the dataframe fromget_consumption_mix_df
into an openLCA formatted dictionary. The dataframe provided byget_consumption_mix_df
and the dictionary returned bywrite_process_dicts_to_jsonld
using the dataframe fromget_generation_mix_process_df
.
Parameters:
-
regions : str, optional
Many of the function calls above have a parameter to specify regions (or subregions). Regions to include in the analysis (the default is None, which uses the value read from a settings YAML file). Other options include "eGRID", "NERC", "BA", "US", "FERC", and "EIA".
List of modules
__init__.py
aggregation_selector.py
ampd_plant_emissions.py
bulk_eia_data.py
cems_data.py
coal_upstream.py
combinator.py
consumption_mix.py
distribution.py
dqi.py
egrid_emissions_and_waste_by_facility.py
egrid_energy.py
egrid_facilities.py
egrid_filter.py
egrid_flowbyfacilty.py
egrid_FRS_matches.py
egrid_subregion_data_writer.py
eia860_facilities.py
eia923_generation.py
eia_io_trading.py
eia_trans_dist_grid_loss.py
elementaryflows.py
emissions_other_sources.py
generation.py
generation_mix.py
geothermal.py
globals.py
hydro_upstream.py
import_impacts.py
main.py
model_config.py
natural_gas_upstream.py
nuclear_upstream.py
olca_jsonld_writer.py
petroleum_upstream.py
PhysicalQuantities.py
plant_water_use.py
power_plant_construction.py
process_dictionary_writer.py
process_exchange_aggregator_uncertainty.py
solar_thermal_upstream.py
solar_upstream.py
technosphereflows.py
upstream_dict.py
utils.py
wind_upstream.py