Skip to content

Commit

Permalink
Merge pull request #59 from chihacknight/chart-updates
Browse files Browse the repository at this point in the history
converting charts from kw to mw
  • Loading branch information
derekeder authored Jun 19, 2024
2 parents 1d45e73 + ab27294 commit 3eeaba5
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 108 deletions.
4 changes: 2 additions & 2 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>About Illinois Solar Map</h1>
<h2 id="categories-of-solar-projects" class="mt-4">Categories of solar projects</h2>

<p>
All units of power measurement are in kilowatt (KW), specifically alternating current (KWAC).
All units of power measurement are in megawatts (MW), specifically alternating current (MWAC).
</p>
<p>
Solar installations are divided up into 4 categories:
Expand Down Expand Up @@ -68,7 +68,7 @@ <h2 id="solar-installations-over-time" class="mt-4">Solar installations over tim

<figure class="highcharts-figure">
<div id="timeseries-chart"></div>
<p class="highcharts-description"><strong>Description:</strong> Area chart showing the cumulative kilowatts of Utility, Small Distributed Generation, Large Distributed Generation and Community solar installed in Illinois. There is a notable increase in kilowatts installed starting in late 2019.</p>
<p class="highcharts-description"><strong>Description:</strong> Area chart showing the cumulative megawatts of Utility, Small Distributed Generation, Large Distributed Generation and Community solar installed in Illinois. There is a notable increase in megawatts installed starting in late 2019.</p>

</figure>

Expand Down
12 changes: 6 additions & 6 deletions data/final/all_projects_summary.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Category,kW installed,Percent,Project count
Utility,"1,232,600 kW",53.5%,147
Small DG,"478,471 kW",20.8%,"61,900"
Large DG,"345,479 kW",15.0%,"1,298"
Community Solar,"247,326 kW",10.7%,128
Total,"2,303,876 kW",100%,"63,473"
Category,MW installed,Percent,Project count
Utility,"1,233 MW",53.5%,147
Small DG,478 MW,20.8%,"61,900"
Large DG,345 MW,15.0%,"1,298"
Community Solar,247 MW,10.7%,128
Total,"2,304 MW",100%,"63,473"
140 changes: 70 additions & 70 deletions data/final/monthly-aggregate.csv
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
energization_date,CS,Large_DG,Small_DG,Utility
2009-12-01,0.0,0.0,0.0,9000.0
2012-07-01,0.0,0.0,0.0,29000.0
2012-10-01,0.0,0.0,0.0,31600.0
2014-11-01,0.0,0.0,0.0,31900.0
2015-08-01,0.0,0.0,0.0,33100.0
2015-12-01,0.0,0.0,0.0,37800.0
2016-12-01,0.0,0.0,0.0,39800.0
2017-03-01,0.0,0.0,0.0,39900.0
2017-12-01,0.0,0.0,0.0,41900.0
2019-05-01,0.0,80.1,774.7,41900.0
2019-06-01,0.0,1935.4,2196.8,41900.0
2019-07-01,0.0,7599.1,4569.7,41900.0
2019-08-01,0.0,12318.6,10387.3,41900.0
2019-09-01,0.0,12602.4,11406.0,41900.0
2019-10-01,0.0,15046.6,14903.7,41900.0
2019-11-01,0.0,19990.5,20974.4,41900.0
2019-12-01,0.0,20994.0,23641.9,44800.0
2020-01-01,0.0,26533.7,30418.0,45900.0
2020-02-01,0.0,33011.4,38200.6,45900.0
2020-03-01,0.0,36024.7,42912.3,47300.0
2020-04-01,0.0,43145.1,47699.6,47300.0
2020-05-01,900.0,50487.3,57745.5,47300.0
2020-06-01,900.0,57244.1,63354.5,49300.0
2020-07-01,900.0,69954.2,70411.7,50900.0
2020-08-01,900.0,83213.6,81132.3,54100.0
2020-09-01,900.0,89114.5,87058.8,59800.0
2020-10-01,900.0,101409.5,93110.1,66200.0
2020-11-01,2900.0,120075.2,102157.1,73100.0
2020-12-01,2900.0,127580.1,106330.5,128100.0
2021-01-01,2900.0,151926.9,112430.4,133400.0
2021-02-01,25812.0,168440.1,121405.2,146400.0
2021-03-01,27812.0,177679.8,131520.8,150400.0
2021-04-01,38462.0,193997.4,146360.0,164400.0
2021-05-01,60172.0,199815.0,158227.9,182400.0
2021-06-01,60172.0,203654.6,164405.3,192400.0
2021-07-01,64152.0,209181.2,167110.4,307000.0
2021-08-01,90044.0,216505.3,171045.9,315000.0
2021-09-01,90044.0,220639.8,172522.4,429900.0
2021-10-01,97874.0,224739.8,174031.1,437700.0
2021-11-01,113804.0,233888.6,177832.3,643600.0
2021-12-01,113804.0,240595.1,178213.8,659100.0
2022-01-01,115804.0,246389.1,180206.7,659100.0
2022-02-01,137754.0,249583.2,181496.7,661100.0
2022-03-01,145734.0,258061.3,187585.5,670900.0
2022-04-01,149734.0,259280.4,194390.9,670900.0
2022-05-01,168584.0,260991.8,204336.8,672900.0
2022-06-01,178584.0,264739.5,237003.1,674900.0
2022-07-01,178584.0,269114.5,237031.0,744900.0
2022-08-01,178584.0,269144.9,237065.7,897400.0
2022-09-01,178584.0,269144.9,237100.7,897400.0
2022-10-01,178584.0,272943.1,237772.5,897400.0
2022-11-01,186584.0,273869.9,238529.3,899300.0
2022-12-01,186584.0,274045.3,239713.5,899300.0
2023-01-01,186584.0,275367.3,239728.5,899300.0
2023-02-01,186584.0,275403.3,239776.3,925300.0
2023-03-01,186584.0,279652.2,241404.9,925300.0
2023-04-01,186584.0,281285.5,248495.5,925300.0
2023-05-01,206284.0,291383.0,269172.7,927300.0
2023-06-01,206284.0,296907.0,287044.9,927300.0
2023-07-01,206284.0,301745.9,299372.0,927300.0
2023-08-01,217784.0,304004.2,312284.2,927300.0
2023-09-01,217784.0,306613.3,326486.3,933300.0
2023-10-01,217784.0,309006.4,346740.4,937300.0
2023-11-01,223784.0,312340.1,366876.0,1067300.0
2023-12-01,223784.0,316250.2,385479.2,1232600.0
2024-01-01,223784.0,320989.6,408191.6,1232600.0
2024-02-01,247325.7,326914.0,428904.7,1232600.0
2024-03-01,247325.7,333765.2,446804.8,1232600.0
2024-04-01,247325.7,340852.1,461470.2,1232600.0
2024-05-01,247325.7,345439.5,473562.9,1232600.0
2009-12-01,,,,9
2012-07-01,,,,29
2012-10-01,,,,32
2014-11-01,,,,32
2015-08-01,,,,33
2015-12-01,,,,38
2016-12-01,,,,40
2017-03-01,,,,40
2017-12-01,,,,42
2019-05-01,,,1,42
2019-06-01,,2,2,42
2019-07-01,,8,5,42
2019-08-01,,12,10,42
2019-09-01,,13,11,42
2019-10-01,,15,15,42
2019-11-01,,20,21,42
2019-12-01,,21,24,45
2020-01-01,,27,30,46
2020-02-01,,33,38,46
2020-03-01,,36,43,47
2020-04-01,,43,48,47
2020-05-01,1,50,58,47
2020-06-01,1,57,63,49
2020-07-01,1,70,70,51
2020-08-01,1,83,81,54
2020-09-01,1,89,87,60
2020-10-01,1,101,93,66
2020-11-01,3,120,102,73
2020-12-01,3,128,106,128
2021-01-01,3,152,112,133
2021-02-01,26,168,121,146
2021-03-01,28,178,132,150
2021-04-01,38,194,146,164
2021-05-01,60,200,158,182
2021-06-01,60,204,164,192
2021-07-01,64,209,167,307
2021-08-01,90,217,171,315
2021-09-01,90,221,173,430
2021-10-01,98,225,174,438
2021-11-01,114,234,178,644
2021-12-01,114,241,178,659
2022-01-01,116,246,180,659
2022-02-01,138,250,181,661
2022-03-01,146,258,188,671
2022-04-01,150,259,194,671
2022-05-01,169,261,204,673
2022-06-01,179,265,237,675
2022-07-01,179,269,237,745
2022-08-01,179,269,237,897
2022-09-01,179,269,237,897
2022-10-01,179,273,238,897
2022-11-01,187,274,239,899
2022-12-01,187,274,240,899
2023-01-01,187,275,240,899
2023-02-01,187,275,240,925
2023-03-01,187,280,241,925
2023-04-01,187,281,248,925
2023-05-01,206,291,269,927
2023-06-01,206,297,287,927
2023-07-01,206,302,299,927
2023-08-01,218,304,312,927
2023-09-01,218,307,326,933
2023-10-01,218,309,347,937
2023-11-01,224,312,367,1067
2023-12-01,224,316,385,1233
2024-01-01,224,321,408,1233
2024-02-01,247,327,429,1233
2024-03-01,247,334,447,1233
2024-04-01,247,341,461,1233
2024-05-01,247,345,474,1233
2 changes: 1 addition & 1 deletion data/final/solar-projects-by-place.geojson

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions data/scripts/aggregate_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,21 @@ def aggregate_all_projects():
all_projects["cs_pct"] = round(all_projects["cs_kw"] / all_projects["total_kw"] * 100, 1)
all_projects["utility_pct"] = round(all_projects["utility_kw"] / all_projects["total_kw"] * 100, 1)

# convert to MW
all_projects["dg_small_mw"] = int(str(round(all_projects["dg_small_kw"],-3))[:-3])
all_projects["dg_large_mw"] = int(str(round(all_projects["dg_large_kw"],-3))[:-3])
all_projects["cs_mw"] = int(str(round(all_projects["cs_kw"],-3))[:-3])
all_projects["utility_mw"] = int(str(round(all_projects["utility_kw"],-3))[:-3])
all_projects["total_mw"] = int(str(round(all_projects["total_kw"],-3))[:-3])

with open("../final/all_projects_summary.csv", "w") as outfile:
writer = csv.writer(outfile)
writer.writerow(["Category", "kW installed", "Percent", "Project count"])
writer.writerow(["Utility", f'{all_projects["utility_kw"]:,d} kW', f'{all_projects["utility_pct"]}%', f'{all_projects["utility_count"]:,d}'])
writer.writerow(["Small DG", f'{all_projects["dg_small_kw"]:,d} kW', f'{all_projects["dg_small_pct"]}%', f'{all_projects["dg_small_count"]:,d}'])
writer.writerow(["Large DG", f'{all_projects["dg_large_kw"]:,d} kW', f'{all_projects["dg_large_pct"]}%', f'{all_projects["dg_large_count"]:,d}'])
writer.writerow(["Community Solar", f'{all_projects["cs_kw"]:,d} kW', f'{all_projects["cs_pct"]}%', f'{all_projects["cs_count"]:,d}'])
writer.writerow(["Total", f'{all_projects["total_kw"]:,d} kW', '100%', f'{all_projects["total_count"]:,d}'])
writer.writerow(["Category", "MW installed", "Percent", "Project count"])
writer.writerow(["Utility", f'{all_projects["utility_mw"]:,d} MW', f'{all_projects["utility_pct"]}%', f'{all_projects["utility_count"]:,d}'])
writer.writerow(["Small DG", f'{all_projects["dg_small_mw"]:,d} MW', f'{all_projects["dg_small_pct"]}%', f'{all_projects["dg_small_count"]:,d}'])
writer.writerow(["Large DG", f'{all_projects["dg_large_mw"]:,d} MW', f'{all_projects["dg_large_pct"]}%', f'{all_projects["dg_large_count"]:,d}'])
writer.writerow(["Community Solar", f'{all_projects["cs_mw"]:,d} MW', f'{all_projects["cs_pct"]}%', f'{all_projects["cs_count"]:,d}'])
writer.writerow(["Total", f'{all_projects["total_mw"]:,d} MW', '100%', f'{all_projects["total_count"]:,d}'])

def generate_monthly_kw_time_series():
"""calculate aggregated solar by category over time"""
Expand All @@ -191,11 +198,12 @@ def generate_monthly_kw_time_series():
# pivot table to get category columns
monthly_aggregate = monthly_aggregate.pivot(index="energization_date", columns="category", values="kw").reset_index().fillna(0)

# calculate cumulative sum of kw by month
monthly_aggregate["CS"] = monthly_aggregate["CS"].cumsum().round(1)
monthly_aggregate["Large_DG"] = monthly_aggregate["Large_DG"].cumsum().round(1)
monthly_aggregate["Small_DG"] = monthly_aggregate["Small_DG"].cumsum().round(1)
monthly_aggregate["Utility"] = monthly_aggregate["Utility"].cumsum().round(1)
# calculate cumulative sum of MW by month
# round to nearest 1000, convert to int to remove decimal value, convert to string, then slice off the last 3 digits
monthly_aggregate["CS"] = monthly_aggregate["CS"].cumsum().round(-3).astype(int).astype(str).str.slice(0,-3)
monthly_aggregate["Large_DG"] = monthly_aggregate["Large_DG"].cumsum().round(-3).astype(int).astype(str).str.slice(0,-3)
monthly_aggregate["Small_DG"] = monthly_aggregate["Small_DG"].cumsum().round(-3).astype(int).astype(str).str.slice(0,-3)
monthly_aggregate["Utility"] = monthly_aggregate["Utility"].cumsum().round(-3).astype(int).astype(str).str.slice(0,-3)

# export to csv
monthly_aggregate.to_csv("../final/monthly-aggregate.csv", index=False)
42 changes: 24 additions & 18 deletions js/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $.when($.get("/data/final/all_projects_summary.csv")).then(
type: 'pie'
},
title: {
text: 'kW installed by category'
text: 'Percent installed by category'
},
credits: {
enabled: false
Expand All @@ -51,7 +51,7 @@ $.when($.get("/data/final/all_projects_summary.csv")).then(
},
series: [
{
name: 'kW installed',
name: 'MW installed',
colorByPoint: true,
data: [
{
Expand Down Expand Up @@ -109,7 +109,7 @@ $.when($.get("/data/final/all_projects_summary.csv")).then(
enabled: false
},
title: {
text: 'Cumulative kW of solar installed over time'
text: 'Cumulative MW of solar installed over time'
},
xAxis: {
type: 'datetime',
Expand All @@ -120,12 +120,12 @@ $.when($.get("/data/final/all_projects_summary.csv")).then(
},
yAxis: {
title: {
text: 'kilowatts'
text: 'megawatts'
}
},
tooltip: {
shared: true,
valueSuffix: ' kW',
valueSuffix: ' MW',
},
plotOptions: {
area: {
Expand All @@ -142,18 +142,24 @@ $.when($.get("/data/final/all_projects_summary.csv")).then(
}
}
},
series: [{
name: "Utility",
data: utilitySeries
}, {
name: "Small DG",
data: smSeries
}, {
name: "Large DG",
data: lgSeries
}, {
name: "Community Solar",
data: csSeries
}]
series: [
{
name: "Community Solar",
data: csSeries,
color: "#FF6039"
}, {
name: "Large DG",
data: lgSeries,
color: "#00DF6D"
}, {
name: "Small DG",
data: smSeries,
color: "#4D41B9"
}, {
name: "Utility",
data: utilitySeries,
color: "#13A3F9"
}
]
});
});

0 comments on commit 3eeaba5

Please sign in to comment.