Skip to content

Commit

Permalink
Merge pull request #439 from agoenergy/209-market-scanning-no-highlig…
Browse files Browse the repository at this point in the history
…ht-of-own-region-if-subregion-is-selected

show subregion in market scanning plot (and estimate a potential for …
  • Loading branch information
markushal authored Jun 10, 2024
2 parents 4bd1626 + b9abd51 commit 4302451
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 20 additions & 1 deletion app/tab_market_scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,31 @@ def content_market_scanning(api: PtxboaAPI, res_costs: pd.DataFrame, cd: dict) -
df = df.astype(float)

# do not show subregions:
df = remove_subregions(api, df, st.session_state["country"])
df = remove_subregions(
api, df, st.session_state["country"], keep=st.session_state["subregion"]
)

# if a subregion is selected, distribute country potential equally across
# subregions:
if st.session_state["subregion"] is not None:
region = st.session_state["region"].split(" (")[0]
number_of_subregions = (
api.get_dimension("region")["region_name"].str.startswith(region).sum() - 1
)
for par in [
"RE technical potential (PTX Atlas) (TWh/a)",
"RE technical potential (EWI) (TWh/a)",
]:
df.at[st.session_state["subregion"], par] = (
df.at[region, par] / number_of_subregions
)

with st.container(border=True):
st.markdown(
"### Costs and transportation distances from different supply regions"
f" to {st.session_state['country']}"
)

c1, c2 = st.columns(2)
with c1:
# select which distance to show:
Expand All @@ -102,6 +120,7 @@ def content_market_scanning(api: PtxboaAPI, res_costs: pd.DataFrame, cd: dict) -
"RE technical potential (PTX Atlas) (TWh/a)",
"None",
],
help=read_markdown_file("md/helptext_technical_potential.md"),
)

# create plot:
Expand Down
5 changes: 5 additions & 0 deletions md/helptext_technical_potential.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Please note that many assumptions are needed to estimate technical RE potentials. Data across sources varies significantly, and not all PtXBOA supply regions are covered by the two sources used here.

If a supply region is not covered by the source, it will not show up in the diagram. Please choose "None" to show all supply regions.

If you select a deep-dive country subregion as source region, it will show up in the diagram, and the potential of the country it belongs to will be divided equally across all subregions of this country.

0 comments on commit 4302451

Please sign in to comment.