Skip to content
Snippets Groups Projects
Commit 738aeda5 authored by root's avatar root
Browse files

Example 10 Redispatch

parent f37ba7ba
No related branches found
No related tags found
No related merge requests found
import json
import pandas as pd
import matplotlib.pyplot as plt
# Read json file
with open("redispatch08-2022.json") as f:
data =json.load(f)
# create pandas dataframe on the list of "communeBottleneckMinutes"
df = pd.json_normalize(data, record_path=["communeBottleneckMinutes"])
# calculate the total amount of Bottleneck minutes
total_bottleneck_minutes = df["totalBottleneckMinutes"].sum()
print("Total amount of bottleneck minutes over all communes: ", total_bottleneck_minutes)
# Get the relative amount of Bottleneck minutes compared to the total amount
df["relativeBottleneckMinutes"] = df["totalBottleneckMinutes"] / total_bottleneck_minutes
# output the top ten highest bottlenecks
df_top_ten = df.sort_values("totalBottleneckMinutes", ascending=False, ignore_index=True).take(range(10))
print("Top Ten longest Bottlenecks\n")
print(df_top_ten)
# Create a scatterplot
plt.scatter(df["totalEegPlants"], df["totalBottleneckMinutes"])
plt.title("Redispatch 08.2022")
plt.xlabel("Total EEG Plants")
plt.ylabel("Total Bottleneck Minutes")
plt.savefig("scatterplot.png")
\ No newline at end of file
{
"maxBottleneckMinutes": 10571,
"totalBottleneckMinutes": 25950,
"communeBottleneckMinutes": [
{
"communeId": "01054103",
"totalBottleneckMinutes": 6420,
"totalEegPlants": 10
},
{
"communeId": "01059158",
"totalBottleneckMinutes": 1160,
"totalEegPlants": 16
},
{
"communeId": "01059179",
"totalBottleneckMinutes": 7304,
"totalEegPlants": 56
},
{
"communeId": "01059123",
"totalBottleneckMinutes": 1822,
"totalEegPlants": 21
},
{
"communeId": "01059149",
"totalBottleneckMinutes": 2780,
"totalEegPlants": 17
},
{
"communeId": "01054124",
"totalBottleneckMinutes": 1151,
"totalEegPlants": 20
},
{
"communeId": "01059143",
"totalBottleneckMinutes": 1152,
"totalEegPlants": 2
},
{
"communeId": "01059144",
"totalBottleneckMinutes": 803,
"totalEegPlants": 2
},
{
"communeId": "01058028",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01058065",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01054020",
"totalBottleneckMinutes": 7557,
"totalEegPlants": 175
},
{
"communeId": "01054005",
"totalBottleneckMinutes": 318,
"totalEegPlants": 1
},
{
"communeId": "01054094",
"totalBottleneckMinutes": 319,
"totalEegPlants": 5
},
{
"communeId": "01054098",
"totalBottleneckMinutes": 319,
"totalEegPlants": 4
},
{
"communeId": "01054015",
"totalBottleneckMinutes": 318,
"totalEegPlants": 1
},
{
"communeId": "01055016",
"totalBottleneckMinutes": 462,
"totalEegPlants": 24
},
{
"communeId": "01055037",
"totalBottleneckMinutes": 461,
"totalEegPlants": 1
},
{
"communeId": "01059057",
"totalBottleneckMinutes": 5816,
"totalEegPlants": 15
},
{
"communeId": "01059086",
"totalBottleneckMinutes": 74,
"totalEegPlants": 1
},
{
"communeId": "01054143",
"totalBottleneckMinutes": 318,
"totalEegPlants": 1
},
{
"communeId": "01054158",
"totalBottleneckMinutes": 318,
"totalEegPlants": 2
},
{
"communeId": "01059115",
"totalBottleneckMinutes": 2703,
"totalEegPlants": 39
},
{
"communeId": "01051026",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 6
},
{
"communeId": "01051064",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 6
},
{
"communeId": "01051012",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 3
},
{
"communeId": "01051022",
"totalBottleneckMinutes": 5430,
"totalEegPlants": 48
},
{
"communeId": "01051097",
"totalBottleneckMinutes": 5429,
"totalEegPlants": 25
},
{
"communeId": "01051138",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 1
},
{
"communeId": "01051010",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 3
},
{
"communeId": "01051099",
"totalBottleneckMinutes": 4880,
"totalEegPlants": 2
},
{
"communeId": "01051089",
"totalBottleneckMinutes": 4722,
"totalEegPlants": 5
},
{
"communeId": "01051016",
"totalBottleneckMinutes": 4722,
"totalEegPlants": 2
},
{
"communeId": "01051051",
"totalBottleneckMinutes": 4722,
"totalEegPlants": 1
},
{
"communeId": "01051032",
"totalBottleneckMinutes": 4723,
"totalEegPlants": 3
},
{
"communeId": "01061061",
"totalBottleneckMinutes": 160,
"totalEegPlants": 3
},
{
"communeId": "01061041",
"totalBottleneckMinutes": 160,
"totalEegPlants": 17
},
{
"communeId": "01056010",
"totalBottleneckMinutes": 159,
"totalEegPlants": 4
},
{
"communeId": "01056051",
"totalBottleneckMinutes": 159,
"totalEegPlants": 3
},
{
"communeId": "01056038",
"totalBottleneckMinutes": 159,
"totalEegPlants": 3
},
{
"communeId": "01061044",
"totalBottleneckMinutes": 160,
"totalEegPlants": 5
},
{
"communeId": "01061101",
"totalBottleneckMinutes": 159,
"totalEegPlants": 1
},
{
"communeId": "01061104",
"totalBottleneckMinutes": 159,
"totalEegPlants": 2
},
{
"communeId": "01056035",
"totalBottleneckMinutes": 160,
"totalEegPlants": 2
},
{
"communeId": "01061006",
"totalBottleneckMinutes": 159,
"totalEegPlants": 3
},
{
"communeId": "01061030",
"totalBottleneckMinutes": 2090,
"totalEegPlants": 29
},
{
"communeId": "01061054",
"totalBottleneckMinutes": 160,
"totalEegPlants": 3
},
{
"communeId": "01054045",
"totalBottleneckMinutes": 5611,
"totalEegPlants": 5
},
{
"communeId": "01054075",
"totalBottleneckMinutes": 10571,
"totalEegPlants": 39
},
{
"communeId": "01054108",
"totalBottleneckMinutes": 9483,
"totalEegPlants": 26
},
{
"communeId": "01054126",
"totalBottleneckMinutes": 2695,
"totalEegPlants": 4
},
{
"communeId": "01054167",
"totalBottleneckMinutes": 3059,
"totalEegPlants": 42
},
{
"communeId": "01054125",
"totalBottleneckMinutes": 3414,
"totalEegPlants": 9
},
{
"communeId": "01054080",
"totalBottleneckMinutes": 1654,
"totalEegPlants": 4
},
{
"communeId": "01054014",
"totalBottleneckMinutes": 6542,
"totalEegPlants": 8
},
{
"communeId": "01055046",
"totalBottleneckMinutes": 895,
"totalEegPlants": 28
},
{
"communeId": "01059183",
"totalBottleneckMinutes": 2385,
"totalEegPlants": 37
},
{
"communeId": "01059174",
"totalBottleneckMinutes": 5595,
"totalEegPlants": 23
},
{
"communeId": "01059132",
"totalBottleneckMinutes": 1674,
"totalEegPlants": 9
},
{
"communeId": "01059169",
"totalBottleneckMinutes": 1104,
"totalEegPlants": 4
},
{
"communeId": "01054011",
"totalBottleneckMinutes": 1105,
"totalEegPlants": 6
},
{
"communeId": "01054037",
"totalBottleneckMinutes": 2858,
"totalEegPlants": 2
},
{
"communeId": "01059128",
"totalBottleneckMinutes": 430,
"totalEegPlants": 1
},
{
"communeId": "01054123",
"totalBottleneckMinutes": 429,
"totalEegPlants": 2
},
{
"communeId": "01054109",
"totalBottleneckMinutes": 7611,
"totalEegPlants": 82
},
{
"communeId": "01054088",
"totalBottleneckMinutes": 6385,
"totalEegPlants": 22
},
{
"communeId": "01054016",
"totalBottleneckMinutes": 2657,
"totalEegPlants": 5
},
{
"communeId": "01054165",
"totalBottleneckMinutes": 3091,
"totalEegPlants": 8
},
{
"communeId": "01054017",
"totalBottleneckMinutes": 2977,
"totalEegPlants": 16
},
{
"communeId": "01054076",
"totalBottleneckMinutes": 3613,
"totalEegPlants": 18
},
{
"communeId": "01054022",
"totalBottleneckMinutes": 2612,
"totalEegPlants": 12
},
{
"communeId": "01054068",
"totalBottleneckMinutes": 6474,
"totalEegPlants": 21
},
{
"communeId": "01054131",
"totalBottleneckMinutes": 1959,
"totalEegPlants": 6
},
{
"communeId": "01054027",
"totalBottleneckMinutes": 2292,
"totalEegPlants": 7
},
{
"communeId": "01054142",
"totalBottleneckMinutes": 1867,
"totalEegPlants": 3
},
{
"communeId": "01054136",
"totalBottleneckMinutes": 1716,
"totalEegPlants": 1
},
{
"communeId": "01054055",
"totalBottleneckMinutes": 1959,
"totalEegPlants": 4
},
{
"communeId": "01054166",
"totalBottleneckMinutes": 1399,
"totalEegPlants": 36
},
{
"communeId": "01054048",
"totalBottleneckMinutes": 1006,
"totalEegPlants": 1
},
{
"communeId": "01058165",
"totalBottleneckMinutes": 281,
"totalEegPlants": 7
},
{
"communeId": "01059042",
"totalBottleneckMinutes": 5816,
"totalEegPlants": 4
},
{
"communeId": "01059044",
"totalBottleneckMinutes": 5817,
"totalEegPlants": 22
},
{
"communeId": "01059081",
"totalBottleneckMinutes": 5816,
"totalEegPlants": 1
},
{
"communeId": "01059010",
"totalBottleneckMinutes": 5816,
"totalEegPlants": 6
},
{
"communeId": "01059159",
"totalBottleneckMinutes": 299,
"totalEegPlants": 2
},
{
"communeId": "01051011",
"totalBottleneckMinutes": 4779,
"totalEegPlants": 19
},
{
"communeId": "01051076",
"totalBottleneckMinutes": 1178,
"totalEegPlants": 4
},
{
"communeId": "01051103",
"totalBottleneckMinutes": 1179,
"totalEegPlants": 6
},
{
"communeId": "01051119",
"totalBottleneckMinutes": 843,
"totalEegPlants": 1
},
{
"communeId": "01054003",
"totalBottleneckMinutes": 554,
"totalEegPlants": 9
},
{
"communeId": "01054097",
"totalBottleneckMinutes": 554,
"totalEegPlants": 4
},
{
"communeId": "01054118",
"totalBottleneckMinutes": 555,
"totalEegPlants": 1
},
{
"communeId": "01058080",
"totalBottleneckMinutes": 289,
"totalEegPlants": 3
},
{
"communeId": "01058173",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01054059",
"totalBottleneckMinutes": 6488,
"totalEegPlants": 46
},
{
"communeId": "01059045",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01058042",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01059051",
"totalBottleneckMinutes": 122,
"totalEegPlants": 4
},
{
"communeId": "01059053",
"totalBottleneckMinutes": 45,
"totalEegPlants": 8
},
{
"communeId": "01055027",
"totalBottleneckMinutes": 1656,
"totalEegPlants": 6
},
{
"communeId": "01055006",
"totalBottleneckMinutes": 462,
"totalEegPlants": 4
},
{
"communeId": "01055029",
"totalBottleneckMinutes": 462,
"totalEegPlants": 1
},
{
"communeId": "01055036",
"totalBottleneckMinutes": 462,
"totalEegPlants": 1
},
{
"communeId": "01055043",
"totalBottleneckMinutes": 462,
"totalEegPlants": 1
},
{
"communeId": "01055023",
"totalBottleneckMinutes": 462,
"totalEegPlants": 1
},
{
"communeId": "01059092",
"totalBottleneckMinutes": 5816,
"totalEegPlants": 11
},
{
"communeId": "01059062",
"totalBottleneckMinutes": 5837,
"totalEegPlants": 8
},
{
"communeId": "01059079",
"totalBottleneckMinutes": 5817,
"totalEegPlants": 9
},
{
"communeId": "01054065",
"totalBottleneckMinutes": 537,
"totalEegPlants": 8
},
{
"communeId": "01054009",
"totalBottleneckMinutes": 364,
"totalEegPlants": 1
},
{
"communeId": "01054086",
"totalBottleneckMinutes": 6017,
"totalEegPlants": 5
},
{
"communeId": "01059116",
"totalBottleneckMinutes": 27,
"totalEegPlants": 1
},
{
"communeId": "01059182",
"totalBottleneckMinutes": 215,
"totalEegPlants": 1
},
{
"communeId": "01051027",
"totalBottleneckMinutes": 486,
"totalEegPlants": 16
},
{
"communeId": "01051017",
"totalBottleneckMinutes": 486,
"totalEegPlants": 3
},
{
"communeId": "01051062",
"totalBottleneckMinutes": 486,
"totalEegPlants": 7
},
{
"communeId": "01051074",
"totalBottleneckMinutes": 485,
"totalEegPlants": 3
},
{
"communeId": "01061083",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 5
},
{
"communeId": "01061024",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 4
},
{
"communeId": "01061119",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061091",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061047",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 3
},
{
"communeId": "01061021",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061059",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061085",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061097",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 2
},
{
"communeId": "01061087",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 3
},
{
"communeId": "01061033",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061105",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01061045",
"totalBottleneckMinutes": 2191,
"totalEegPlants": 1
},
{
"communeId": "01054146",
"totalBottleneckMinutes": 6235,
"totalEegPlants": 6
},
{
"communeId": "01054012",
"totalBottleneckMinutes": 8151,
"totalEegPlants": 6
},
{
"communeId": "01054002",
"totalBottleneckMinutes": 8382,
"totalEegPlants": 8
},
{
"communeId": "01054024",
"totalBottleneckMinutes": 6318,
"totalEegPlants": 8
},
{
"communeId": "01054092",
"totalBottleneckMinutes": 8225,
"totalEegPlants": 2
},
{
"communeId": "01054041",
"totalBottleneckMinutes": 10520,
"totalEegPlants": 13
},
{
"communeId": "01054079",
"totalBottleneckMinutes": 6592,
"totalEegPlants": 4
},
{
"communeId": "01054144",
"totalBottleneckMinutes": 7982,
"totalEegPlants": 12
},
{
"communeId": "01054128",
"totalBottleneckMinutes": 8314,
"totalEegPlants": 2
},
{
"communeId": "01054007",
"totalBottleneckMinutes": 7898,
"totalEegPlants": 2
},
{
"communeId": "01054038",
"totalBottleneckMinutes": 3527,
"totalEegPlants": 2
},
{
"communeId": "01054025",
"totalBottleneckMinutes": 319,
"totalEegPlants": 1
},
{
"communeId": "01054019",
"totalBottleneckMinutes": 3168,
"totalEegPlants": 2
},
{
"communeId": "01054093",
"totalBottleneckMinutes": 3177,
"totalEegPlants": 1
},
{
"communeId": "01054121",
"totalBottleneckMinutes": 3189,
"totalEegPlants": 3
},
{
"communeId": "01051129",
"totalBottleneckMinutes": 6502,
"totalEegPlants": 2
},
{
"communeId": "01054091",
"totalBottleneckMinutes": 6430,
"totalEegPlants": 12
},
{
"communeId": "01054026",
"totalBottleneckMinutes": 4641,
"totalEegPlants": 1
},
{
"communeId": "01054042",
"totalBottleneckMinutes": 4736,
"totalEegPlants": 1
},
{
"communeId": "01054162",
"totalBottleneckMinutes": 4753,
"totalEegPlants": 1
},
{
"communeId": "01054132",
"totalBottleneckMinutes": 554,
"totalEegPlants": 1
},
{
"communeId": "01054034",
"totalBottleneckMinutes": 543,
"totalEegPlants": 18
},
{
"communeId": "01054110",
"totalBottleneckMinutes": 540,
"totalEegPlants": 3
}
],
"lastUpdatedAt": "2023-02-28T01:29:05.0424923+01:00"
}
\ No newline at end of file
10_Redispatch/scatterplot.png

26.4 KiB

...@@ -10,3 +10,4 @@ Example # | Name | Description | Input format | Output | Source ...@@ -10,3 +10,4 @@ Example # | Name | Description | Input format | Output | Source
05 | Park bench map | Show a map of all park benches in the city of Norderstedt | SHP (shape file) | Table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/parkbanke 05 | Park bench map | Show a map of all park benches in the city of Norderstedt | SHP (shape file) | Table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/parkbanke
06 | Tax office map | Create a formatted HTML and map containing all tax offices in Schleswig-Holstein | RDF | HTML table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/finanzamter-2024-01-28 06 | Tax office map | Create a formatted HTML and map containing all tax offices in Schleswig-Holstein | RDF | HTML table, Open Street Map overlay | https://opendata.schleswig-holstein.de/dataset/finanzamter-2024-01-28
08 | Water height diagram | Create a line diagram of the water height of the Stoer near Willenscharen for 2023 | CSV | Diagram (PNG) | https://opendata.schleswig-holstein.de/dataset/wasserstand-pegel-willenscharen-stor1 08 | Water height diagram | Create a line diagram of the water height of the Stoer near Willenscharen for 2023 | CSV | Diagram (PNG) | https://opendata.schleswig-holstein.de/dataset/wasserstand-pegel-willenscharen-stor1
10 | Redispatch SH-Netz AG | Show a scatter plot of the number of EEG plants of a commune and the amount of time the electricity supply needed to be reduced | CSV | Scatterplot (PNG) | https://opendata.schleswig-holstein.de/dataset/redispatch-2022-08
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment