Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve representation of context data #82

Merged
merged 8 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 144 additions & 80 deletions app/ptxboa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Utility functions for streamlit app."""
from urllib.parse import urlparse

import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
Expand Down Expand Up @@ -901,14 +902,25 @@ def create_fact_sheet_demand_country(context_data: dict, country_name: str):
"""
**Country fact sheets**

This sheet provides you with an overview of additional interformation relevant
for the production of H2 and derivatives
across all PTX BOA supply countries.

We cover the following aspects: country-specific renewable energy technical potential
(based on different data sources),
LNG export and import infrastructure, CCS potentials, availability of a H2 strategy and
wholesale electricity prices.
This sheet provides you with additional information on the production and import of
hydrogen and derivatives in all PTX BOA supply and demand countries.
For each selected supply and demand country pair, you will find detailed
country profiles.

For demand countries, we cover the following aspects:
country-specific projected hydrogen demand,
target sectors for hydrogen use,
hydrogen-relevant policies and competent authorities,
certification and regulatory frameworks,
and country-specific characteristics as defined in the demand countries'
hydrogen strategies.

For the supplying countries, we cover the country-specific technical potential
for renewables (based on various data sources),
LNG export and import infrastructure,
CCS potentials,
availability of an H2 strategy
and wholesale electricity prices.
"""
)
df = context_data["demand_countries"]
Expand All @@ -929,44 +941,45 @@ def create_fact_sheet_demand_country(context_data: dict, country_name: str):
st.subheader(
f"{flags_to_country_names[country_name]} Fact sheet for {country_name}"
)
st.markdown(
"""This page contains detailed information
and a collection of links for further reading."""
)
c1, c2, c3 = st.columns(3)
with c1:
st.markdown("**Projected H2 demand in 2030:**")
st.markdown(data["h2_demand_2030"])
st.markdown(f"*Source: {data['source_h2_demand_2030']}*")
with c2:
st.markdown("**Targeted sectors (main):**")
st.markdown(data["demand_targeted_sectors_main"])
st.markdown(f"*Source: {data['source_targeted_sectors_main']}*")
with c3:
st.markdown("**Targeted sectors (secondary):**")
st.markdown(data["demand_targeted_sectors_secondary"])
st.markdown(f"*Source: {data['source_targeted_sectors_secondary']}*")
st.markdown("**Hydrogen strategy documents:**")
st.markdown(data["h2_strategy_documents"])

st.markdown("**Hydrogen strategy authorities:**")
st.markdown(data["h2_strategy_authorities"])

st.markdown("**Information on certification schemes:**")
st.markdown(data["certification_info"])
st.markdown(f"*Source: {data['source_certification_info']}*")

st.markdown("**H2 trade characteristics:**")
st.markdown(data["h2_trade_characteristics"])
st.markdown(f"*Source: {data['source_h2_trade_characteristics']}*")

st.markdown("**LNG import terminals:**")
st.markdown(data["lng_import_terminals"])
st.markdown(f"*Source: {data['source_lng_import_terminals']}*")

st.markdown("**H2 pipeline projects:**")
st.markdown(data["h2_pipeline_projects"])
st.markdown(f"*Source: {data['source_h2_pipeline_projects']}*")
with st.expander("**Demand**"):
c1, c2, c3 = st.columns(3)
with c1:
st.markdown("**Projected H2 demand in 2030:**")
st.markdown(data["h2_demand_2030"])
st.markdown(f"*Source: {data['source_h2_demand_2030']}*")
with c2:
st.markdown("**Targeted sectors (main):**")
st.markdown(data["demand_targeted_sectors_main"])
st.markdown(f"*Source: {data['source_targeted_sectors_main']}*")
with c3:
st.markdown("**Targeted sectors (secondary):**")
st.markdown(data["demand_targeted_sectors_secondary"])
st.markdown(f"*Source: {data['source_targeted_sectors_secondary']}*")

with st.expander("**Hydrogen strategy**"):
st.markdown("**Documents:**")
st.markdown(data["h2_strategy_documents"])

st.markdown("**Authorities:**")
st.markdown(data["h2_strategy_authorities"])

with st.expander("**Hydrogen trade characteristics**"):
st.markdown(data["h2_trade_characteristics"])
st.markdown(f"*Source: {data['source_h2_trade_characteristics']}*")

with st.expander("**Infrastructure**"):
st.markdown("**LNG import terminals:**")
st.markdown(data["lng_import_terminals"])
st.markdown(f"*Source: {data['source_lng_import_terminals']}*")

st.markdown("**H2 pipeline projects:**")
st.markdown(data["h2_pipeline_projects"])
st.markdown(f"*Source: {data['source_h2_pipeline_projects']}*")

if data["certification_info"] != "":
with st.expander("**Certification schemes**"):
st.markdown(data["certification_info"])
st.markdown(f"*Source: {data['source_certification_info']}*")


def create_fact_sheet_supply_country(context_data: dict, country_name: str):
Expand Down Expand Up @@ -1001,49 +1014,73 @@ def create_fact_sheet_certification_schemes(context_data: dict):
with st.expander("What is this?"):
st.markdown(
"""
**Get supplementary information on H2-relevant certification frameworks **
**Get supplementary information on H2-relevant certification frameworks**

This sheet provides you with an overview of current governmental regulations
and voluntary standards for H2 products.
"""
)
df = context_data["certification_schemes"]
helptext = "Select the certification scheme you want to know more about."
scheme_id = st.selectbox("Select scheme:", df["ID"], help=helptext)
data = df.loc[df["ID"] == scheme_id].iloc[0].to_dict()
scheme_name = st.selectbox("Select scheme:", df["name"], help=helptext)
data = df.loc[df["name"] == scheme_name].iloc[0].to_dict()

st.header(data["name"])
# replace na with "not specified":
for key in data:
if data[key] is np.nan:
data[key] = "not specified"

st.markdown(data["description"])

st.subheader("Characteristics")
with st.expander("**Characteristics**"):
st.markdown(
f"- **Relation to other standards:** {data['relation_to_other_standards']}"
)
st.markdown(f"- **Geographic scope:** {data['geographic_scope']}")
st.markdown(f"- **PTXBOA demand countries:** {data['ptxboa_demand_countries']}")
st.markdown(f"- **Labels:** {data['label']}")
st.markdown(f"- **Lifecycle scope:** {data['lifecycle_scope']}")

st.markdown(
f"- **Relation to other standards:** {data['relation_to_other_standards']}"
)
st.markdown(f"- **Geographic scope:** {data['geographic_scope']}")
st.markdown(f"- **PTXBOA demand countries:** {data['ptxboa_demand_countries']}")
st.markdown(f"- **Labels:** {data['label']}")
st.markdown(f"- **Lifecycle scope:** {data['lifecycle_scope']}")
st.markdown(
"""
**Explanations:**

- Info on "Geographical scope":
- This field provides an answer to the question: if you want to address a specific
country of demand, which regulations and/or standards exist in this country
that require or allow proof of a specific product property?
- Info on "Lifecycle scope":
- Well-to-gate: GHG emissions are calculated up to production.
- Well-to-wheel: GHG emissions are calculated up to the time of use.
- Further information on the life cycle scopes can be found in
IRENA & RMI (2023): Creating a global hydrogen market: certification to enable trade,
pp. 15-19
"""
)

st.subheader("Scope")
st.markdown("- **Emissions:**")
st.markdown(data["scope_emissions"])
with st.expander("**Scope**"):
if data["scope_emissions"] != "not specified":
st.markdown("- **Emissions:**")
st.markdown(data["scope_emissions"])

st.markdown("- **Electricity:**")
st.markdown(data["scope_electricity"])
if data["scope_electricity"] != "not specified":
st.markdown("- **Electricity:**")
st.markdown(data["scope_electricity"])

st.markdown("- **Water:**")
st.markdown(data["scope_water"])
if data["scope_water"] != "not specified":
st.markdown("- **Water:**")
st.markdown(data["scope_water"])

st.markdown("- **Biodiversity:**")
st.markdown(data["scope_biodiversity"])
if data["scope_biodiversity"] != "not specified":
st.markdown("- **Biodiversity:**")
st.markdown(data["scope_biodiversity"])

st.markdown("- **Other:**")
st.markdown(data["scope_other"])
if data["scope_other"] != "not specified":
st.markdown("- **Other:**")
st.markdown(data["scope_other"])

st.subheader("Sources")
st.markdown(data["sources"])
with st.expander("**Sources**"):
st.markdown(data["sources"])


def create_content_sustainability(context_data: dict):
Expand All @@ -1058,7 +1095,6 @@ def create_content_sustainability(context_data: dict):

This is why we provide you with a set of questions that will help you assess your plans
for PTX production and export from a comprehensive sustainability perspective.
The compliation is based on frameworks by the PtX Hub as well as the Oeko-Institute.
Please note that this list does not claim to be exhaustive,
but only serves for an orientation on the topic.
"""
Expand All @@ -1078,9 +1114,30 @@ def create_content_sustainability(context_data: dict):
"""
**Dimensions of sustainability**

This text should explain the diagram and how the content of this tab is structured.
**What sustainability aspects should be considered for PTX products,
production and policies?**

**What questions should be asked before and during project development?**

In this tab we aim to provide a basic approach to these questions.
To the left, you can see the framework along which the compilation
of sustainability aspects in this tab is structured. It is based on the EESG framework
as elaborated by the PtX Hub and sustainability criteria developed by the Öko-Institut.

Maybe it could be combined with the content of the "What is this?" expander above.
**The framework distinguishes four key sustainability dimensions - Environmental,
Economic, Social and Governance - from which you can select below.**

Within each of these dimensions there are different clusters of sustainability aspects
that we address in a set of questions. We differentiate between questions indicating
guardrails and questions suggesting goals.

With this compilation, we aim to provide a general overview of the sustainability
issues that may be relevant in the context of PTX production. Of course,
different aspects are more or less important depending on the project,
product and country.

**Take a look for yourself to see which dimensions are most important
from where you are coming from.**
"""
)
st.divider()
Expand All @@ -1092,7 +1149,15 @@ def create_content_sustainability(context_data: dict):
"Select dimension:", df["dimension"].unique(), help=helptext
)
with c2:
helptext = "helptext"
helptext = """
We understand **guardrails** as guidelines which can help you to produce green
PTX products that are sustainable also beyond their greenhouse gas emission intensity.

**Goals** are guidelines which can help link PTX production to improving local
ecological and socio-economic circumstances in the supply country.
They act as additional to guardrails which should be fulfilled in the first place
to meet basic sustainability needs.
"""
question_type = st.radio(
"Guardrails or goals?",
["Guardrails", "Goals"],
Expand Down Expand Up @@ -1134,11 +1199,9 @@ def create_content_literature(context_data: dict):
markdown_text = ""
for _ind, row in df.iterrows():
if is_valid_url(row["url"]):
text = (
f"- **{row['short_name']}**: {row['long_name']} [Link]({row['url']})\n"
)
text = f"- {row['long_name']}: [Link]({row['url']})\n"
else:
text = f"- **{row['short_name']}**: {row['long_name']}\n"
text = f"- {row['long_name']}\n"
markdown_text = markdown_text + text

st.markdown(markdown_text)
Expand All @@ -1150,7 +1213,8 @@ def content_disclaimer():
"""
**Disclaimer**

TODO: add explanatory text
Information on product details of the PTX Business Opportunity Analyser
including a citation suggestion of the tool.
"""
)
st.image("static/disclaimer.png")
Expand Down
Binary file modified static/sustainability.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.