Skip to content

Commit

Permalink
Merge pull request #223 from SANDAG/ABM3_validation
Browse files Browse the repository at this point in the history
Update Validation for ABM3
  • Loading branch information
bhargavasana authored Oct 22, 2024
2 parents 52d29f5 + 24882a5 commit b0ecce4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 53 deletions.
60 changes: 7 additions & 53 deletions src/main/emme/toolbox/master_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def __call__(self, main_directory, scenario_id, scenario_title, emmebank_title,
export_network_data = modeller.tool("sandag.export.export_data_loader_network")
export_matrix_data = modeller.tool("sandag.export.export_data_loader_matrices")
export_for_commercial_vehicle = modeller.tool("sandag.export.export_for_commercial_vehicle")
validation = modeller.tool("sandag.validation.validation")
file_manager = modeller.tool("sandag.utilities.file_manager")
utils = modeller.module('sandag.utilities.demand')
load_properties = modeller.tool('sandag.utilities.properties')
Expand Down Expand Up @@ -353,7 +352,6 @@ def __call__(self, main_directory, scenario_id, scenario_title, emmebank_title,
path_forward_slash = path_no_drive.replace("\\", "/")
input_dir = _join(self._path, "input")
output_dir = _join(self._path, "output")
validation_dir = _join(self._path, "analysis/validation")
main_emmebank = _eb.Emmebank(_join(self._path, "emme_project", "Database", "emmebank"))
if emmebank_title:
main_emmebank.title = emmebank_title
Expand Down Expand Up @@ -795,64 +793,20 @@ def __call__(self, main_directory, scenario_id, scenario_title, emmebank_title,
[drive, drive + path_forward_slash],
"Exporting MGRA-level travel times", capture_output=True)

# This validation procedure only works with base (2022) scenarios utilizing TNED networks
if scenarioYear == "2022":
self.run_proc(
"runValidation.bat",
[drive, path_no_drive, scenarioYear],
"Validation", capture_output=True)

if not skipDatalake:
self.write_metadata(main_directory, scenario_title, select_link, username, scenarioYear, sample_rate, prod_env, props)
self.run_proc(
"write_to_datalake.cmd",
[drive, drive + path_forward_slash, prod_env],
"Writing model output to datalake", capture_output=True)

#Validation for 2022 scenario
if scenarioYear == "2016":
validation(self._path, main_emmebank, base_scenario) # to create source_EMME.xlsx

# #Create Worksheet for ABM Validation using PowerBI Visualization #JY: can be uncommented if deciding to incorporate PowerBI vis in ABM workflow
# self.run_proc("VisPowerBI.bat", # forced to update excel links
# [drive, path_no_drive, scenarioYear, 0],
# "VisPowerBI",
# capture_output=True)

### CL: Below step is temporarily used to update validation output files. When Gregor complete Upload procedure, below step should be removed. 05/31/20
# self.run_proc("ExcelUpdate.bat", # forced to update excel links
# [drive, path_no_drive, scenarioYear, 0],
# "ExcelUpdate",
# capture_output=True)

### ES: Commented out until this segment is updated to reference new database. 9/10/20 ###
# add segments below for auto-reporting, YMA, 1/23/2019
# add this loop to find the sceanro_id in the [dimension].[scenario] table

#database_scenario_id = 0
#int_hour = 0
#while int_hour <= 96:

# database_scenario_id = self.sql_select_scenario(scenarioYear, end_iteration,
# sample_rate[end_iteration - 1], path_no_drive,
# start_db_time)
# if database_scenario_id > 0:
# break

# int_hour = int_hour + 1
# _time.sleep(900) # wait for 15 mins

# if load failed, then send notification email
#if database_scenario_id == 0 and int_hour > 96:
# str_request_check_result = self.sql_check_load_request(scenarioYear, path_no_drive, username,
# start_db_time)
# print(str_request_check_result)
# sys.exit(0)
# self.send_notification(str_request_check_result,username) #not working in server
#else:
# print(database_scenario_id)
# self.run_proc("DataSummary.bat", # get summary from database, added for auto-reporting
# [drive, path_no_drive, scenarioYear, database_scenario_id],
# "Data Summary")

# self.run_proc("ExcelUpdate.bat", # forced to update excel links
# [drive, path_no_drive, scenarioYear, database_scenario_id],
# "Excel Update",
# capture_output=True)

# # terminate all java processes
# _subprocess.call("taskkill /F /IM java.exe")

Expand Down
25 changes: 25 additions & 0 deletions src/main/resources/runValidation.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
rem COPY REQUIRED FILES TO SPECIFIED ABM SCENARIO
@echo off

set SOURCE_DIRECTORY=\\sandag.org\transdata\ABM\release\tools\PowerBI_validation_tool
set PROJECT_DRIVE=%1
set PROJECT_DIRECTORY=%2
set VALIDATION_DIRECTORY=%PROJECT_DRIVE%%PROJECT_DIRECTORY%\analysis\validation

rem Create Validation Folder If Not Exist
if not exist %VALIDATION_DIRECTORY% mkdir %VALIDATION_DIRECTORY%

rem ### Copy files using xcopy
set SCENARIOYEAR=%3
xcopy %SOURCE_DIRECTORY%\data\%SCENARIOYEAR%\ %VALIDATION_DIRECTORY% /S /E /Y

rem CREATE VIS WORKSHEET FOR POWER BI VISUALIZATIONS
rem ### Connecting to Anaconda3 Environment
set ENV=%CONDA_PREFIX%
call %ENV%\Scripts\activate.bat %ENV%

rem ### Use ABM3 conda env (for both tcov and tned)
call activate asim_baydag

rem ### Running validation pipeline for input scenario
python %SOURCE_DIRECTORY%\src\%SCENARIOYEAR%\validation.py %PROJECT_DRIVE%%PROJECT_DIRECTORY% %SCENARIOYEAR%

0 comments on commit b0ecce4

Please sign in to comment.