From 1782bbcb4f8d6f97b1d7d769f00fc97676d3ec73 Mon Sep 17 00:00:00 2001 From: Jawad Mahmud Hoque <35570340+jawadmhoque@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:09:30 -0400 Subject: [PATCH] Update 01-BCM_ApplyTransitProjectCards.ipynb Changed how the project cards are applied. Instead of creating new scenario and applying all project cards at the same time, this version applies the highway project cards one after another from the list of project cards. --- scripts/01-BCM_ApplyTransitProjectCards.ipynb | 172 ++++++++++++++++-- 1 file changed, 156 insertions(+), 16 deletions(-) diff --git a/scripts/01-BCM_ApplyTransitProjectCards.ipynb b/scripts/01-BCM_ApplyTransitProjectCards.ipynb index de1d6a5..99c847f 100644 --- a/scripts/01-BCM_ApplyTransitProjectCards.ipynb +++ b/scripts/01-BCM_ApplyTransitProjectCards.ipynb @@ -79,7 +79,7 @@ "metadata": {}, "outputs": [], "source": [ - "pickle_file_name = os.path.join(pickle_dir, \"scenario_pre_2020.pickle\")\n", + "pickle_file_name = os.path.join(pickle_dir, \"scenario_2015.pickle\")\n", "curr_scenario = pickle.load(open(pickle_file_name, 'rb'))" ] }, @@ -96,14 +96,156 @@ "metadata": {}, "outputs": [], "source": [ - "step1_version_04_scenario = Scenario.create_scenario(\n", - " base_scenario = curr_scenario,\n", - " card_directory = highway_project_card_dir,\n", - " project_cards_list=[], \n", - " validate_project_cards=False\n", - ")\n", + "curr_scenario.road_net.links_df['name']=curr_scenario.road_net.links_df['name'].apply(lambda x: \"\" if type(x)==int else x)\n", + "curr_scenario.road_net.links_df['name']=curr_scenario.road_net.links_df['name'].apply(lambda x: util.shorten_name(x))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "project_card_list = []\n", + "\n", + "scenario_2015_cards = [ \n", + " 'Added_networkforexternals_Sacto2_GN_11142022.yml',\n", + " 'assignable_and_ace_transit_connectors.yml',\n", + " 'CCTA.yml',\n", + " 'Externals_SJQ_Add_complete_network_10032022.yml',\n", + " 'Sonoma_Marin_Area_Rail_Transit_add_rail_link.yml',\n", + " 'Year 2015 Modify Express Lanes and USE on I-580 EB (segment 02) Hacienda Drive to Airway Blvd_v2.yml',\n", + " 'Year 2015 Modify HOV Lanes and USE on CA-237 EB US 101 to North 1st Street_v2.yml',\n", + " 'Year 2015 Modify HOV Lanes and USE on CA-237 WB North 1st Street to US 101_v2.yml',\n", + " 'Year 2015 Modify HOV Lanes and USE on I-680 NB from Alcosta Blvd to Livorna Road_v2.yml',\n", + " 'Year 2015 Modify HOV Lanes and USE on I-680 SB from Benicia Bridge to Alcosta Blvd_v2.yml',\n", + " 'year_2015_managed_lane_i680n_ca_242_to_benicia_bridge.yml'\n", + " ]\n", + "\n", + "for card in scenario_2015_cards:\n", + " _filename = os.path.join(card_dir, '2020',card)\n", + " card = ProjectCard.read(_filename, validate = False)\n", + " project_card_list.append(card)\n", + "\n", + "scenario_2035_cards = [\n", + " ### Projects in San Joaqun\n", + " 'san_joaquin_05_sj07_1006.yml',\n", + " 'san_joaquin_06_sj07_1005.yml',\n", + " 'san_joaquin_07_sj11_1001.yml',\n", + " 'san_joaquin_08_sj18_1001.yml',\n", + " 'san_joaquin_09_sj07_1014.yml',\n", + " 'san_joaquin_01_sj14_1001.yml',\n", + " 'san_joaquin_02_sj14_1002.yml',\n", + " 'san_joaquin_03_sj07_1003.yml',\n", + " 'san_joaquin_04_sj07_1008.yml',\n", + " ### Projects modifying highway related to transit improvements (BRT lines, Station/Stop Updates etc.)\n", + " '0_01_CongestionPricingDowntownSF_21-T10-091.yml',\n", + " # 'Sonoma_Marin_Area_Rail_Transit_add_rail_link.yml', #If you are starting from 2015 pickle file, comment this card out since it is already added on the 2015 network.\n", + " '0_02_CongestionPricingTreasureIsland_21-T10-092.yml',\n", + " '0_06_SR-237 Corridor Improvement 21-T06-043.wrangler',\n", + " '0_08_I-680 Corridor Improvement 21-T06-022.wrangler',\n", + " '0_10_1_21-T06-027-FBP_SM_027_US101_92.yml',\n", + " '0_10_2_21-T06-027-FBP_SM_033_US101_Holly_Interchange_add.yml',\n", + " '0_10_3_21-T06-027-FBP_SM_033_US101_Holly_Interchange_mod.yml',\n", + " '0_10_4_21-T06-027-FBP_SM_035_Peninsula_101_OnOffRamps.yml',\n", + " '0_10_5_21-T06-027-STIP_ProduceAve.yml',\n", + " '0_11_1_21-T06-028-FBP_SC_072_US101_Trimble_Interchange.yml',\n", + " '0_11_2_21-T06-028-FBP_SC_073_BlossomHill_101Wide.yml',\n", + " '0_11_5_21-T06-028-FBP_SC_081_US101_SR237.wrangler',\n", + " '0_11_7_21-T06-028-FBP_SC_083_US101_Zanker_Skyport_Interchange.yml',\n", + " '0_12_21-T06-015-MAJ_SOL070020_I80_I680_SR12_Int_2B_7_mod.yml',\n", + " '10_21-T11-114_Transform_Valley_Link_add_rail_link.yml',\n", + " '2_1_14_MAJ_MTC050027_Berkeley_Ferry_add_ferry_link.yml',\n", + " '2_4_15_21-T11-97-MAJ_MissionBay_SF_Ferry_add_ferry_link.yml',\n", + " '2_5_16_21_T11-98-MAJ_RedwoodCity_SF_Ferry_add_ferry_link.yml',\n", + " '3_21-T10-083-Central_Subway_ToChinaTown_add_rail_link.yml',\n", + " '5_1_Rex_Blue_add_highway_link.yml',\n", + " 'BART_2020_Fremont_to_Berryessa_add_rail_link.yml',\n", + " 'BART_2036_Berryessa_to_Santa_Clara_add_rail_link.yml',\n", + " 'Caltrain_Peninsula_Corridor_Electrification_Expansion_add_rail_link.yml',\n", + " 'extra_brt_14th_st_mission_blvd_brt1.yml',\n", + " 'extra_brt_albany_to_oakland_brt2.yml',\n", + " 'extra_brt_broadway_brt1.yml',\n", + " 'extra_brt_grand_ave_brt1.yml',\n", + " 'extra_brt_lower_dimond_to_alameda_brt2.yml',\n", + " 'extra_brt_marin_ave_brt2.yml',\n", + " 'extra_brt_merritt_to_ashland_brt2.yml',\n", + " 'extra_brt_mission_grain_to_grimmer_brt2.yml',\n", + " 'extra_brt_oakland_brt2.yml',\n", + " 'extra_brt_ralph_appezzato_memorial_pwky_brt1.yml',\n", + " 'extra_brt_thomas_berkley_way_grand_ave_brt1.yml',\n", + " 'year_2020_better_market_st_eb.yml',\n", + " 'year_2020_better_market_st_wb.yml',\n", + " 'year_2020_broadway_brt.yml',\n", + " 'year_2030_i_80_wb_bus_only_hov_extension.yml',\n", + " 'year_2020_richmond_san_rafael_bridge_access_improvement.yml',\n", + " 'year_2020_tempo_brt.yml',\n", + " 'year_2021_geary_brt_phase1_eb.yml',\n", + " 'year_2021_geary_brt_phase1_wb.yml',\n", + " 'year_2021_sr4_wb_added_gp_lane_sr242_to_i680.yml',\n", + " 'year_2022_van_ness_brt_nb.yml',\n", + " 'year_2022_van_ness_brt_sb.yml',\n", + " ### Adding new express lanes\n", + " 'year_2023_us101_el_whipple_to_i380.yml',\n", + " 'year_2024_san_pablo_ave_rapid_corridors_project.yml',\n", + " 'year_2025_bay_bridge_forward_i580wb_hov_extension.yml',\n", + " 'year_2025_i680_sr237_to_sr_84_hov_lanes_new_construction.yml',\n", + " 'year_2025_i80_solano_managed_lanes.yml',\n", + " 'year_2025_sr84_widening_rubyhill_to_i680.yml',\n", + " 'year_2025_us101_marin_sonoma_narrows.yml',\n", + " 'year_2028_geary_brt_phase2_eb.yml',\n", + " 'year_2028_geary_brt_phase2_wb.yml',\n", + " 'year_2029_san_pablo_ave_bus_bike_project.yml',\n", + " 'year_2030_23rd_st_brt.yml',\n", + " 'year_2030_broadway_streetscape_improvement_project.yml',\n", + " 'year_2030_i280_us101_nb_hov.yml',\n", + " 'year_2030_i280_us101_sb_hov.yml',\n", + " 'year_2030_i580_wb_rsr_forward.yml',\n", + " 'year_2030_i680_express_lanes_new_roadway_nb_sb.yml',\n", + " 'year_2030_i680_nb_express_lane_completion_2.yml',\n", + " 'year_2030_i680_nb_pttl.yml',\n", + " 'year_2030_i680_sb_pttl.yml',\n", + " 'year_2030_sr37_sears_point_to_mareisland_hov.yml',\n", + " 'year_2030_sr4_wb_el_sr242_to_i680.yml',\n", + " 'year_2030_us101_ml_north_of_i380_to_sf_sm_countyline.yml',\n", + " 'year_2033_i680_el_calaveras_to_us101.yml',\n", + " 'year_2035_bike_walk_access_on_bridges.yml'\n", + " ]\n", + "\n", + "for card in scenario_2035_cards:\n", + " _filename = os.path.join(card_dir, '2035','1-2',card)\n", + " card = ProjectCard.read(_filename, validate = False)\n", + " project_card_list.append(card)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "for item in project_card_list:\n", + " curr_scenario.apply_project(item)\n", + " \n", + "# step1_version_04_scenario = Scenario.create_scenario(\n", + "# base_scenario = curr_scenario,\n", + "# card_directory = highway_project_card_dir,\n", + "# project_cards_list=[], \n", + "# validate_project_cards=False\n", + "# )\n", "\n", - "step1_version_04_scenario.apply_all_projects()" + "# step1_version_04_scenario.apply_all_projects()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "curr_scenario.road_net.links_df = gpd.GeoDataFrame(curr_scenario.road_net.links_df, geometry=curr_scenario.road_net.links_df.geometry)\n", + "curr_scenario.road_net.nodes_df = gpd.GeoDataFrame(curr_scenario.road_net.nodes_df, geometry=curr_scenario.road_net.nodes_df.geometry)\n", + "# curr_scenario.transit_net.set_roadnet(curr_scenario.road_net, validate_consistency=False)" ] }, { @@ -112,9 +254,7 @@ "metadata": {}, "outputs": [], "source": [ - "step1_version_04_scenario.road_net.links_df = gpd.GeoDataFrame(step1_version_04_scenario.road_net.links_df, geometry=step1_version_04_scenario.road_net.links_df.geometry)\n", - "step1_version_04_scenario.road_net.nodes_df = gpd.GeoDataFrame(step1_version_04_scenario.road_net.nodes_df, geometry=step1_version_04_scenario.road_net.nodes_df.geometry)\n", - "step1_version_04_scenario.transit_net.set_roadnet(step1_version_04_scenario.road_net, validate_consistency=False)" + "curr_scenario.transit_net.road_net.links_df.head()" ] }, { @@ -131,7 +271,7 @@ "outputs": [], "source": [ "step2_version_04_scenario = Scenario.create_scenario(\n", - " base_scenario = step1_version_04_scenario,\n", + " base_scenario = curr_scenario,\n", " card_directory = transit_project_card_dir,\n", " project_cards_list=[],\n", " validate_project_cards=False\n", @@ -146,7 +286,7 @@ "outputs": [], "source": [ "# in case any transit shapes are broken because of the roadway network changes\n", - "step2_version_04_scenario.update_transit_net_with_new_road_net()" + "# step2_version_04_scenario.update_transit_net_with_new_road_net()" ] }, { @@ -170,7 +310,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.9.7 ('base')", + "display_name": "Python 3.7.12 ('bcm_network')", "language": "python", "name": "python3" }, @@ -184,11 +324,11 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.7.12" }, "vscode": { "interpreter": { - "hash": "ad2bdc8ecc057115af97d19610ffacc2b4e99fae6737bb82f5d7fb13d2f2c186" + "hash": "89f6b56da614f13c067a2c1fb1c7958fb30c34c880401865a109116841689d35" } } },