Skip to content

Commit ec1e1d7

Browse files
committed
Add test_read_attribute_table
1 parent 3a8ced9 commit ec1e1d7

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

tests/test_readers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,28 @@ def test_read_initial_market(default_model):
657657
assert list(data.coords["hour"]) == hour_values
658658

659659
assert all(var.coords.equals(data.coords) for var in data.data_vars.values())
660+
661+
662+
def test_read_attribute_table(default_model):
663+
from muse.readers.csv import read_attribute_table
664+
665+
path = default_model / "input" / "Projections.csv"
666+
data = read_attribute_table(path)
667+
668+
assert isinstance(data, xr.DataArray)
669+
assert data.dtype == np.float64
670+
671+
assert set(data.dims) == {"region", "year", "commodity"}
672+
assert list(data.coords["region"].values) == ["R1"]
673+
assert list(data.coords["year"].values) == list(range(2010, 2105, 5))
674+
assert list(data.coords["commodity"].values) == [
675+
"electricity",
676+
"gas",
677+
"heat",
678+
"CO2f",
679+
"wind",
680+
]
681+
assert (
682+
list(data.coords["units_commodity_price"].values)
683+
== ["MUS$2010/PJ"] * 3 + ["MUS$2010/kt"] * 2
684+
)

0 commit comments

Comments
 (0)