Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ windIO = [
Homepage = "https://github.com/IEAWindSystems/windIO"
Documentation = "https://ieawindsystems.github.io/windio"

[project.scripts]
windio_converter = "windIO.converters.windIO2windIO:run"

[tool.pytest.ini_options]
filterwarnings = [
"error"
Expand Down
28 changes: 19 additions & 9 deletions windIO/converters/windIO2windIO.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env python
import argparse
import sys
import os
import traceback
from copy import deepcopy
Expand Down Expand Up @@ -761,18 +764,25 @@ def convert_controls(self, dict_v2p0):

return dict_v2p0


if __name__ == "__main__":

from pathlib import Path

turbine_reference_path = Path(windIO.turbine_ex.__file__).parent

filename_v1p0 = "../../test/turbine/v1p0/IEA-15-240-RWT.yaml"
filename_v2p0 = turbine_reference_path / "IEA-15-240-RWT_v2p0.yaml"
def run():
parser = argparse.ArgumentParser(description="WindIO v1->v2 Converter")
parser.add_argument("-i", "--input", help="Input v1 filename path")
parser.add_argument("-o", "--output", help="Output v2 filename path")
args = parser.parse_args()

filename_v1p0 = args.input
filename_v2p0 = args.output

if not os.path.exists(filename_v1p0):
raise Exception("Point to an existing yaml file that you want to convert from windIO v1.0 to v2.0.")
raise Exception(f"Cannot find input windIO v1.0 file: {filename_v1p0}.")

converter = v1p0_to_v2p0(filename_v1p0, filename_v2p0)
converter.convert()

sys.exit(0)


if __name__ == "__main__":
run()

Loading