Commit
·
4464cba
1
Parent(s):
1f10d97
updated
Browse files- README.md +2 -0
- chart-generators/1.py +1 -1
- chart-generators/2.py +1 -1
- chart-generators/3.py +94 -0
- charts/series-2/3.png +0 -0
README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1 |
# Monetised GHG Emissions Calculator
|
2 |
|
|
|
|
|
3 |
This repository supports a Streamlit interface which will be made available through Hugging Face Spaces to provide a simple interface for converting from companies' greenhouse gas emissions disclosures, released in quantitative terms, and for converting those into their monetized rates according to various social cost of carbon proposals .
|
4 |
|
5 |
This is a second version of an earlier calculator I put together. The reason that this is a new repository is because I accidentally overwrote the data in the first calculator, and since then I've decided to take a slightly different direction with this calculator by including a few additional social cost of carbon (SCC) numbers. Rather than attempt to salvage my first calculator, I figured that it was easier to start this project from scratch bundling together a few changes.
|
|
|
1 |
# Monetised GHG Emissions Calculator
|
2 |
|
3 |
+

|
4 |
+
|
5 |
This repository supports a Streamlit interface which will be made available through Hugging Face Spaces to provide a simple interface for converting from companies' greenhouse gas emissions disclosures, released in quantitative terms, and for converting those into their monetized rates according to various social cost of carbon proposals .
|
6 |
|
7 |
This is a second version of an earlier calculator I put together. The reason that this is a new repository is because I accidentally overwrote the data in the first calculator, and since then I've decided to take a slightly different direction with this calculator by including a few additional social cost of carbon (SCC) numbers. Rather than attempt to salvage my first calculator, I figured that it was easier to start this project from scratch bundling together a few changes.
|
chart-generators/1.py
CHANGED
@@ -2,7 +2,7 @@ import pandas as pd
|
|
2 |
import io
|
3 |
import plotly.graph_objects as go
|
4 |
|
5 |
-
|
6 |
csv_data = """proposal_with_date,organization_name,organization_description,date,country,iso3,iso2,hdi_value,hdi_category,details,original_proposed_value,original_currency_name,original_currency_iso,average_value,usd_proposed_value,use_proposed_value_mtco2e,usd_conversion_date,value_units,environmental_units,methodologies_used,calculation_scope,is_range,
|
7 |
International Foundation for Valuing Impacts (Apr 2024),International Foundation for Valuing Impacts,A non-profit organization working to standardize impact valuation.,2024-04-01,United States,USA,US,0.92,Very High,Proposed a standardized approach for companies to report GHG emissions monetarily.,$236,US dollars,USD,236,236,236000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Standardized impact valuation,Social Cost of Carbon,0,
|
8 |
EPA (Final Report) (Dec 2023),Environmental Protection Agency,The primary federal agency responsible for environmental protection.,2023-12-01,United States,USA,US,0.92,Very High,Updated SCC values using advanced methodologies and lower discount rates.,$120-$340,US dollars,USD,230,230,230000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Advanced methodologies,Social Cost of Carbon,1,
|
|
|
2 |
import io
|
3 |
import plotly.graph_objects as go
|
4 |
|
5 |
+
|
6 |
csv_data = """proposal_with_date,organization_name,organization_description,date,country,iso3,iso2,hdi_value,hdi_category,details,original_proposed_value,original_currency_name,original_currency_iso,average_value,usd_proposed_value,use_proposed_value_mtco2e,usd_conversion_date,value_units,environmental_units,methodologies_used,calculation_scope,is_range,
|
7 |
International Foundation for Valuing Impacts (Apr 2024),International Foundation for Valuing Impacts,A non-profit organization working to standardize impact valuation.,2024-04-01,United States,USA,US,0.92,Very High,Proposed a standardized approach for companies to report GHG emissions monetarily.,$236,US dollars,USD,236,236,236000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Standardized impact valuation,Social Cost of Carbon,0,
|
8 |
EPA (Final Report) (Dec 2023),Environmental Protection Agency,The primary federal agency responsible for environmental protection.,2023-12-01,United States,USA,US,0.92,Very High,Updated SCC values using advanced methodologies and lower discount rates.,$120-$340,US dollars,USD,230,230,230000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Advanced methodologies,Social Cost of Carbon,1,
|
chart-generators/2.py
CHANGED
@@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|
4 |
import matplotlib.dates as mdates
|
5 |
from datetime import datetime
|
6 |
|
7 |
-
|
8 |
csv_data = """proposal_with_date,organization_name,organization_description,date,country,iso3,iso2,hdi_value,hdi_category,details,original_proposed_value,original_currency_name,original_currency_iso,average_value,usd_proposed_value,use_proposed_value_mtco2e,usd_conversion_date,value_units,environmental_units,methodologies_used,calculation_scope,is_range,
|
9 |
International Foundation for Valuing Impacts (Apr 2024),International Foundation for Valuing Impacts,A non-profit organization working to standardize impact valuation.,2024-04-01,United States,USA,US,0.92,Very High,Proposed a standardized approach for companies to report GHG emissions monetarily.,$236,US dollars,USD,236,236,236000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Standardized impact valuation,Social Cost of Carbon,0,
|
10 |
EPA (Final Report) (Dec 2023),Environmental Protection Agency,The primary federal agency responsible for environmental protection.,2023-12-01,United States,USA,US,0.92,Very High,Updated SCC values using advanced methodologies and lower discount rates.,$120-$340,US dollars,USD,230,230,230000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Advanced methodologies,Social Cost of Carbon,1,
|
|
|
4 |
import matplotlib.dates as mdates
|
5 |
from datetime import datetime
|
6 |
|
7 |
+
|
8 |
csv_data = """proposal_with_date,organization_name,organization_description,date,country,iso3,iso2,hdi_value,hdi_category,details,original_proposed_value,original_currency_name,original_currency_iso,average_value,usd_proposed_value,use_proposed_value_mtco2e,usd_conversion_date,value_units,environmental_units,methodologies_used,calculation_scope,is_range,
|
9 |
International Foundation for Valuing Impacts (Apr 2024),International Foundation for Valuing Impacts,A non-profit organization working to standardize impact valuation.,2024-04-01,United States,USA,US,0.92,Very High,Proposed a standardized approach for companies to report GHG emissions monetarily.,$236,US dollars,USD,236,236,236000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Standardized impact valuation,Social Cost of Carbon,0,
|
10 |
EPA (Final Report) (Dec 2023),Environmental Protection Agency,The primary federal agency responsible for environmental protection.,2023-12-01,United States,USA,US,0.92,Very High,Updated SCC values using advanced methodologies and lower discount rates.,$120-$340,US dollars,USD,230,230,230000000,2024-11-20,dollars per ton CO2e,tons of carbon dioxide equivalents,Advanced methodologies,Social Cost of Carbon,1,
|
chart-generators/3.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
+
import seaborn as sns
|
4 |
+
import matplotlib.dates as mdates
|
5 |
+
|
6 |
+
# Load the data from the CSV file
|
7 |
+
file_path = '/home/daniel/Git/Emissions-Monetisation-Calculator/proposals/versions/latest/scc-proposals.csv'
|
8 |
+
df = pd.read_csv(file_path)
|
9 |
+
|
10 |
+
# Convert 'date' to datetime objects
|
11 |
+
df['date'] = pd.to_datetime(df['date'], errors='coerce')
|
12 |
+
|
13 |
+
# Convert 'usd_proposed_value' to numeric, handling errors
|
14 |
+
df['usd_proposed_value'] = pd.to_numeric(df['usd_proposed_value'], errors='coerce')
|
15 |
+
|
16 |
+
|
17 |
+
# Filter out invalid rows.
|
18 |
+
df_filtered = df.dropna(subset=['date', 'usd_proposed_value']).copy()
|
19 |
+
|
20 |
+
# Sort by date
|
21 |
+
df_filtered = df_filtered.sort_values('date')
|
22 |
+
|
23 |
+
|
24 |
+
# Create a dictionary for shortened organization names
|
25 |
+
org_name_map = {
|
26 |
+
"International Foundation for Valuing Impacts": "IFVI",
|
27 |
+
"Environmental Protection Agency": "EPA",
|
28 |
+
"University of California, Davis": "UC Davis",
|
29 |
+
"International Monetary Fund": "IMF",
|
30 |
+
"New York State Agencies": "NY State",
|
31 |
+
"Biden Administration Interagency Working Group": "Biden Admin",
|
32 |
+
"Trump Administration": "Trump Admin",
|
33 |
+
"Climate Leadership Council": "CLC",
|
34 |
+
"Obama Administration Interagency Working Group": "Obama Admin",
|
35 |
+
"UK Government Economic Service": "UK Gov",
|
36 |
+
"Stern Review": "Stern",
|
37 |
+
"Government of Canada": "Canada Gov",
|
38 |
+
"Yale University": "Yale",
|
39 |
+
"Resources for the Future": "RFF",
|
40 |
+
"University College London": "UCL",
|
41 |
+
"Cambridge University": "Cambridge"
|
42 |
+
}
|
43 |
+
|
44 |
+
# Apply shortened names to the DataFrame
|
45 |
+
df_filtered['short_org'] = df_filtered['organization_name'].map(org_name_map)
|
46 |
+
|
47 |
+
|
48 |
+
# Create the line plot
|
49 |
+
plt.figure(figsize=(14, 8))
|
50 |
+
|
51 |
+
# Plot with the short names.
|
52 |
+
sns.lineplot(x='date',
|
53 |
+
y='usd_proposed_value',
|
54 |
+
hue='short_org',
|
55 |
+
data=df_filtered,
|
56 |
+
marker="o", # Add markers
|
57 |
+
markersize=8, # Enlarge markers
|
58 |
+
linewidth=1
|
59 |
+
)
|
60 |
+
|
61 |
+
plt.xlabel('Date')
|
62 |
+
plt.ylabel('Proposed Social Cost of Carbon (USD/ton)')
|
63 |
+
plt.title('Social Cost of Carbon Proposals Over Time by Organization')
|
64 |
+
plt.legend(title='Organization', loc='upper left', bbox_to_anchor=(1, 1))
|
65 |
+
|
66 |
+
# Format x-axis date display
|
67 |
+
date_fmt = mdates.DateFormatter('%Y-%b')
|
68 |
+
plt.gca().xaxis.set_major_formatter(date_fmt)
|
69 |
+
plt.gca().xaxis.set_major_locator(mdates.YearLocator())
|
70 |
+
plt.xticks(rotation=45, ha='right')
|
71 |
+
|
72 |
+
plt.tight_layout(rect=[0, 0, .9, 1])
|
73 |
+
|
74 |
+
# Annotate only the latest point for each organization with larger text.
|
75 |
+
for org in df_filtered['organization_name'].unique():
|
76 |
+
org_df = df_filtered[df_filtered['organization_name'] == org]
|
77 |
+
short_org = df_filtered['short_org'].loc[df_filtered['organization_name'] == org].iloc[0]
|
78 |
+
|
79 |
+
# Get the latest point
|
80 |
+
latest_point = org_df.iloc[-1]
|
81 |
+
|
82 |
+
# Annotate the latest point
|
83 |
+
plt.annotate(f"{short_org}",
|
84 |
+
xy=(latest_point['date'], latest_point['usd_proposed_value']),
|
85 |
+
xytext=(10, 0), # Adjust text position as needed
|
86 |
+
textcoords='offset points',
|
87 |
+
arrowprops=dict(arrowstyle='->', connectionstyle='arc3,rad=0.2'),
|
88 |
+
fontsize=10 # Increase the fontsize of the label
|
89 |
+
)
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
plt.grid(True, axis='y', linestyle='--', alpha=0.7)
|
94 |
+
plt.show()
|
charts/series-2/3.png
ADDED
![]() |