Skip to content

Commit

Permalink
Included cement carbonation
Browse files Browse the repository at this point in the history
Included cement carbonation in FF and Cement emissions
  • Loading branch information
shanewhi authored Nov 17, 2024
1 parent 8192b44 commit 0115866
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 22 deletions.
Binary file modified Global_Carbon_Budget_2024_v1.0.xlsx
Binary file not shown.
3 changes: 3 additions & 0 deletions chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def column_2_subplots(
x_axis0_interval,
x_axis1_interval,
ylabels,
chart_text,
footer_text,
equiv_yscale,
):
Expand Down Expand Up @@ -191,6 +192,8 @@ def column_2_subplots(
plt.subplots_adjust(left=0.18, right=0.82, wspace=0.13, top=1, bottom=0.02)

# Add plot text.
ax[0].text(1960, 37000, chart_text)

ax[0].set_title(
subplot0_title,
weight=user_globals.Constant.SUBPLOT_TITLE_FONT_WEIGHT.value,
Expand Down
5 changes: 3 additions & 2 deletions collate.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@ def import_data():
sheet_name="Global Carbon Budget",
header=21,
names=[
"FF and Cement",
"FF and Cement Exc Cement Carb",
"Land Use Change",
"Atmospheric Growth",
"Ocean Sink",
"Land Sink",
"Cement Carbonation Sink",
"Budget Imbalance",
"Net FF and Cement",
],
index_col=0,
)
gcp_budget_MtC = gcp_budget_MtC.mul(user_globals.Constant.G_TO_M.value)
gcp_budget_MtC02 = gcp_budget_MtC.mul(user_globals.Constant.C_TO_CO2.value)
gcp_budget_MtC02 = gcp_budget_MtC02.drop(columns=["FF and Cement"])
gcp_budget_MtC02 = gcp_budget_MtC02.drop(columns=["FF and Cement Exc Cement Carb"])
imported_gcp_data = gcp_ff_emissions_MtCO2.join(gcp_budget_MtC02)

esrl_co2_conc = pd.read_csv(
Expand Down
43 changes: 29 additions & 14 deletions output.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ def world_co2_charts(global_carbon):
print(
"CO2 emission treemap, most recent year sum of category shares = "
+ str(sum(global_carbon.final_emission_category_shares["Value"]))
+ "%"
+ "%. Note this is sum of values displayed in chart which are rounded."
)
print(
"CO2 emission treemap, most recent year sum of emission shares = "
+ str(sum(global_carbon.final_emission_shares["Value"]))
+ "%"
+ "%. Note this is sum of values displayed in chart which are rounded."
)

country = global_carbon.name
Expand All @@ -115,11 +115,15 @@ def world_co2_charts(global_carbon):
title_addition = "Year " + str(global_carbon.data["Total"].index[-2])
title1 = "By Category"
title2 = "By Emission Source"
footer_text = "Fossil Fuels is the sum of emissions from coal, oil, gas, and flaring. \
footer_text = ("Fossil Fuels is the sum of Coal, Oil, Gas, and Flaring. \
Labels may not be shown due to a lack of space, so refer to the legend. \
Projected values of Flaring and Other for the current year are unavailable, so last year's data is shown.\n\
Projected values of Flaring and Other for "\
+ str(global_carbon.data["Total"].index[-1]) +
" are unavailable. "\
+ str(global_carbon.data["Total"].index[-2]) +
" data is shown. 'Cement' includes cement carbonation.\n\
By Shane White, whitesha@protonmail.com using Python, https://github.com/shanewhi/world-energy-data. \
Data: Global Carbon Project, Friedlingstein et al (2024), https://globalcarbonbudgetdata.org/latest-data.html."
Data: Global Carbon Project, Friedlingstein et al (2024), https://globalcarbonbudgetdata.org/latest-data.html.")
chart.treemap_2_subplots(
global_carbon.final_emission_category_shares,
global_carbon.final_emission_shares,
Expand All @@ -143,22 +147,31 @@ def world_co2_charts(global_carbon):
####################################################################################################################
# CO2 Emissions: Annual Fossil Fuels + Cement
####################################################################################################################
ffc_co2 = global_carbon.data["FF and Cement"]
ffc_co2 = global_carbon.data["Net FF and Cement"]
co2_color = user_globals.Color.CO2_EMISSION.value
country = "World"
start_yr1 = min(ffc_co2.index)
start_yr2 = user_globals.Constant.CHART_START_YR.value
title = "Annual CO\u2082 Emissions from Fossil Fuels and Cement"
title1 = str(min(ffc_co2.index)) + " - " + str(max(ffc_co2.index))
title1 = str(start_yr1) + " - " + str(max(ffc_co2.index))
title2 = (
str(user_globals.Constant.CHART_START_YR.value)
+ " - "
+ str(ffc_co2.index.max())
)
start_yr1 = global_carbon.data.index.min()
start_yr2 = user_globals.Constant.CHART_START_YR.value

x_axis1_interval = 50
x_axis2_interval = 10
ylabel = "Megatonne (Mt)"
footer_text = "2024 values are projected by the Global Carbon Project.\n\
latest_value_text = (
"Projected value for "
+ str(ffc_co2.index[-1])
+ " = "
#+ str(round(ffc_co2.iloc[-1], 1))
+ f"{(round(ffc_co2.iloc[-1], 1)):,}"
+ "MtCO\u2082"
)
footer_text = "Values include cement carbonation and 2024 value is projected. \
By Shane White, whitesha@protonmail.com using Python, https://github.com/shanewhi/world-energy-data.\n\
Data: Global Carbon Project, Friedlingstein et al (2024), https://globalcarbonbudgetdata.org/latest-data.html."

Expand All @@ -182,6 +195,7 @@ def world_co2_charts(global_carbon):
x_axis1_interval,
x_axis2_interval,
ylabel,
latest_value_text,
footer_text,
False,
)
Expand All @@ -198,11 +212,11 @@ def world_co2_charts(global_carbon):
####################################################################################################################
# CO2 Emissions: Annual change.
####################################################################################################################
series = global_carbon.data["FF and Cement Change"]
series = global_carbon.data["Net FF and Cement Change"]
title = "Annual Change of CO\u2082 Emissions from Fossil Fuels and Cement"
ylabel = "Megatonne per year (Mt/yr)"
footer_text = ("Values are rounded to nearest whole number. \
2024 values are projected by the Global Carbon Project.\n\
footer_text = ("Values are rounded to nearest whole number and include cement carbonation. \
2024 values is projected. \
By Shane White, whitesha@protonmail.com using Python, https://github.com/shanewhi/world-energy-data.\n\
Data: Global Carbon Project, Friedlingstein et al (2024), https://globalcarbonbudgetdata.org/latest-data.html.")
color = user_globals.Color.CO2_EMISSION.value
Expand Down Expand Up @@ -243,7 +257,8 @@ def world_co2_charts(global_carbon):
ylabel = "Megatonne (Mt)"
footer_text = ("By Shane White, whitesha@protonmail.com using Python, \
https://github.com/shanewhi/world-energy-data.\n\
2024 values are projected by the Global Carbon Project. \
2024 values are projected by the Global Carbon Project: Emissions from coal, oil and gas in 2024 are expected to be \
above their 2023 levels by 0.2%, 0.9% and 2.4% respectively. \
Data: Global Carbon Project, Friedlingstein et al (2024), https://globalcarbonbudgetdata.org/latest-data.html.")
equiv_yscale = True
start_yr = global_carbon.data.index.min()
Expand Down
12 changes: 6 additions & 6 deletions process.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ def carbon_emissions(cdata, share_data):
max_year = max(cdata.index)
change_yrs = range(min_year + 1, max_year + 1)
for yr in change_yrs:
cdata.loc[yr, "FF and Cement Change"] = (
cdata.loc[yr, "FF and Cement"] - cdata.loc[yr - 1, "FF and Cement"]
cdata.loc[yr, "Net FF and Cement Change"] = (
cdata.loc[yr, "Net FF and Cement"] - cdata.loc[yr - 1, "Net FF and Cement"]
)
cdata["Total"] = cdata["FF and Cement"] + cdata["Land Use Change"]
cdata["Total"] = cdata["Net FF and Cement"] + cdata["Land Use Change"]

cdata["Fossil Fuel Share"] = (
(cdata["Coal"] + cdata["Oil"] + cdata["Gas"] + cdata["Flaring"])
/ cdata["Total"]
* 100
)
cdata["Cement Share"] = cdata["Cement"] / cdata["Total"] * 100
cdata["Cement Share"] = (cdata["Cement"]-cdata["Cement Carbonation Sink"]) / cdata["Total"] * 100
cdata["Other Share"] = cdata["Other"] / cdata["Total"] * 100
cdata["Land Use Change Share"] = cdata["Land Use Change"] / cdata["Total"] * 100
cdata["Coal Share"] = cdata["Coal"] / cdata["Total"] * 100
Expand All @@ -66,8 +66,8 @@ def carbon_emissions(cdata, share_data):
+ cdata["Land Use Change Share"]
)

# Select second to last element below so as not to display projected values in treemap, because projections were
# unavailable for flaring and other in 2024, and don't want to display values for a combination of years.
# Select second to last element below so as not to display projected values in treemap, because 2024 projections
# are unavailable for 'flaring' and 'other', and shouldn't display values from a combination of years.

final_ff_co2_share = round(cdata["Fossil Fuel Share"].iloc[-2],1)
final_cement_co2_share = round(cdata["Cement Share"].iloc[-2],1)
Expand Down

0 comments on commit 0115866

Please sign in to comment.