Commit 8e20f768 authored by Jan Dinkelbach's avatar Jan Dinkelbach
Browse files

move examples to cimpy package folder

parent e772edc9
Pipeline #335186 failed with stages
in 39 seconds
recursive-include examples *.xml *.py recursive-include cimpy/examples *.xml *.py
\ No newline at end of file \ No newline at end of file
from cimpy.cimexport import cim_export from cimpy.cimexport import cim_export
from cimpy.cimimport import cim_import from cimpy.cimimport import cim_import
import cimpy.utils import cimpy.utils
from cimpy.examples import import_example from cimpy.cimexamples import import_example
from cimpy.examples import export_example from cimpy.cimexamples import export_example
from cimpy.examples import addExternalNetworkInjection_example from cimpy.cimexamples import addExternalNetworkInjection_example
from cimpy.examples import convertToBusBranch_example from cimpy.cimexamples import convertToBusBranch_example
...@@ -4,30 +4,30 @@ from pathlib import Path ...@@ -4,30 +4,30 @@ from pathlib import Path
def import_example(): def import_example():
"""TODO: Add documentation """TODO: Add documentation
""" """
base = Path(__file__).resolve().parent.parent base = Path(__file__).resolve().parent
example = base / 'examples' / 'quickstart' / 'importCIGREMV.py' example = base / 'examples' / 'importCIGREMV.py'
exec(open(example).read()) exec(open(example).read())
def export_example(): def export_example():
"""TODO: Add documentation """TODO: Add documentation
""" """
base = Path(__file__).resolve().parent.parent base = Path(__file__).resolve().parent
example = base / 'examples' / 'quickstart' / 'exportCIGREMV.py' example = base / 'examples' / 'exportCIGREMV.py'
exec(open(example).read()) exec(open(example).read())
def convertToBusBranch_example(): def convertToBusBranch_example():
"""TODO: Add documentation """TODO: Add documentation
""" """
base = Path(__file__).resolve().parent.parent base = Path(__file__).resolve().parent
example = base / 'examples' / 'quickstart' / 'convertToBusBranch.py' example = base / 'examples' / 'convertToBusBranch.py'
exec(open(example).read()) exec(open(example).read())
def addExternalNetworkInjection_example(): def addExternalNetworkInjection_example():
"""TODO: Add documentation """TODO: Add documentation
""" """
base = Path(__file__).resolve().parent.parent base = Path(__file__).resolve().parent
example = base / 'examples' / 'quickstart' / 'addExternalNetworkInjection.py' example = base / 'examples' / 'addExternalNetworkInjection.py'
exec(open(example).read()) exec(open(example).read())
...@@ -4,10 +4,10 @@ from pathlib import Path ...@@ -4,10 +4,10 @@ from pathlib import Path
logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w') logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w')
example = Path(__file__).resolve().parent.parent example = Path(__file__).resolve().parent
# called as cimpy.examples.addExternalNetworkInjection() or file run from quickstart directory? # called as cimpy.examples.addExternalNetworkInjection() or file run from quickstart directory?
if 'examples.py' in str(__file__): if 'cimexamples.py' in str(__file__):
sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV'
else: else:
sample_folder = example / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'sampledata' / 'CIGRE_MV'
......
...@@ -4,10 +4,10 @@ from pathlib import Path ...@@ -4,10 +4,10 @@ from pathlib import Path
logging.basicConfig(filename='Convert_to_Bus_Branch.log', level=logging.INFO, filemode='w') logging.basicConfig(filename='Convert_to_Bus_Branch.log', level=logging.INFO, filemode='w')
example = Path(__file__).resolve().parent.parent example = Path(__file__).resolve().parent
# called as cimpy.examples.convertBusBranch() or file run from quickstart directory? # called as cimpy.examples.convertBusBranch() or file run from quickstart directory?
if 'examples.py' in str(__file__): if 'cimexamples.py' in str(__file__):
sample_folder = example / 'examples' / 'sampledata' / 'Sample_Grid_Switches' / 'Node-Breaker' sample_folder = example / 'examples' / 'sampledata' / 'Sample_Grid_Switches' / 'Node-Breaker'
else: else:
sample_folder = example / 'sampledata' / 'Sample_Grid_Switches' / 'Node-Breaker' sample_folder = example / 'sampledata' / 'Sample_Grid_Switches' / 'Node-Breaker'
......
...@@ -3,10 +3,10 @@ from pathlib import Path ...@@ -3,10 +3,10 @@ from pathlib import Path
import cimpy import cimpy
logging.basicConfig(filename='exportCIGREMV.log', level=logging.INFO, filemode='w') logging.basicConfig(filename='exportCIGREMV.log', level=logging.INFO, filemode='w')
example = Path(__file__).resolve().parent.parent example = Path(__file__).resolve().parent
# called as cimpy.examples.import_example() or file run from quickstart directory? # called as cimpy.examples.import_example() or file run from quickstart directory?
if 'examples.py' in str(__file__): if 'cimexamples.py' in str(__file__):
sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV'
else: else:
sample_folder = example / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'sampledata' / 'CIGRE_MV'
......
...@@ -4,16 +4,16 @@ from pathlib import Path ...@@ -4,16 +4,16 @@ from pathlib import Path
logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w') logging.basicConfig(filename='importCIGREMV.log', level=logging.INFO, filemode='w')
example = Path(__file__).resolve().parent.parent example = Path(__file__).resolve().parent
# called as cimpy.examples.import_example() or file run from quickstart directory? # called as cimpy.examples.import_example() or file run from quickstart directory?
if 'examples.py' in str(__file__): if 'cimexamples.py' in str(__file__):
sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'examples' / 'sampledata' / 'CIGRE_MV'
else: else:
sample_folder = example / 'sampledata' / 'CIGRE_MV' sample_folder = example / 'sampledata' / 'CIGRE_MV'
print(sample_folder)
sample_files = sample_folder.glob('*.xml') sample_files = sample_folder.glob('*.xml')
print(sample_files)
xml_files = [] xml_files = []
for file in sample_folder.glob('*.xml'): for file in sample_folder.glob('*.xml'):
xml_files.append(str(file.absolute())) xml_files.append(str(file.absolute()))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment