From f5c1a7b5fb8cebc68ff7c89bbad26b63e99f9140 Mon Sep 17 00:00:00 2001 From: Markus Haller Date: Fri, 15 Dec 2023 14:09:36 +0100 Subject: [PATCH 1/2] add dac and desalination section to input data tab --- app/ptxboa_functions.py | 24 +++++++++++++++++++++--- app/tab_input_data.py | 7 +++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/ptxboa_functions.py b/app/ptxboa_functions.py index 964f29d4..8a211221 100644 --- a/app/ptxboa_functions.py +++ b/app/ptxboa_functions.py @@ -225,6 +225,7 @@ def get_data_type_from_input_data( "interest rate", "specific_costs", "conversion_coefficients", + "dac_and_desalination", ], scope: Literal[None, "world", "Argentina", "Morocco", "South Africa"], ) -> pd.DataFrame: @@ -243,7 +244,7 @@ def get_data_type_from_input_data( 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", - "specific costs" and "conversion_coefficients". + "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 data type "conversion_processes" and "transportation_processes" which is not @@ -263,6 +264,7 @@ def get_data_type_from_input_data( "conversion_processes", "transportation_processes", "reconversion_processes", + "dac_and_desalination", ]: scope = None source_region_code = [""] @@ -307,7 +309,21 @@ def get_data_type_from_input_data( "efficiency", ] process_code = processes.loc[ - ~processes["is_transport"] & ~processes["is_re_generation"], "process_name" + ~processes["is_transport"] + & ~processes["is_re_generation"] + & ~processes["is_secondary"], + "process_name", + ].to_list() + + if data_type == "dac_and_desalination": + parameter_code = [ + "CAPEX", + "OPEX (fix)", + "lifetime / amortization period", + "efficiency", + ] + process_code = processes.loc[ + processes["is_secondary"], "process_name" ].to_list() if data_type == "transportation_processes": @@ -554,6 +570,7 @@ def display_and_edit_input_data( "interest rate", "specific_costs", "conversion_coefficients", + "dac_and_desalination", ], scope: Literal["world", "Argentina", "Morocco", "South Africa"], key: str, @@ -572,7 +589,7 @@ def display_and_edit_input_data( 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", - "specific costs" and "conversion_coefficients" + "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 data type "conversion_processes" and "transportation_processes" which is not @@ -606,6 +623,7 @@ def display_and_edit_input_data( "conversion_processes", "transportation_processes", "reconversion_processes", + "dac_and_desalination", ]: index = "process_code" columns = "parameter_code" diff --git a/app/tab_input_data.py b/app/tab_input_data.py index 4c50c119..81ab166b 100644 --- a/app/tab_input_data.py +++ b/app/tab_input_data.py @@ -107,6 +107,13 @@ def content_input_data(api: PtxboaAPI) -> None: scope=None, key="input_data_reconversion_processes", ) + with st.expander("**Direct air capture and desalination**"): + display_and_edit_input_data( + api, + data_type="dac_and_desalination", + scope=None, + key="input_data_dac_and_desalination", + ) with st.expander("**Specific costs for materials and energy carriers**"): display_and_edit_input_data( api, From e1666e45c55728fb0760c74a077b42a6a7bd2e88 Mon Sep 17 00:00:00 2001 From: Markus Haller Date: Fri, 15 Dec 2023 14:23:19 +0100 Subject: [PATCH 2/2] fix units --- app/ptxboa_functions.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/ptxboa_functions.py b/app/ptxboa_functions.py index 8a211221..32a27202 100644 --- a/app/ptxboa_functions.py +++ b/app/ptxboa_functions.py @@ -320,7 +320,6 @@ def get_data_type_from_input_data( "CAPEX", "OPEX (fix)", "lifetime / amortization period", - "efficiency", ] process_code = processes.loc[ processes["is_secondary"], "process_name" @@ -631,6 +630,26 @@ def display_and_edit_input_data( missing_index_value = None column_config = get_column_config() + if data_type == "dac_and_desalination": + index = "process_code" + columns = "parameter_code" + missing_index_name = "source_region_code" + missing_index_value = None + column_config = { + "CAPEX": st.column_config.NumberColumn(format="%.2e USD/kg", min_value=0), + "OPEX (fix)": st.column_config.NumberColumn( + format="%.2e USD/kg", min_value=0 + ), + "efficiency": st.column_config.NumberColumn( + format="%.2f", min_value=0, max_value=1 + ), + "lifetime / amortization period": st.column_config.NumberColumn( + format="%.0f a", + min_value=0, + help=read_markdown_file("md/helptext_columns_lifetime.md"), + ), + } + if data_type == "interest rate": index = "source_region_code" columns = "parameter_code"