From ab2f047b0f4aa24f1c52939dd525633b2c25d6b4 Mon Sep 17 00:00:00 2001 From: "j.aschauer" Date: Tue, 11 Jun 2024 15:05:01 +0200 Subject: [PATCH 1/2] use distance to France as transport distances to EU Fixes #266 --- app/tab_market_scanning.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tab_market_scanning.py b/app/tab_market_scanning.py index f1a6cce4..88d82ccc 100644 --- a/app/tab_market_scanning.py +++ b/app/tab_market_scanning.py @@ -209,8 +209,8 @@ def content_market_scanning(api: PtxboaAPI, res_costs: pd.DataFrame, cd: dict) - df.at["USA", "h2_demand_2030"] = 10 # EU data is missing completely in context_data.xlsx: - df.at["EU", "shipping distance"] = 1104 - df.at["EU", "pipeline distance"] = 2000 + df.at["EU", "shipping distance"] = df.at["France", "shipping distance"] + df.at["EU", "pipeline distance"] = df.at["France", "pipeline distance"] df.at["EU", "h2_demand_2030"] = 20 df["h2_demand_2030"] = df["h2_demand_2030"].astype(float) From 860fd1a51adc622b95c87f25353a9f883d1a865e Mon Sep 17 00:00:00 2001 From: "j.aschauer" Date: Tue, 11 Jun 2024 15:16:33 +0200 Subject: [PATCH 2/2] fix key error when no pipeline distance available --- app/tab_market_scanning.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/tab_market_scanning.py b/app/tab_market_scanning.py index 88d82ccc..f080e936 100644 --- a/app/tab_market_scanning.py +++ b/app/tab_market_scanning.py @@ -6,6 +6,7 @@ from app.excel_download import prepare_and_download_df_as_excel from app.ptxboa_functions import ( + change_index_names, config_number_columns, read_markdown_file, remove_subregions, @@ -210,7 +211,10 @@ def content_market_scanning(api: PtxboaAPI, res_costs: pd.DataFrame, cd: dict) - # EU data is missing completely in context_data.xlsx: df.at["EU", "shipping distance"] = df.at["France", "shipping distance"] - df.at["EU", "pipeline distance"] = df.at["France", "pipeline distance"] + try: + df.at["EU", "pipeline distance"] = df.at["France", "pipeline distance"] + except KeyError: + df.at["EU", "pipeline distance"] = None df.at["EU", "h2_demand_2030"] = 20 df["h2_demand_2030"] = df["h2_demand_2030"].astype(float) @@ -234,6 +238,7 @@ def content_market_scanning(api: PtxboaAPI, res_costs: pd.DataFrame, cd: dict) - ) # create plot: + df = change_index_names(df, mapping={"target_country_code": "Target country"}) df_plot = df.copy().round(0) # distinguish between selected region and others: