-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(simulator): API change to add support for study version 8.8 (#2006)
- Loading branch information
1 parent
e7cb3aa
commit 33ae79a
Showing
14 changed files
with
179 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import glob | ||
from pathlib import Path | ||
|
||
from antarest.study.storage.rawstudy.ini_reader import IniReader | ||
from antarest.study.storage.rawstudy.ini_writer import IniWriter | ||
from antarest.study.storage.rawstudy.model.filesystem.root.settings.generaldata import DUPLICATE_KEYS | ||
|
||
|
||
# noinspection SpellCheckingInspection | ||
def upgrade_880(study_path: Path) -> None: | ||
""" | ||
Upgrade the study configuration to version 880. | ||
NOTE: | ||
The file `study.antares` is not upgraded here. | ||
Args: | ||
study_path: path to the study directory. | ||
""" | ||
st_storage_path = study_path / "input" / "st-storage" / "clusters" | ||
if not st_storage_path.exists(): | ||
# The folder only exists for studies in v8.6+ that have some short term storage clusters. | ||
# For every other case, this upgrader has nothing to do. | ||
return | ||
writer = IniWriter(special_keys=DUPLICATE_KEYS) | ||
cluster_files = glob.glob(str(st_storage_path / "*" / "list.ini")) | ||
for file in cluster_files: | ||
file_path = Path(file) | ||
cluster_list = IniReader().read(file_path) | ||
for cluster in cluster_list: | ||
cluster_list[cluster]["enabled"] = True | ||
writer.write(cluster_list, file_path) |
Binary file not shown.
Oops, something went wrong.