Skip to content

Commit

Permalink
Start tests for add_tech
Browse files Browse the repository at this point in the history
  • Loading branch information
glatterf42 committed May 14, 2024
1 parent d992ca2 commit 67181b2
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
98 changes: 98 additions & 0 deletions message_ix/tests/data/add_tech/westeros_carbon_removal_data.yaml
Original file line number Diff line number Diff line change
@@ -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


28 changes: 28 additions & 0 deletions message_ix/tests/tools/test_add_tech.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 67181b2

Please sign in to comment.