diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 31e40db..0aab798 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========= +v1.0.10 (2024-10-25) +------------------- + +- migrate cluster group from "other" to "other 1" inside v8.1 upgrader + v1.0.9 (2024-10-16) ------------------- diff --git a/src/antares/study/version/__about__.py b/src/antares/study/version/__about__.py index 79c20b7..6500251 100644 --- a/src/antares/study/version/__about__.py +++ b/src/antares/study/version/__about__.py @@ -4,7 +4,7 @@ # Standard project metadata -__version__ = "1.0.9" +__version__ = "1.0.10" __author__ = "RTE, Antares Web Team" -__date__ = "2024-10-16" +__date__ = "2024-10-25" __credits__ = "© Réseau de Transport de l’Électricité (RTE)" diff --git a/src/antares/study/version/upgrade_app/upgrader_0801.py b/src/antares/study/version/upgrade_app/upgrader_0801.py index 78e4d49..53db539 100644 --- a/src/antares/study/version/upgrade_app/upgrader_0801.py +++ b/src/antares/study/version/upgrade_app/upgrader_0801.py @@ -4,6 +4,8 @@ from antares.study.version.model.study_version import StudyVersion from .upgrade_method import UpgradeMethod +from antares.study.version.ini_writer import IniWriter +from antares.study.version.ini_reader import IniReader class UpgradeTo0801(UpgradeMethod): @@ -28,3 +30,13 @@ def upgrade(cls, study_dir: Path) -> None: data.to_ini_file(study_dir) study_dir.joinpath("input", "renewables", "clusters").mkdir(parents=True, exist_ok=True) study_dir.joinpath("input", "renewables", "series").mkdir(parents=True, exist_ok=True) + + # Migrate thermal group from Other to Other 1 + thermal_cluster_dir = study_dir / "input" / "thermal" / "clusters" + for area in thermal_cluster_dir.iterdir(): + ini_path = thermal_cluster_dir / area / "list.ini" + sections = IniReader().read(ini_path) + for section in sections.values(): + if section["group"].lower() == "Other".lower(): + section["group"] = "other 1" + IniWriter().write(sections, ini_path) diff --git a/tests/upgrade_app/test_upgrade_0801.py b/tests/upgrade_app/test_upgrade_0801.py index 650a8e4..3a8a1ab 100644 --- a/tests/upgrade_app/test_upgrade_0801.py +++ b/tests/upgrade_app/test_upgrade_0801.py @@ -19,7 +19,9 @@ def test_nominal_case(study_assets: StudyAssets): expected = IniReader().read(expected_path) assert actual == expected - # compare folders (because the upgrade should create empty "renewables" folder) + # compare input folders: + # 1- The upgrade should create empty "renewables" folder + # 2- The upgrade should rename old thermal groups assert are_same_dir( study_assets.study_dir.joinpath("input"), study_assets.expected_dir.joinpath("input"), diff --git a/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.expected.zip b/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.expected.zip deleted file mode 100644 index 4b5f52b..0000000 Binary files a/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.expected.zip and /dev/null differ diff --git a/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.zip b/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.zip deleted file mode 100644 index 507d8a9..0000000 Binary files a/tests/upgrade_app/upgrade_0801/nominal_case/empty_study_0800.zip and /dev/null differ diff --git a/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.expected.zip b/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.expected.zip new file mode 100644 index 0000000..c70a79f Binary files /dev/null and b/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.expected.zip differ diff --git a/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.zip b/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.zip new file mode 100644 index 0000000..437220e Binary files /dev/null and b/tests/upgrade_app/upgrade_0801/nominal_case/little_study_0800.zip differ