Skip to content

Commit

Permalink
Merge pull request #456 from agoenergy/release-v0.7.0
Browse files Browse the repository at this point in the history
Release-v0.7.0
  • Loading branch information
joAschauer authored Jun 17, 2024
2 parents a6f5213 + 16c2465 commit 0861a31
Show file tree
Hide file tree
Showing 57 changed files with 2,022 additions and 1,316 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.1
current_version = 0.7.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
tags: wingechr/ptx-boa:0.6.1
tags: wingechr/ptx-boa:0.7.0
3 changes: 3 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
textColor="#262730"
font="sans serif"

[client]
toolbarMode = "minimal"

[logger]
level="INFO"

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG.md

## 0.7.0 (2024-05-17)

- for the two regions Sout Africa Kwazulu Natal and Indonesia a reduced quantile of 0.3 is
used to determine Wind Onshore and hybrid locations.
- frontend changes:
- point maps instead of choropleth maps
- include selected subregion in global cost comparison

## 0.3.0 (2024-05-06)

- optimization of FLH data (with caching)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM python:3.10-slim
LABEL version="0.6.1"
LABEL version="0.7.0"

RUN apt-get update
RUN apt-get install -y git
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ scp -r ptxboa2:ptx-boa_offline_optimization/optimization_cache/* .
# connect to server
ssh ptxboa
# pull latest image from dockerhub
VERSION=0.6.1
VERSION=0.7.0
docker pull wingechr/ptx-boa:$VERSION
# stop and delete the currently running container "app"
docker stop app
Expand Down
2 changes: 1 addition & 1 deletion app/context_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import streamlit as st


@st.cache_data()
@st.cache_data(show_spinner=False)
def load_context_data():
"""Import context data from excel file."""
filename = "data/context_data.xlsx"
Expand Down
103 changes: 84 additions & 19 deletions app/layout_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def display_costs(
titlestring: str,
key_suffix: str = "",
output_unit: str | None = None,
default_select: int = 0,
default_manual_select: str | None = None,
):
"""Display costs as table and bar chart."""
if output_unit is None:
Expand All @@ -39,7 +41,7 @@ def display_costs(
with c2:
st.info("Input data has been modified. Select which data to display.")
select_data = st.radio(
"Select data to display",
"Data to display",
["With Modifications", "Without Modifications", "Difference"],
horizontal=True,
key=f"select_user_modificatons_data_{key}_{key_suffix}",
Expand All @@ -53,32 +55,59 @@ def display_costs(
else:
df_res = df_costs.copy()

if default_manual_select is None:
default_manual_select = df_res.index.values

with c1:
if len(df_res) > 13:
select_options = [
"All",
"Manual selection",
"Cheapest 10",
]
else:
select_options = ["All", "Manual selection"]
# select filter:
show_which_data = st.radio(
"Select elements to display:",
["All", "Manual select"],
index=0,
"Elements to display:",
select_options,
index=default_select,
horizontal=True,
key=f"show_which_data_{key}_{key_suffix}",
)

# apply filter:
if show_which_data == "Manual select":
if show_which_data == "Manual selection":
ind_select = st.multiselect(
"Select regions:",
"Select elements:",
df_res.index.values,
default=df_res.index.values,
default=default_manual_select,
key=f"select_data_{key}_{key_suffix}",
label_visibility="collapsed",
)
df_res = df_res.loc[ind_select]

# sort:
sort_ascending = st.toggle(
"Sort by total costs?",
value=True,
key=f"sort_data_{key}_{key_suffix}",
)
if show_which_data == "Cheapest 10":
ind_select = (
df_res.sort_values(["Total"], ascending=True).iloc[:10].index.to_list()
)
# append the setting from the sidebar if not in cheapest 10
if (
st.session_state[key] not in ind_select
and st.session_state[key] in df_res.index
):
ind_select.append(st.session_state[key])
df_res = df_res.loc[ind_select]
sort_ascending = False

else:
# sort:
sort_ascending = st.toggle(
"Sort by total costs?",
value=True,
key=f"sort_data_{key}_{key_suffix}",
)

if sort_ascending:
df_res = df_res.sort_values(["Total"], ascending=True)

Expand All @@ -95,9 +124,16 @@ def display_costs(

# add explainer for costs by supply chain comparison:
if titlestring == "Costs by supply chain":
if st.session_state["output_unit"] == "USD/t":
unit_note = (
"The output unit is set to USD/MWh in order to compare energy carriers"
" with different densities. "
)
else:
unit_note = ""
st.caption(
(
"**Note**: Green Iron is not shown in this comparison "
f"**Note**: {unit_note}Green Iron is not shown in this comparison "
"as it is not an energy carrier."
)
)
Expand Down Expand Up @@ -224,12 +260,14 @@ def display_and_edit_input_data(
"electricity_generation",
"conversion_processes",
"transportation_processes",
"reconversion_processes" "CAPEX",
"reconversion_processes",
"CAPEX",
"full load hours",
"interest rate",
"WACC",
"specific_costs",
"conversion_coefficients",
"dac_and_desalination",
"storage",
],
scope: Literal["world", "Argentina", "Morocco", "South Africa"],
key: str,
Expand All @@ -247,7 +285,7 @@ def display_and_edit_input_data(
data_type : str
the data type which should be selected. Needs to be one of
"electricity_generation", "conversion_processes", "transportation_processes",
"reconversion_processes", "CAPEX", "full load hours", "interest rate",
"reconversion_processes", "CAPEX", "full load hours", "WACC",
"specific costs", "conversion_coefficients" and "dac_and_desalination"
scope : Literal[None, "world", "Argentina", "Morocco", "South Africa"]
The regional scope. Is automatically set to None for data of
Expand Down Expand Up @@ -283,13 +321,35 @@ def display_and_edit_input_data(
"transportation_processes",
"reconversion_processes",
"dac_and_desalination",
"storage",
]:
index = "process_code"
columns = "parameter_code"
missing_index_name = "source_region_code"
missing_index_value = None
column_config = get_column_config()

if data_type == "conversion_processes":
custom_column_config = {
"CAPEX": st.column_config.NumberColumn(
format="%.0f USD/[unit]",
min_value=0,
help=(
"unit is [t] for Green iron reduction and [MW] for all other "
"processes."
),
),
"OPEX (fix)": st.column_config.NumberColumn(
format="%.0f USD/[unit]",
min_value=0,
help=(
"unit is [t] for Green iron reduction and [MW] for all other "
"processes."
),
),
}
column_config.update(custom_column_config)

if data_type == "dac_and_desalination":
index = "process_code"
columns = "parameter_code"
Expand All @@ -310,11 +370,11 @@ def display_and_edit_input_data(
),
}

if data_type == "interest rate":
if data_type == "WACC":
index = "source_region_code"
columns = "parameter_code"
missing_index_name = "parameter_code"
missing_index_value = "interest rate"
missing_index_value = "WACC"
column_config = {
c: st.column_config.NumberColumn(
format="%.2f %%", min_value=0, max_value=100
Expand Down Expand Up @@ -358,6 +418,11 @@ def display_and_edit_input_data(
missing_index_value = "conversion factors"
column_config = get_column_config()

if data_type == "storage":
column_config["OPEX (fix)"] = st.column_config.NumberColumn(
format="%.2f USD/kW", min_value=0
)

df = change_index_names(df)

# if editing is enabled, store modifications in session_state:
Expand Down
Loading

0 comments on commit 0861a31

Please sign in to comment.