-
Notifications
You must be signed in to change notification settings - Fork 9
County network test framework #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
I had to make changes to the functional code, so I wanted to branch in case it breaks something
|
This is my attempt to run it. Create working directory and copy hwy input aux files E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\inputs\hwy
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Outputs\2015-tm22-dev-sprint-04\inputs\hwy\tolls.csv" E:\2015_TM2_20260113\inputs\hwy
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Outputs\2015-tm22-dev-sprint-04\inputs\hwy\interchange_nodes.csv" E:\2015_TM2_20260113\inputs\hwyCopy in land use input E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\inputs\landuse
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Outputs\2015-tm22-dev-sprint-04\inputs\landuse\maz_data.csv" E:\2015_TM2_20260113\inputs\landuseCopy in demand input E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\demand_matrices\highway\household
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Outputs\2015-tm22-dev-sprint-04\demand_matrices\highway\household\TAZ_Demand_??.omx" E:\2015_TM2_20260113\demand_matrices\highway\householdcopy in hwy network input E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\emme_project
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Outputs\2015-tm22-dev-sprint-04\emme_project\mtc_emme.emp" E:\2015_TM2_20260113\emme_project
E:\GitHub\tm2\tm2py\tests>copy "E:\Box\Modeling and Surveys\Development\Travel Model Two Conversion\Model Inputs\2015-tm22-dev-sprint-04\emme_network\Database_highway_EMME_24.01.00.zip" E:\2015_TM2_20260113\emme_project
E:\GitHub\tm2\tm2py\tests>"C:\Program Files\7-Zip\7z.exe" x E:\2015_TM2_20260113\emme_project_source\Database_highway_EMME_24.01.00.zip -oE:\2015_TM2_20260113\emme_projectcopy in config E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\san_mateo_test\config
E:\GitHub\tm2\tm2py\tests>copy config_templates\fixed_san_mateo_model.toml E:\2015_TM2_20260113\san_mateo_test\config\model.toml
E:\GitHub\tm2\tm2py\tests>copy config_templates\fixed_san_mateo_scenario.toml E:\2015_TM2_20260113\san_mateo_test\config\scenario.toml |
|
When I ran: E:\GitHub\tm2\tm2py\tests>python run_county_test.py --config county_test_config.toml
Loading configuration from: county_test_config.toml
INFO: County Test Framework - Starting
INFO: Configuration file: county_test_config.toml
INFO: ======================================================================
INFO: CONFIGURATION SUMMARY
INFO: ======================================================================
INFO: County: San Mateo
INFO: EMME project source: E:/2015_TM2_20260113/emme_project
INFO: Inputs source: E:/2015_TM2_20260113
INFO: Output directory: E:/2015_TM2_20260113/san_mateo_test
INFO: Filter demand: True
INFO: Skip EMME copy: False
INFO: Skip setup: True
INFO: ======================================================================
INFO: ======================================================================
INFO: CHECKING PREREQUISITES
INFO: ======================================================================
INFO: County: San Mateo
INFO: ✓ EMME project found: E:\2015_TM2_20260113\emme_project
INFO: ✓ EMME database found: E:\2015_TM2_20260113\emme_project\Database_highway\emmebank
INFO: ✓ Inputs source found: E:\2015_TM2_20260113
INFO: ✓ MAZ data found: E:\2015_TM2_20260113\inputs\landuse\maz_data.csv
INFO: ✓ Tolls found: E:\2015_TM2_20260113\inputs\hwy\tolls.csv
INFO: ✓ AM Demand found: E:\2015_TM2_20260113\demand_matrices\highway\household\TAZ_Demand_AM.omx
INFO: ✓ Config templates found: E:\GitHub\tm2\tm2py\tests\config_templates
INFO: ✓ All prerequisites met!
INFO: Auto-confirm enabled, proceeding with test
INFO: Skipping setup, using existing directory: E:\2015_TM2_20260113\san_mateo_test
INFO: File logging started: E:\2015_TM2_20260113\san_mateo_test\logs\county_test_20260113_175028.log
INFO: Starting test execution...
INFO: ======================================================================
INFO: RUNNING HIGHWAY TEST
INFO: ======================================================================
INFO: Importing CountyHighwayController...
INFO: Initializing controller for San Mateo County...Emme says: 'File E:\tests\san_mateo_test\emme_project\mtc_emme.emp specified as the startup project does not exist!' => updated |
|
Next error: => I deleted references to the other non-highway databases in the |
|
Next error: => copied inputs into test dir E:\GitHub\tm2\tm2py\tests>mkdir E:\2015_TM2_20260113\san_mateo_test\inputs\hwy\
E:\GitHub\tm2\tm2py\tests>copy E:\2015_TM2_20260113\inputs\hwy\*.csv E:\2015_TM2_20260113\san_mateo_test\inputs\hwy |
|
Last test: Hmm... another problem with the .emp file? @Ennazus - which one did you use? |
|
Can you attach the configs for this test? I used the San Mateo County emp. The way the test works is it copies the emp to a new location at the beginning. |
|
These are the local changes to my config: |
I'd been using network outputs files instead of inputs, which obviscated the fact that some of the processing like create_tod_scenarios was not correctly included in the test.
County Network Test Framework Enhancements
Summary
This PR enhances the county network testing framework with improved documentation, defensive attribute checking, resource monitoring, and comprehensive network inspection tools. The changes make the testing system more robust and easier to use, especially when working with networks that may have incomplete attribute initialization (e.g., OSM-derived networks).
Statistics
Key Changes
1. 📚 Documentation Overhaul (~2,500 lines)
New comprehensive testing documentation in
docs/testing/:Also added:
2. 🛡️ Defensive Attribute Checking (Production Code)
Enhanced
tm2py/components/network/highway/highway_network.py(+151/-4):Added comprehensive attribute checking in 4 methods:
_set_tolls(): Checks for@tollbooth,@tollseg,@useclass_set_vdf_attributes(): Checks for@capclass,@lanes,@ft,@free_flow_speed_set_link_modes(): Checks for@drive_link_calc_link_skim_lengths(): Checks for@useclass,@tollboothBenefits:
3. 📊 Resource Monitoring
Enhanced
tm2py/components/network/highway/highway_assign.py(+88/-4):Added
monitor_resources()context manager:resource_monitor.logfileApplied to:
4. 🔧 Test Framework Improvements
Major refactor of
tests/run_county_test.py(+478/-105):New
tests/county_test_config.toml(102 lines):Enhanced
tests/highway_assign_skim_controller.py(+130/-2):5. 🔍 Network Inspection Tools (New Utilities)
Created comprehensive network diagnostic tools:
6. 📝 OSM Network Investigation
Documentation of OSM network attribute investigation:
7. ⚙️ Configuration Templates
8. 🧹 Documentation Cleanup
Removed outdated documentation (content moved to
docs/testing/):tests/COUNTY_TEST_FRAMEWORK_UPDATE.md(205 lines)tests/HIGHWAY_ASSIGN_SKIM_README.md(405 lines)tests/TESTING_INSTRUCTIONS.md(185 lines)9. 🐛 Minor Fixes
tm2py/emme/manager.py(1 line):.lower()on time_period lookup (preserves case sensitivity)Testing
Backward Compatibility
Dependencies
psutilfor resource monitoring (already in requirements)threading(stdlib)Review Notes
docs/testing/)Questions for Reviewers
tests/or move todocs/?Reviewer: @lmz (Lisa Zorn)