Skip to content

Commit

Permalink
Merge pull request #141 from SANDAG/ABM3_gui_lu
Browse files Browse the repository at this point in the history
Update ABM3 GUI to select land use scenario
  • Loading branch information
JoeJimFlood authored May 21, 2024
2 parents 434c3ba + 2bee762 commit 4ee1dcc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
53 changes: 38 additions & 15 deletions src/main/python/pythonGUI/createStudyAndScenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,48 @@ def record_selection(self):


class CreateScenarioGUI(tkinter.Frame):
def __init__(self, root, emme_version = "4.3.7", year = "2016", geo = "1", lu = "DS41"):
def __init__(self, root, emme_version = "4.3.7", year = "2022", geo = "1", lu = "S0"):
tkinter.Frame.__init__(self, root, border=5)
body = tkinter.Frame(self)
body.pack(fill=constants.X, expand=1)
sticky = constants.E + constants.W
body.grid_columnconfigure(1, weight=2)

#Define land use options
self.lu_options = {"DS41": {"name": "Baseline",
"years": ["2022", "2025nb", "2030nb", "2035nb", "2040nb", "2050nb"]},
"DS42": {"name": "Sustainable Community Strategy",
"years": ["2016", "2023", "2025", "2026", "2029", "2030", "2032", "2035", "2040", "2050"]}}
self.lu_options = {
"S0": {
"name": "Baseline",
"location": r"T:\socioec\Current_Projects\SR15\S0\version16",
"years": ["2022", "2026", "2029", "2035", "2050"]
},
"S1": {
"name": "Baseline + RHNA Adjustment",
"location": r"T:\socioec\Current_Projects\SR15\S1\version12",
"years": ["2022", "2026", "2029", "2035"]
},
"S2": {
"name": "Sustainable Community Strategy",
"location": r"T:\socioec\Current_Projects\SR15\S2\version17",
"years": ["2022", "2035"]
},
"S3": {
"name": "SCS with Higher Density",
"location": r"T:\socioec\Current_Projects\SR15\S3\version18",
"years": ["2035"]
}
}

self.root = root
self.emme_version = emme_version
self.year = year
self.geo = geo
self.lu = lu

if self.year not in self.lu_options[self.lu]["years"]:
if self.year in self.lu_options["DS41"]["years"]:
self.lu = "DS41"
else:
self.lu = "DS42"
# if self.year not in self.lu_options[self.lu]["years"]:
# if self.year in self.lu_options["DS41"]["years"]:
# self.lu = "DS41"
# else:
# self.lu = "DS42"

yearOptionList = []
for lu in self.lu_options:
Expand All @@ -89,7 +107,7 @@ def __init__(self, root, emme_version = "4.3.7", year = "2016", geo = "1", lu =
self.releaseDir=os.path.abspath(os.path.join(os.path.dirname(sys.executable), '..', '..'))
else:
self.releaseDir=os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
self.defaultScenarioDir="T:\\projects\\sr15"
self.defaultScenarioDir="T:\\projects\\sr15\\MyRun"
self.defaultNetworkDir="T:\\RTP\\2021RP\\2021rp_final\\network_build"

current_row = 0
Expand All @@ -98,7 +116,7 @@ def __init__(self, root, emme_version = "4.3.7", year = "2016", geo = "1", lu =
self.buttonVar= tkinter.IntVar(root)
self.yButton=tkinter.Radiobutton(body, text="Yes", variable=self.buttonVar, value=1, command=self.initStudy)
self.nButton=tkinter.Radiobutton(body, text="No", variable=self.buttonVar, value=0,command=self.initStudy)
tkinter.Label(body, text=u"Release Version 14.3.0\n"+divider, font=("Helvetica", 11, 'bold'), width=50, fg='royal blue').grid(row=current_row,columnspan=5)
tkinter.Label(body, text=u"Release Version 15.0.0\n"+divider, font=("Helvetica", 11, 'bold'), width=50, fg='royal blue').grid(row=current_row,columnspan=5)
current_row += 1
tkinter.Label(body, text=u"Create an ABM Work Space", font=("Helvetica", 10, 'bold')).grid(row=current_row,columnspan=n_columns)
current_row += 1
Expand Down Expand Up @@ -380,16 +398,21 @@ def update_property(self, old, new):
def executeBatch(self, type):
self.popup.destroy()
if type=="scenario":
commandstr = u"create_scenario.cmd %s %s %s %s" % (
if self.year == "2035":
lu_input_path = os.path.join(self.lu_options[self.lu]["location"], "abm_csv", "processed", "2035_baseline")
else:
lu_input_path = os.path.join(self.lu_options[self.lu]["location"], "abm_csv", "processed", str(self.year))
commandstr = u"create_scenario.cmd %s %s %s %s %s" % (
self.scenariopath.get(),
self.year,
self.networkpath.get(),
self.emme_version
self.emme_version,
lu_input_path
)
os.chdir(self.releaseDir+"\\"+self.version+'\\')
os.system(commandstr)
#self.update_property("version=version_14_2_2", "version=version_14_2_2\nLU version=" + self.lu)
self.update_property("version=version_14_3_0", "version=version_14_3_0\nLU version=" + self.lu)
self.update_property("version=version_15_0_0", "version=version_15_0_0\nLU version=" + self.lu)
self.update_property("geographyID=1", "geographyID=" + self.geo.get())
elif type=="study":
studyyears = self.studyyears.get().split(',')
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/create_scenario.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ if "%1"=="" goto usage
if "%2"=="" goto usage
if "%3"=="" goto usage
if "%4"=="" goto usage
if "%5"=="" goto usage

set SCENARIO_FOLDER=%1
set YEAR=%2
set NETWORKDIR=%3
set EMME_VERSION=%4
set LANDUSE_INPUT_PATH=%5

@echo creating scenario folders
set FOLDERS=input application bin conf input_truck logFiles output python report sql uec analysis visualizer visualizer\outputs\summaries input_checker src src\asim src\asim-cvm
Expand Down Expand Up @@ -76,6 +78,10 @@ xcopy /Y .\common\input\input_checker\"*.*" %SCENARIO_FOLDER%
rem copy network inputs
call copy_networks.cmd %NETWORKDIR% %SCENARIO_FOLDER%\input

rem copying land use inputs
xcopy /Y %LANDUSE_INPUT_PATH%\"households.csv" %SCENARIO_FOLDER%\input
xcopy /Y %LANDUSE_INPUT_PATH%\"persons.csv" %SCENARIO_FOLDER%\input
xcopy /Y %LANDUSE_INPUT_PATH%\"mgra15_based_input"%YEAR%".csv" %SCENARIO_FOLDER%\input

rem copy analysis templates
@echo copy analysis templates
Expand Down

0 comments on commit 4ee1dcc

Please sign in to comment.