Rule build_co2_emissions¶
The build_co2_emissions rule prepares EDGAR fossil CO2 emissions for the automatic electricity-sector CO2 limit.
It reads the EDGAR Excel workbook retrieved by retrieve_emissions, detects the fossil CO2 emissions sheet, filters the data to Public electricity and heat production, and writes a cleaned CSV with country identifiers and yearly emission values.
This rule is active when electricity.automatic_emission is enabled.
Inputs¶
data/co2_emissions/v60_CO2_excl_short-cycle_org_C_1970_2018.xls
Outputs¶
resources/{run}/co2_emissions_elec_and_heat.csv
The output contains:
country_code_a3: three-letter country codecountry_code_a2: two-letter country codecountry_name: country nameY_YYYY: yearly CO2 emissions in kt CO2
Script Documentation¶
Process global EDGAR CO2 emission data from the raw Excel file into a clean CSV.
Reads the EDGAR CO2 fossil fuel emission Excel file, filters to 'Public electricity and heat production' entries, and saves the result as a CSV with country identifier columns (country_code_a3, country_code_a2, country_name) and year columns for use by prepare_network.
process_edgar_emission_data(excel_file, target_sheet='v6.0_EM_CO2_fossil_IPCC2006')
¶
Process EDGAR CO2 emission Excel data into a clean DataFrame.
Detects the CO2 fossil fuel emissions sheet automatically, filters to 'Public electricity and heat production' rows, and returns a DataFrame with country identifier columns (country_code_a3, country_code_a2, country_name) and year columns (Y_YYYY).
Parameters¶
excel_file : str Path to the EDGAR CO2 emission Excel file (.xls or .xlsx). target_sheet : str, optional Name of the sheet in the Excel file to process. Defaults to 'v6.0_EM_CO2_fossil_IPCC2006'.
Returns¶
pd.DataFrame DataFrame with columns country_code_a3 (three-letter ISO code), country_code_a2 (two-letter ISO code), country_name (full country name), and Y_YYYY columns for each available year.