Skip to content

Commit

Permalink
Merge pull request #232 from agoenergy/226-input-data-create-separate…
Browse files Browse the repository at this point in the history
…-table-for-dac-and-desalination

226 input data create separate table for dac and desalination
  • Loading branch information
markushal authored Dec 15, 2023
2 parents f518e2a + e1666e4 commit f6cc65b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
43 changes: 40 additions & 3 deletions app/ptxboa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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 = [""]
Expand Down Expand Up @@ -307,7 +309,20 @@ 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",
]
process_code = processes.loc[
processes["is_secondary"], "process_name"
].to_list()

if data_type == "transportation_processes":
Expand Down Expand Up @@ -554,6 +569,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,
Expand All @@ -572,7 +588,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
Expand Down Expand Up @@ -606,13 +622,34 @@ def display_and_edit_input_data(
"conversion_processes",
"transportation_processes",
"reconversion_processes",
"dac_and_desalination",
]:
index = "process_code"
columns = "parameter_code"
missing_index_name = "source_region_code"
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"
Expand Down
7 changes: 7 additions & 0 deletions app/tab_input_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f6cc65b

Please sign in to comment.