diff --git a/Main.py b/Main.py deleted file mode 100644 index 3f4f8d5..0000000 --- a/Main.py +++ /dev/null @@ -1,45 +0,0 @@ -import AutoGTAP as Ag - -# Call Methods -# Load config files that will control program -config = Ag.CreateConfig("config.yaml") -# Delete working files directory -Ag.CleanWorkFiles() -# For each simulation, perform the different subparts (data aggregation, splitting, -# experiment simulation, etc) that make up that simulation -for simulation_name in config.simulation_list: - # Add one to final range so that python will run the last part too - for part_num in range(1, config.num_parts(simulation_name) + 1): - - part_type = config.yaml_file["simulations"][simulation_name]["subparts"][part_num]["type"] - - # Copy input files for this part to the appropriate work directory - Ag.CopyInputFiles(config, simulation_name, part_num).copy() - - # Copy Work files from the previous part to the work directory for this part, unless this is the first part - if part_num != 1: - Ag.MoveFilesBetweenSteps(config, simulation_name, part_num) - - # Run the actual work for this part, depending on which type of part it is - if part_type == "GTPAg2": - Ag.AggregateModelData(config, simulation_name, part_num) - - elif part_type == "MSplitCom-Exe": - Ag.SplitCommodities(simulation_name) - - elif part_type == "modify_har": - Ag.ModifyHAR(config, simulation_name, part_num) - - elif part_type == "GTPVEW-V6" or part_type == "Shocks-V6": - Ag.Gtpvew(config, simulation_name, part_num) - - elif part_type == "GTAP-Adjust": - Ag.GTAPAdjustCMF(config, simulation_name, part_num) - - elif part_type == "GTAP-V6" or part_type == "GTAP-E": - Ag.GtapModel(config, simulation_name, part_num) - - else: - raise ValueError('Unexpected part type: %s' % part_type) - -Ag.ExportResults(config) diff --git a/main.py b/main.py new file mode 100644 index 0000000..9e5fa1e --- /dev/null +++ b/main.py @@ -0,0 +1,65 @@ +from src.AutoGTAP.AggregateModelData import * +from src.AutoGTAP.CleanWorkFiles import * +from src.AutoGTAP.CopyInputFiles import * +from src.AutoGTAP.CreateConfig import * +from src.AutoGTAP.CreateMAP import * +from src.AutoGTAP.CreateOutput import * +from src.AutoGTAP.CreateSTI import * +from src.AutoGTAP.ExportDictionary import * +from src.AutoGTAP.ExportResults import * +from src.AutoGTAP.GTAPAdjustCMF import * +from src.AutoGTAP.GtapModel import * +from src.AutoGTAP.Gtpvew import * +from src.AutoGTAP.ImportCsvSl4 import * +from src.AutoGTAP.ModifyDatabase import * +from src.AutoGTAP.ModifyHAR import * +from src.AutoGTAP.MoveFilesBetweenSteps import * +from src.AutoGTAP.Shocks import * +from src.AutoGTAP.SimulationCMF import * +from src.AutoGTAP.SplitCommodities import * + + + +# Call Methods +# Load config files that will control program +config = CreateConfig("config.yaml") +# Delete working files directory +CleanWorkFiles() +# For each simulation, perform the different subparts (data aggregation, splitting, +# experiment simulation, etc) that make up that simulation +for simulation_name in config.simulation_list: + # Add one to final range so that python will run the last part too + for part_num in range(1, config.num_parts(simulation_name) + 1): + + part_type = config.yaml_file["simulations"][simulation_name]["subparts"][part_num]["type"] + + # Copy input files for this part to the appropriate work directory + CopyInputFiles(config, simulation_name, part_num).copy() + + # Copy Work files from the previous part to the work directory for this part, unless this is the first part + if part_num != 1: + MoveFilesBetweenSteps(config, simulation_name, part_num) + + # Run the actual work for this part, depending on which type of part it is + if part_type == "GTPAg2": + AggregateModelData(config, simulation_name, part_num) + + elif part_type == "MSplitCom-Exe": + SplitCommodities(simulation_name) + + elif part_type == "modify_har": + ModifyHAR(config, simulation_name, part_num) + + elif part_type == "GTPVEW-V6" or part_type == "Shocks-V6": + Gtpvew(config, simulation_name, part_num) + + elif part_type == "GTAP-Adjust": + GTAPAdjustCMF(config, simulation_name, part_num) + + elif part_type == "GTAP-V6" or part_type == "GTAP-E": + GtapModel(config, simulation_name, part_num) + + else: + raise ValueError('Unexpected part type: %s' % part_type) + +ExportResults(config) diff --git a/src/AutoGTAP/AggregateModelData/AggregateModelData.py b/src/AutoGTAP/AggregateModelData.py similarity index 100% rename from src/AutoGTAP/AggregateModelData/AggregateModelData.py rename to src/AutoGTAP/AggregateModelData.py diff --git a/src/AutoGTAP/AggregateModelData/README.md b/src/AutoGTAP/AggregateModelData/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CleanWorkFiles/CleanWorkFiles.py b/src/AutoGTAP/CleanWorkFiles.py similarity index 100% rename from src/AutoGTAP/CleanWorkFiles/CleanWorkFiles.py rename to src/AutoGTAP/CleanWorkFiles.py diff --git a/src/AutoGTAP/CleanWorkFiles/README.md b/src/AutoGTAP/CleanWorkFiles/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CleanWorkFiles/__init__.py b/src/AutoGTAP/CleanWorkFiles/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CopyInputFiles/CopyInputFiles.py b/src/AutoGTAP/CopyInputFiles.py similarity index 100% rename from src/AutoGTAP/CopyInputFiles/CopyInputFiles.py rename to src/AutoGTAP/CopyInputFiles.py diff --git a/src/AutoGTAP/CopyInputFiles/README.md b/src/AutoGTAP/CopyInputFiles/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CopyInputFiles/__init__.py b/src/AutoGTAP/CopyInputFiles/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateConfig/CreateConfig.py b/src/AutoGTAP/CreateConfig.py similarity index 100% rename from src/AutoGTAP/CreateConfig/CreateConfig.py rename to src/AutoGTAP/CreateConfig.py diff --git a/src/AutoGTAP/CreateConfig/README.md b/src/AutoGTAP/CreateConfig/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateConfig/__init__.py b/src/AutoGTAP/CreateConfig/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateMAP/CreateMAP.py b/src/AutoGTAP/CreateMAP.py similarity index 100% rename from src/AutoGTAP/CreateMAP/CreateMAP.py rename to src/AutoGTAP/CreateMAP.py diff --git a/src/AutoGTAP/CreateMAP/README.md b/src/AutoGTAP/CreateMAP/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateMAP/__init__.py b/src/AutoGTAP/CreateMAP/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateOutput/CreateOutput.py b/src/AutoGTAP/CreateOutput.py similarity index 100% rename from src/AutoGTAP/CreateOutput/CreateOutput.py rename to src/AutoGTAP/CreateOutput.py diff --git a/src/AutoGTAP/CreateOutput/__init__.py b/src/AutoGTAP/CreateOutput/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateSTI/CreateSTI.py b/src/AutoGTAP/CreateSTI.py similarity index 100% rename from src/AutoGTAP/CreateSTI/CreateSTI.py rename to src/AutoGTAP/CreateSTI.py diff --git a/src/AutoGTAP/CreateSTI/README.md b/src/AutoGTAP/CreateSTI/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/CreateSTI/__init__.py b/src/AutoGTAP/CreateSTI/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ExportDictionary/ExportDictionary.py b/src/AutoGTAP/ExportDictionary.py similarity index 100% rename from src/AutoGTAP/ExportDictionary/ExportDictionary.py rename to src/AutoGTAP/ExportDictionary.py diff --git a/src/AutoGTAP/ExportDictionary/README.md b/src/AutoGTAP/ExportDictionary/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ExportDictionary/__init__.py b/src/AutoGTAP/ExportDictionary/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ExportResults/ExportResults.py b/src/AutoGTAP/ExportResults.py similarity index 78% rename from src/AutoGTAP/ExportResults/ExportResults.py rename to src/AutoGTAP/ExportResults.py index 80b2704..1c2361b 100644 --- a/src/AutoGTAP/ExportResults/ExportResults.py +++ b/src/AutoGTAP/ExportResults.py @@ -3,10 +3,10 @@ __created__ = "2018-7-19" import os -from AutoGTAP.ImportCSV_SL4.ImportCsvSl4 import ImportCsvSl4 -from AutoGTAP.ModifyDatabase.ModifyDatabase import ModifyDatabase -from AutoGTAP.ExportDictionary.ExportDictionary import ExportDictionary -from AutoGTAP.CreateOutput.CreateOutput import CreateOutput +from src.AutoGTAP.ImportCsvSl4 import ImportCsvSl4 +from src.AutoGTAP.ModifyDatabase import ModifyDatabase +from src.AutoGTAP.ExportDictionary import ExportDictionary +from src.AutoGTAP.CreateOutput import CreateOutput class ExportResults(object): diff --git a/src/AutoGTAP/ExportResults/README.md b/src/AutoGTAP/ExportResults/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ExportResults/__init__.py b/src/AutoGTAP/ExportResults/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/GTAPAdjustCMF/GTAPAdjustCMF.py b/src/AutoGTAP/GTAPAdjustCMF.py similarity index 99% rename from src/AutoGTAP/GTAPAdjustCMF/GTAPAdjustCMF.py rename to src/AutoGTAP/GTAPAdjustCMF.py index aaace2e..b1f6c96 100644 --- a/src/AutoGTAP/GTAPAdjustCMF/GTAPAdjustCMF.py +++ b/src/AutoGTAP/GTAPAdjustCMF.py @@ -2,7 +2,7 @@ __project__ = "Auto-GTAP" __created__ = "2018-5-4" -from AutoGTAP.Shocks.Shocks import Shocks +from src.AutoGTAP.Shocks import Shocks import os import subprocess diff --git a/src/AutoGTAP/GTAPAdjustCMF/README.md b/src/AutoGTAP/GTAPAdjustCMF/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/GTAPAdjustCMF/__init__.py b/src/AutoGTAP/GTAPAdjustCMF/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/GtapModel/GtapModel.py b/src/AutoGTAP/GtapModel.py similarity index 93% rename from src/AutoGTAP/GtapModel/GtapModel.py rename to src/AutoGTAP/GtapModel.py index 46a83ac..464ee6c 100644 --- a/src/AutoGTAP/GtapModel/GtapModel.py +++ b/src/AutoGTAP/GtapModel.py @@ -4,9 +4,9 @@ import os import subprocess -from AutoGTAP.SimulationCMF.SimulationCMF import SimulationCMF -from AutoGTAP.CreateMAP.CreateMAP import CreateMAP -from AutoGTAP.CreateSTI.CreateSTI import CreateSTI +from src.AutoGTAP.SimulationCMF import SimulationCMF +from src.AutoGTAP.CreateMAP import CreateMAP +from src.AutoGTAP.CreateSTI import CreateSTI class GtapModel(object): diff --git a/src/AutoGTAP/GtapModel/README.md b/src/AutoGTAP/GtapModel/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/GtapModel/__init__.py b/src/AutoGTAP/GtapModel/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/Gtpvew/Gtpvew.py b/src/AutoGTAP/Gtpvew.py similarity index 100% rename from src/AutoGTAP/Gtpvew/Gtpvew.py rename to src/AutoGTAP/Gtpvew.py diff --git a/src/AutoGTAP/Gtpvew/README.md b/src/AutoGTAP/Gtpvew/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/Gtpvew/__init__.py b/src/AutoGTAP/Gtpvew/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ImportCSV_SL4/__init__.py b/src/AutoGTAP/ImportCSV_SL4/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ImportCSV_SL4/ImportCsvSl4.py b/src/AutoGTAP/ImportCsvSl4.py similarity index 100% rename from src/AutoGTAP/ImportCSV_SL4/ImportCsvSl4.py rename to src/AutoGTAP/ImportCsvSl4.py diff --git a/src/AutoGTAP/ModifyDatabase/ModifyDatabase.py b/src/AutoGTAP/ModifyDatabase.py similarity index 100% rename from src/AutoGTAP/ModifyDatabase/ModifyDatabase.py rename to src/AutoGTAP/ModifyDatabase.py diff --git a/src/AutoGTAP/ModifyDatabase/README.md b/src/AutoGTAP/ModifyDatabase/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ModifyDatabase/__init__.py b/src/AutoGTAP/ModifyDatabase/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ModifyHAR/ModifyHAR.py b/src/AutoGTAP/ModifyHAR.py similarity index 100% rename from src/AutoGTAP/ModifyHAR/ModifyHAR.py rename to src/AutoGTAP/ModifyHAR.py diff --git a/src/AutoGTAP/ModifyHAR/README.md b/src/AutoGTAP/ModifyHAR/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/ModifyHAR/__init__.py b/src/AutoGTAP/ModifyHAR/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/MoveFilesBetweenSteps/MoveFilesBetweenSteps.py b/src/AutoGTAP/MoveFilesBetweenSteps.py similarity index 100% rename from src/AutoGTAP/MoveFilesBetweenSteps/MoveFilesBetweenSteps.py rename to src/AutoGTAP/MoveFilesBetweenSteps.py diff --git a/src/AutoGTAP/MoveFilesBetweenSteps/README.md b/src/AutoGTAP/MoveFilesBetweenSteps/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/MoveFilesBetweenSteps/__init__.py b/src/AutoGTAP/MoveFilesBetweenSteps/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/Shocks/Shocks.py b/src/AutoGTAP/Shocks.py similarity index 100% rename from src/AutoGTAP/Shocks/Shocks.py rename to src/AutoGTAP/Shocks.py diff --git a/src/AutoGTAP/Shocks/__init__.py b/src/AutoGTAP/Shocks/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/SimulationCMF/SimulationCMF.py b/src/AutoGTAP/SimulationCMF.py similarity index 98% rename from src/AutoGTAP/SimulationCMF/SimulationCMF.py rename to src/AutoGTAP/SimulationCMF.py index 78cb8d9..fb46410 100644 --- a/src/AutoGTAP/SimulationCMF/SimulationCMF.py +++ b/src/AutoGTAP/SimulationCMF.py @@ -2,8 +2,8 @@ __project__ = "Auto-GTAP" __created__ = "2018-3-13" -from AutoGTAP.Shocks.Shocks import Shocks -from AutoGTAP.SimulationShocksShale import SimulationShocksShale +from src.AutoGTAP.Shocks import Shocks +from src.AutoGTAP.SimulationShocksShale import SimulationShocksShale class SimulationCMF(object): diff --git a/src/AutoGTAP/SimulationCMF/README.md b/src/AutoGTAP/SimulationCMF/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/SimulationCMF/__init__.py b/src/AutoGTAP/SimulationCMF/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/SplitCommodities/SplitCommodities.py b/src/AutoGTAP/SplitCommodities.py similarity index 88% rename from src/AutoGTAP/SplitCommodities/SplitCommodities.py rename to src/AutoGTAP/SplitCommodities.py index e84b179..657bb0f 100644 --- a/src/AutoGTAP/SplitCommodities/SplitCommodities.py +++ b/src/AutoGTAP/SplitCommodities.py @@ -17,6 +17,6 @@ def __init__(self, simulation_name: str) -> None: work_directory = "WorkFiles\\" + self.simulation_name + "\\MSplitCom-Exe" os.chdir(work_directory) subprocess.call("msplitbat.bat") - os.chdir("..") - os.chdir("..") - os.chdir("..") + os.chdir("") + os.chdir("") + os.chdir("") diff --git a/src/AutoGTAP/SplitCommodities/README.md b/src/AutoGTAP/SplitCommodities/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/SplitCommodities/__init__.py b/src/AutoGTAP/SplitCommodities/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/AutoGTAP/__init__.py b/src/AutoGTAP/__init__.py index 66851fc..e69de29 100644 --- a/src/AutoGTAP/__init__.py +++ b/src/AutoGTAP/__init__.py @@ -1,18 +0,0 @@ -from AutoGTAP.AggregateModelData.AggregateModelData import AggregateModelData -from AutoGTAP.CleanWorkFiles.CleanWorkFiles import CleanWorkFiles -from AutoGTAP.CopyInputFiles.CopyInputFiles import CopyInputFiles -from AutoGTAP.CreateConfig.CreateConfig import CreateConfig -from AutoGTAP.ExportDictionary.ExportDictionary import ExportDictionary -from AutoGTAP.CreateMAP.CreateMAP import CreateMAP -from AutoGTAP.CreateOutput.CreateOutput import CreateOutput -from AutoGTAP.CreateSTI.CreateSTI import CreateSTI -from AutoGTAP.GTAPAdjustCMF.GTAPAdjustCMF import GTAPAdjustCMF -from AutoGTAP.ImportCSV_SL4.ImportCsvSl4 import ImportCsvSl4 -from AutoGTAP.ModifyDatabase.ModifyDatabase import ModifyDatabase -from AutoGTAP.ModifyHAR.ModifyHAR import ModifyHAR -from AutoGTAP.MoveFilesBetweenSteps.MoveFilesBetweenSteps import MoveFilesBetweenSteps -from AutoGTAP.SimulationCMF.SimulationCMF import SimulationCMF -from AutoGTAP.SplitCommodities.SplitCommodities import SplitCommodities -from AutoGTAP.Gtpvew.Gtpvew import Gtpvew -from AutoGTAP.GtapModel.GtapModel import GtapModel -from AutoGTAP.ExportResults.ExportResults import ExportResults diff --git a/src/AutoGTAP/AggregateModelData/__init__.py b/src/__init__.py similarity index 100% rename from src/AutoGTAP/AggregateModelData/__init__.py rename to src/__init__.py