-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
60 lines (43 loc) · 1.48 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# SPDX-FileCopyrightText: 2023 Fabian Neumann (TU Berlin), 2023
#
# SPDX-License-Identifier: MIT
import streamlit as st
import pandas as pd
import plotly.express as px
st.set_page_config(page_title="Power Plants", layout="wide")
# st.balloons()
st.title("Power Plants in Europe")
@st.cache_data
def load_powerplants():
url = "https://raw.githubusercontent.com/PyPSA/powerplantmatching/master/powerplants.csv"
return pd.read_csv(url, index_col=0)
ppl = load_powerplants()
with st.sidebar:
st.title("Data Science for Energy System Modelling")
st.markdown(":+1: This notebook introduces you to the `streamlit` library.")
tech = st.selectbox(
"Select a technology",
ppl.Fueltype.unique(),
)
start, end = st.slider(
"Range of commissioning years", 1900, 2022, (1900, 2022), step=1, help="Pick years!"
)
st.warning(":building_construction: Sorry, this page is still under construction")
hover_data = ['Name', 'Fueltype', 'Technology', "Capacity", 'Efficiency', 'DateIn']
df = ppl.query("Fueltype == @tech and DateIn >= @start and DateIn <= @end")
if not df.empty:
fig = px.scatter_mapbox(
df,
lat="lat",
lon="lon",
mapbox_style="carto-positron",
color="DateIn",
size="Capacity",
zoom=2,
height=700,
hover_data=hover_data,
range_color=(1900, 2022),
)
st.plotly_chart(fig, use_container_width=True)
else:
st.error("Sorry, no power plants to display!")