diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 2d56c168b..ecebdfeac 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -4,20 +4,15 @@ Next release All changes ----------- +- :pull:`345`: Fix a bug in :meth:`.read_excel` when parameter data is spread across multiple sheets. - :pull:`363`: Expand documentation and revise installation instructions. - :pull:`362`: Raise Python exceptions from :class:`.JDBCBackend`. - :pull:`354`: Add :meth:`Scenario.items`, :func:`.utils.diff`, and allow using filters in CLI command ``ixmp export``. -- :pull:`353`: Add meta functionality. - - - :meth:`.Platform.add_model_name` using :meth:`.Backend.add_model_name` - - :meth:`.Platform.add_scenario_name` using :meth:`.Backend.add_scenario_name` - - :meth:`.Platform.get_model_names` using :meth:`.Backend.get_model_names` - - :meth:`.Platform.get_scenario_names` using :meth:`.Backend.get_scenario_names` - - :meth:`.Platform.get_meta` using :meth:`.Backend.get_meta` - - :meth:`.Platform.set_meta` using :meth:`.Backend.set_meta` - - :meth:`.Platform.remove_meta` using :meth:`.Backend.remove_meta` - - :meth:`.Scenario.remove_meta` using :meth:`.Backend.remove_meta` - - deprecate :meth:`.Scenario.delete_meta` +- :pull:`353`: Add functionality for storing ‘meta’ (annotations of model names, scenario names, versions, and some combinations thereof). + + - Add :meth:`.Backend.add_model_name`, :meth:`~.Backend.add_scenario_name`, :meth:`~.Backend.get_model_names`, :meth:`~.Backend.get_scenario_names`, :meth:`~.Backend.get_meta`, :meth:`~.Backend.set_meta`, :meth:`~.Backend.remove_meta`. + - Allow these to be called from :class:`.Platform` instances. + - Remove :meth:`.Scenario.delete_meta`. - :pull:`349`: Avoid modifying indexers dictionary in :meth:`.AttrSeries.sel`. - :pull:`343`: Add region/unit parameters to :meth:`.Platform.export_timeseries_data`. diff --git a/ixmp/backend/io.py b/ixmp/backend/io.py index 1194f2d06..defba6c6a 100644 --- a/ixmp/backend/io.py +++ b/ixmp/backend/io.py @@ -203,7 +203,7 @@ def parse_item_sheets(name): dfs.append(xf.parse(x)) # Concatenate once and return - return pd.concat(dfs, axis=1) + return pd.concat(dfs, axis=0) # Add sets in two passes: # 1. Index sets, required to initialize other sets. diff --git a/ixmp/tests/backend/test_io.py b/ixmp/tests/backend/test_io.py new file mode 100644 index 000000000..848ddb6f9 --- /dev/null +++ b/ixmp/tests/backend/test_io.py @@ -0,0 +1,27 @@ +import ixmp +from ixmp.testing import add_random_model_data, models + + +def test_read_excel_big(test_mp, tmp_path): + """Excel files with model items split across sheets can be read. + + https://github.com/iiasa/ixmp/pull/345. + """ + tmp_path /= 'output.xlsx' + + # Write a 25-element parameter with max_row=10 → split across 3 sheets + scen = ixmp.Scenario(test_mp, **models['dantzig'], version="new") + add_random_model_data(scen, 25) + scen.to_excel(tmp_path, items=ixmp.ItemType.MODEL, max_row=10) + + # Initialize target scenario for reading + scen_empty = ixmp.Scenario(test_mp, "foo", "bar", version="new") + scen_empty.init_set("random_set") + scen_empty.init_par( + "random_par", scen.idx_sets("random_par"), scen.idx_names("random_par") + ) + + # File can be read + scen_empty.read_excel(tmp_path) + + assert len(scen_empty.par("random_par")) == 25