From d92edc98138098916e2a092b9f6cd7131378ac7d Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Thu, 16 Oct 2025 19:51:58 -0700 Subject: [PATCH 01/10] update maz data reference --- tm2py_utils/summary/acceptance/canonical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tm2py_utils/summary/acceptance/canonical.py b/tm2py_utils/summary/acceptance/canonical.py index d956f07..b95a887 100644 --- a/tm2py_utils/summary/acceptance/canonical.py +++ b/tm2py_utils/summary/acceptance/canonical.py @@ -192,7 +192,7 @@ def _make_simulated_maz_data(self): Returns: None """ - in_file = self.scenario_dict["scenario"]["maz_landuse_file"] + in_file = self.scenario_dict["scenario"]["landuse_file"] logging.info(f"Reading {self.scenario_dir / in_file}") self.simulated_maz_data_df = pd.read_csv(self.scenario_dir / in_file) From 52d5d0a7bcae0f53459388b4f8a1af641c6f755a Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Thu, 16 Oct 2025 19:55:41 -0700 Subject: [PATCH 02/10] delete redundant methods now covered by canonical --- tm2py_utils/summary/acceptance/simulated.py | 31 --------------------- 1 file changed, 31 deletions(-) diff --git a/tm2py_utils/summary/acceptance/simulated.py b/tm2py_utils/summary/acceptance/simulated.py index 2356080..5bfb50a 100644 --- a/tm2py_utils/summary/acceptance/simulated.py +++ b/tm2py_utils/summary/acceptance/simulated.py @@ -635,37 +635,6 @@ def _reduce_simulated_home_work_flows(self): return - def _make_simulated_maz_data(self): - in_file = self.scenario_dir / self.scenario_dict["scenario"]["maz_landuse_file"] - logging.info(f"Reading {in_file}") - df = pd.read_csv(in_file) - logging.debug(f"df:\n{df}") - - index_file = self.scenario_dir / "inputs/landuse/mtc_final_network_zone_seq.csv" - logging.info(f"Reading {index_file}") - index_df = pd.read_csv(index_file) - logging.debug(f"df:\n{df}") - join_df = index_df.rename(columns={"N": "MAZ_ORIGINAL"})[ - ["MAZ_ORIGINAL", "MAZSEQ"] - ].copy() - - self.simulated_maz_data_df = pd.merge( - df, - join_df, - how="left", - on="MAZ_ORIGINAL", - ) - - self._make_taz_district_crosswalk() - - return - - def _make_taz_district_crosswalk(self): - df = self.simulated_maz_data_df[["TAZ_ORIGINAL", "DistID"]].copy() - df = df.rename(columns={"TAZ_ORIGINAL": "taz", "DistID": "district"}) - self.taz_to_district_df = df.drop_duplicates().reset_index(drop=True) - - return def _reduce_simulated_rail_access_summaries(self): """Process rail station access mode summaries. From 0b8b7e93875249dc70c86561e90b441cd238e923 Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:02:04 -0700 Subject: [PATCH 03/10] fix minor bugs --- tm2py_utils/summary/acceptance/simulated.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tm2py_utils/summary/acceptance/simulated.py b/tm2py_utils/summary/acceptance/simulated.py index 5bfb50a..59c797d 100644 --- a/tm2py_utils/summary/acceptance/simulated.py +++ b/tm2py_utils/summary/acceptance/simulated.py @@ -388,7 +388,7 @@ def _reduce_simulated_transit_by_segment(self): temp = a_df["line_long"].str.split(pat="-", expand=True) a_df["LINE_ID"] = temp[0] a_df = a_df.rename(columns={"i_node": "INODE", "j_node": "JNODE"}) - a_df = a_df[~(a_df["JNODE"] == "None")].reset_index().copy() + a_df = a_df[a_df["JNODE"].notna() & (a_df["JNODE"] != "None")].reset_index().copy() a_df["JNODE"] = a_df["JNODE"].astype("float").astype("Int64") df = a_df[["LINE_ID", "line", "INODE", "JNODE", "board"]] @@ -696,7 +696,7 @@ def _reduce_simulated_rail_access_summaries(self): names_df = self._get_station_names_from_standard_network(rail_nodes_df) logging.debug(f"names_df:\n{names_df}") if "level_0" in names_df.columns: - names_df = names_df.drop(columns=["level_0", "index"]) + names_df = names_df.drop(columns=["level_0", "index"]).drop_duplicates() station_list = names_df.boarding.astype(str).unique().tolist() access_df = transit_df.copy() From f32f840806fd305bfde68fae89b74e19d4ae1c71 Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Fri, 17 Oct 2025 12:08:41 -0700 Subject: [PATCH 04/10] remove `maz_landuse_file` from config --- tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml b/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml index 5cf1981..fe89fdf 100644 --- a/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml +++ b/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml @@ -6,7 +6,6 @@ name = "2023-tm22-dev-version-05" year = 2023 verify = false - maz_landuse_file = "inputs/landuse/maz_data.csv" zone_seq_file = "inputs/landuse/mtc_final_network_zone_seq.csv" landuse_file = "inputs/landuse/maz_data_withDensity.csv" landuse_index_column = "TAZ" From 0e5cbfc1d50d2726776d912a641a7255496aa873 Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Thu, 23 Oct 2025 09:51:20 -0700 Subject: [PATCH 05/10] update landuse_file in docstrings --- tm2py_utils/summary/acceptance/canonical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tm2py_utils/summary/acceptance/canonical.py b/tm2py_utils/summary/acceptance/canonical.py index b95a887..1ea14d8 100644 --- a/tm2py_utils/summary/acceptance/canonical.py +++ b/tm2py_utils/summary/acceptance/canonical.py @@ -45,7 +45,7 @@ class Canonical: Set by: _read_standard_transit_to_survey_crosswalk() simulated_maz_data_df (pd.DataFrame): MAZ-level land use data with county and district IDs. Key columns: [MAZ_NODE, MAZ_SEQ, TAZ_NODE, TAZ_SEQ, DistID, CountyName] plus - land use variables from maz_landuse_file + land use variables from landuse_file Set by: _make_simulated_maz_data() taz_to_district_df (pd.DataFrame): TAZ to planning district mapping. Columns: [taz, district] From 6f959b1b75c28f805eb8e1d6113539616eb56c2a Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Mon, 10 Nov 2025 09:55:30 -0800 Subject: [PATCH 06/10] remove zone_seq_file parameter, remove drive_access_skims component --- .../2015-tm22-dev-sprint-04/scenario_config.toml | 16 ++++++++++------ .../scenario_config.toml | 2 -- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml b/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml index 7ac44a2..814c91e 100644 --- a/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml +++ b/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml @@ -3,11 +3,9 @@ #################################### [scenario] - name = "tm22-dev-sprint-03" + name = "tm22-dev-sprint-04" year = 2015 verify = false - maz_landuse_file = "inputs/landuse/maz_data.csv" - zone_seq_file = "inputs/landuse/mtc_final_network_zone_seq.csv" landuse_file = "inputs/landuse/maz_data_withDensity.csv" landuse_index_column = "TAZ" @@ -34,11 +32,17 @@ "transit_assign", "transit_skim", ] - final_components = [] + final_components = [ + "post_processor", + "network_summary" + ] start_iteration = 0 end_iteration = 3 [warmstart] warmstart = true - use_warmstart_skim = false - use_warmstart_demand = true \ No newline at end of file + use_warmstart_skim = fale + use_warmstart_demand = true + +[slack_notifications] +enabled = true \ No newline at end of file diff --git a/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml b/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml index fe89fdf..c2346cc 100644 --- a/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml +++ b/tm2py_utils/config/2023-tm22-dev-version-05/scenario_config.toml @@ -6,7 +6,6 @@ name = "2023-tm22-dev-version-05" year = 2023 verify = false - zone_seq_file = "inputs/landuse/mtc_final_network_zone_seq.csv" landuse_file = "inputs/landuse/maz_data_withDensity.csv" landuse_index_column = "TAZ" @@ -29,7 +28,6 @@ "truck", "highway_maz_assign", "highway", - #"drive_access_skims", "transit_assign", "transit_skim", ] From 77a25217c5ab53ab1866ae35cf2f1e6d9e5b9b82 Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Mon, 10 Nov 2025 10:00:14 -0800 Subject: [PATCH 07/10] fix a type --- .../config/2015-tm22-dev-sprint-04/scenario_config.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml b/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml index 814c91e..067b8a5 100644 --- a/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml +++ b/tm2py_utils/config/2015-tm22-dev-sprint-04/scenario_config.toml @@ -28,7 +28,6 @@ "truck", "highway_maz_assign", "highway", - #"drive_access_skims", "transit_assign", "transit_skim", ] @@ -41,7 +40,7 @@ [warmstart] warmstart = true - use_warmstart_skim = fale + use_warmstart_skim = false use_warmstart_demand = true [slack_notifications] From 452deb6040fff96895456eb8ece0e8885daca2d4 Mon Sep 17 00:00:00 2001 From: Yue Shuai <48269801+yueshuaing@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:14:22 -0800 Subject: [PATCH 08/10] add crosswalk file to model_config --- tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml index 01fa6b7..5b8ccbe 100644 --- a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml +++ b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml @@ -517,6 +517,9 @@ area_type_buffer_dist_miles = 0.5 # nodes at interchanges, for highway reliability calculation interchange_nodes_file = "inputs/hwy/interchange_nodes.csv" + # model ID to Emme node ID crosswalk written out in network build process + model_to_emme_node_id_xwalk = "emme_project/Database_highway/emme_drive_network_node_id_crosswalk.csv" + output_node_sequential_id_xwalk = "inputs/hwy/mtc_final_network_zone_seq.csv" # reliability reliability = true apply_msa_demand = true From a091d0bcb2239ba33e03020e397b72ce11047310 Mon Sep 17 00:00:00 2001 From: Lachlan Perrier Date: Mon, 17 Nov 2025 15:27:52 -0500 Subject: [PATCH 09/10] updates for pr 215 in tm2py --- .../2015-tm22-dev-sprint-04/model_config.toml | 52 ++++++------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml index 5b8ccbe..0d1cc3c 100644 --- a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml +++ b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml @@ -60,35 +60,15 @@ "single_tnc"=0.72 "shared_tnc"=0.20 [household.taxi_split] - "da"= 0.00 - "sr2"= 0.53 - "sr3"= 0.47 + "sr2_hov"= 0.53 + "sr3_hov"= 0.47 [household.single_tnc_split] - "da"= 0.00 - "sr2"= 0.53 - "sr3"= 0.47 + "sr2_hov"= 0.53 + "sr3_hov"= 0.47 [household.shared_tnc_split] - "da"= 0.00 - "sr2"= 0.18 - "sr3"= 0.82 - [household.ctramp_mode_names] - 1 = 'sov_gp' - 2 = 'sov_pay' - 3 = 'sr2_gp' - 4 = 'sr2_hov' - 5 = 'sr2_pay' - 6 = 'sr3_gp' - 7 = 'sr3_hov' - 8 = 'sr3_pay' - 9 = 'walk' - 10 = 'bike' - 11 = 'wlk' - 12 = 'pnr' - 13 = 'knr' - 14 = 'knr' - 15 = 'taxi' - 16 = 'tnc' - 17 = 'schlbus' + "sr2_hov"= 0.18 + "sr3_hov"= 0.82 + [household.income_segment] enabled = false segment_suffixes = ["LowInc", "MedInc", "HighInc", "XHighInc"] @@ -523,6 +503,8 @@ # reliability reliability = true apply_msa_demand = true + # threshold (miles) where a drive trip is short enough to be moved to a taz + maz_drive_distance_threshold = 0.5 [highway.tolls] file_path = "inputs/hwy/tolls.csv" src_vehicle_group_names = ["da", "s2", "s3", "vsm", "sml", "med", "lrg"] @@ -545,16 +527,16 @@ # based on ~= 5 miles @ 40 mph = 11 # = time + (0.6 / vot) * (dist * opcost) # = 5 / 40 * 60 + (0.6 / 17.23) * (5 * 18.93) - demand_file = "demand_matrices/highway/maz_demand/auto_{period}_MAZ_AUTO_{number}_{period}_{iter}.omx" + demand_file = "demand_matrices/highway/maz_demand/MAZ_AUTO_{period}_{iter}.csv" [[highway.maz_to_maz.demand_county_groups]] number = 1 - counties = ["San Francisco", "San Mateo", "Santa Clara"] - [[highway.maz_to_maz.demand_county_groups]] - number = 2 - counties = ["Alameda", "Contra Costa"] - [[highway.maz_to_maz.demand_county_groups]] - number = 3 - counties = ["Solano", "Napa", "Sonoma", "Marin"] + counties = ["San Francisco", "San Mateo", "Santa Clara", "Alameda", "Contra Costa", "Solano", "Napa", "Sonoma", "Marin"] + # [[highway.maz_to_maz.demand_county_groups]] + # number = 2 + # counties = ["Alameda", "Contra Costa"] + # [[highway.maz_to_maz.demand_county_groups]] + # number = 3 + # counties = ["Solano", "Napa", "Sonoma", "Marin"] [[highway.relative_gaps]] global_iteration = 0 From bed25e4a087377822c7ffd66a94193f92107a2dd Mon Sep 17 00:00:00 2001 From: lachlan-git <104235894+lachlan-git@users.noreply.github.com> Date: Tue, 18 Nov 2025 15:42:39 -0500 Subject: [PATCH 10/10] clarified comment on maz_drive_distance_threshold in model config --- tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml index 0d1cc3c..eedb1f1 100644 --- a/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml +++ b/tm2py_utils/config/2015-tm22-dev-sprint-04/model_config.toml @@ -503,7 +503,7 @@ # reliability reliability = true apply_msa_demand = true - # threshold (miles) where a drive trip is short enough to be moved to a taz + # threshold (miles) for maz assignment; when an auto trip distance is below the threshold, it will be assigned at the MAZ level instead of the TAZ level maz_drive_distance_threshold = 0.5 [highway.tolls] file_path = "inputs/hwy/tolls.csv" @@ -1333,4 +1333,4 @@ headway_fraction = 0.1 transfer_wait_perception_factor = 3.5 -# transit vehicle type data are associated with each transit line in Lasso, when writing out to emmebank \ No newline at end of file +# transit vehicle type data are associated with each transit line in Lasso, when writing out to emmebank