From 67181b268dd18119a61cc9e0d7f3ecb74b103cf6 Mon Sep 17 00:00:00 2001 From: Fridolin Glatter Date: Tue, 14 May 2024 10:07:16 +0200 Subject: [PATCH] Start tests for add_tech --- .../westeros_carbon_removal_data.yaml | 98 +++++++++++++++++++ message_ix/tests/tools/test_add_tech.py | 28 ++++++ 2 files changed, 126 insertions(+) create mode 100644 message_ix/tests/data/add_tech/westeros_carbon_removal_data.yaml create mode 100644 message_ix/tests/tools/test_add_tech.py diff --git a/message_ix/tests/data/add_tech/westeros_carbon_removal_data.yaml b/message_ix/tests/data/add_tech/westeros_carbon_removal_data.yaml new file mode 100644 index 000000000..c2640e30f --- /dev/null +++ b/message_ix/tests/data/add_tech/westeros_carbon_removal_data.yaml @@ -0,0 +1,98 @@ +daccs: + year_init: 700 + inv_cost_: + par_name: inv_cost + value: 100 + unit: USD/(tCO2/yr) + node_loc: + Westeros: 1 + year_vtg: + rate: 0 + fix_cost_: + par_name: fix_cost + value: 5 + unit: USD/(tCO2/yr)/yr + node_loc: + Westeros: 1 + year_vtg: + rate: 0 + year_act: + rate: 0 + var_cost_: + par_name: var_cost + value: 5 + unit: USD/tCO2 + node_loc: + Westeros: 1 + year_vtg: + rate: 0 + year_act: + rate: 0 + input_: + par_name: input + value: 0.0028 + unit: '-' + node_loc: + Westeros: 1 + mode: + standard: 1 + commodity: + electricity: 1 + level: + final: 1 + output_: + par_name: output + value: 1 + unit: tCO2 + node_loc: + Westeros: 1 + mode: + standard: 1 + commodity: + CO2: 1 + level: + final: 1 + capacity_factor_: + par_name: capacity_factor + value: 0.913 + unit: '-' + node_loc: + Westeros: 1 + emission_factor_: + par_name: emission_factor + value: -1 + unit: tCO2/tCO2 + node_loc: + Westeros: 1 + mode: + standard: 1 + emission: + CO2: 1 + technical_lifetime_: + par_name: technical_lifetime + value: 25 + unit: y + node_loc: + Westeros: 1 + initial_new_capacity_up_: + par_name: initial_new_capacity_up + value: 0.5 + unit: Mt CO2/yr + node_loc: + Westeros: 1 + year_vtg: + rate: 0 + time: + year: 1 + growth_new_capacity_up_: + par_name: growth_new_capacity_up + value: 0.05 + unit: '-' + node_loc: + Westeros: 1 + year_vtg: + rate: 0 + time: + year: 1 + + \ No newline at end of file diff --git a/message_ix/tests/tools/test_add_tech.py b/message_ix/tests/tools/test_add_tech.py new file mode 100644 index 000000000..136826cf6 --- /dev/null +++ b/message_ix/tests/tools/test_add_tech.py @@ -0,0 +1,28 @@ +from message_ix.testing import make_dantzig +from message_ix.tools.add_tech import print_df + + +def test_print_df(test_mp, request, test_data_path, tmp_path): + scen = make_dantzig(test_mp, quiet=True, request=request) + scen.check_out() + path = test_data_path.joinpath("add_tech") + output_dir = tmp_path.joinpath("add_tec") + output_dir.mkdir() + print_df( + scenario=scen, + input_path=str(path.joinpath("westeros_carbon_removal_data.yaml")), + output_dir=output_dir, + ) + + # TODO: adapt this to read parameter names from yaml file + parameter_list = scen.par_list() + for parameter in parameter_list: + assert (output_dir / f"{parameter}.xlsx").exists() + + +# def test_get_values(): +# get_values() + + +# def test_get_report(): +# get_report()