Skip to content

Commit 88b8285

Browse files
committed
Add test_read_csv_outputs
1 parent ec1e1d7 commit 88b8285

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/test_readers.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,3 +682,26 @@ def test_read_attribute_table(default_model):
682682
list(data.coords["units_commodity_price"].values)
683683
== ["MUS$2010/PJ"] * 3 + ["MUS$2010/kt"] * 2
684684
)
685+
686+
687+
def test_read_csv_outputs(default_model):
688+
from muse.readers.csv import read_csv_outputs
689+
690+
path = default_model / "technodata" / "preset" / "*Consumption.csv"
691+
data = read_csv_outputs(str(path))
692+
693+
assert isinstance(data, xr.DataArray)
694+
assert data.dtype == np.float64
695+
696+
assert set(data.dims) == {"year", "commodity", "region", "process", "timeslice"}
697+
assert list(data.coords["region"].values) == ["R1"]
698+
assert list(data.coords["process"].values) == ["gasboiler"]
699+
assert list(data.coords["timeslice"].values) == list(range(1, 7))
700+
assert list(data.coords["year"].values) == [2020, 2050]
701+
assert list(data.coords["commodity"].values) == [
702+
"electricity",
703+
"gas",
704+
"heat",
705+
"CO2f",
706+
"wind",
707+
]

0 commit comments

Comments
 (0)