diff --git a/notebooks/Ohio MUG Demonstration.ipynb b/notebooks/Ohio MUG Demonstration.ipynb index 3f4f5dc..ca07fb2 100644 --- a/notebooks/Ohio MUG Demonstration.ipynb +++ b/notebooks/Ohio MUG Demonstration.ipynb @@ -16,7 +16,6 @@ "import os\n", "import sys\n", "import yaml\n", - "\n", "import pandas as pd\n", "\n", "from network_wrangler import RoadwayNetwork\n", @@ -32,32 +31,22 @@ "from lasso import metcouncil" ] }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "%load_ext autoreload\n", - "%autoreload 2" - ] - }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Set up the Logger & Parameters" + "### Set up the Logger" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import logging\n", "logger = logging.getLogger(\"WranglerLogger\")\n", - "logger.setLevel(logging.INFO)" + "logger.setLevel(logging.WARNING)" ] }, { @@ -73,9 +62,9 @@ "metadata": {}, "outputs": [], "source": [ - "input_dir = os.path.join(\"Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\", \"examples\", \"stpaul\")\n", - "lasso_dir = os.path.join(\"Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\")\n", - "output_dir = input_dir\n", + "lasso_dir = os.path.join(\"C:/\", \"Users\", \"david.ory\", \"documents\", \"GitHub\", \"Lasso\")\n", + "input_dir = os.path.join(lasso_dir, \"examples\", \"stpaul\")\n", + "output_dir = os.path.join(input_dir, \"ohio_mug\")\n", "\n", "stpaul_shape_file = os.path.join(input_dir, \"shape.geojson\")\n", "stpaul_link_file = os.path.join(input_dir, \"link.json\")\n", @@ -86,15 +75,7 @@ "cell_type": "code", "execution_count": 5, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:53:42, INFO: Lasso base directory set as: Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\n" - ] - } - ], + "outputs": [], "source": [ "parameters = Parameters(lasso_base_dir = lasso_dir)" ] @@ -110,43 +91,29 @@ "cell_type": "code", "execution_count": 6, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:53:42, INFO: Reading from following files:\n", - "-Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\link.json\n", - "-Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\node.geojson\n", - "-Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\shape.geojson.\n", - "2021-03-16 13:53:53, INFO: Read 66253 links from Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\link.json\n", - "2021-03-16 13:53:53, INFO: Read 17159 nodes from Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\node.geojson\n", - "2021-03-16 13:53:53, INFO: Read 66253 shapes from Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\shape.geojson\n", - "2021-03-16 13:54:05, INFO: Read in transit feed from: Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\n", - "2021-03-16 13:54:05, INFO: Removing calendar.txt from transit network config because file not found\n", - "2021-03-16 13:54:05, INFO: Removing calendar_dates.txt from transit network config because file not found\n", - "2021-03-16 13:54:05, INFO: Removing fare_attributes.txt from transit network config because file not found\n", - "2021-03-16 13:54:05, INFO: Removing fare_rules.txt from transit network config because file not found\n", - "2021-03-16 13:54:05, INFO: Removing transfers.txt from transit network config because file not found\n", - "2021-03-16 13:54:05, INFO: Removing feed_info.txt from transit network config because file not found\n" - ] - } - ], + "outputs": [], "source": [ "roadway_net = RoadwayNetwork.read(\n", " link_file = stpaul_link_file, \n", " node_file = stpaul_node_file, \n", " shape_file = stpaul_shape_file, \n", " fast = True \n", - ")\n", - "\n", - "transit_net = TransitNetwork.read(feed_path = input_dir)" + ")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, + "outputs": [], + "source": [ + "transit_net = TransitNetwork.read(feed_path = os.path.join(input_dir, \"transit\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, "outputs": [ { "data": { @@ -160,7 +127,7 @@ " dtype='object')" ] }, - "execution_count": 7, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -173,23 +140,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Make a Scenario \n", - "We manipulate scenarios" + "### Make a Scenario " ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:54:05, INFO: Creating Scenario\n" - ] - } - ], + "outputs": [], "source": [ "base_scenario = Scenario.create_scenario(base_scenario = {\"road_net\": roadway_net, \"transit_net\": transit_net})" ] @@ -203,53 +161,26 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:54:07, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:07, INFO: Calculating Centroid Connector and adding as roadway network variable: centroidconnect\n", - "2021-03-16 13:54:07, INFO: Finished calculating centroid connector variable: centroidconnect\n", - "2021-03-16 13:54:07, INFO: Renaming roadway attributes to be consistent with what metcouncil's model is expecting\n", - "2021-03-16 13:54:07, INFO: Didn't detect managed lanes in network.\n", - "2021-03-16 13:54:07, INFO: Creating calculated roadway variables.\n", - "2021-03-16 13:54:07, INFO: Calculating Area Type from Spatial Data and adding as roadway network variable: area_type\n" - ] - }, { "name": "stderr", "output_type": "stream", "text": [ - "C:\\Users\\wangs1\\.conda\\envs\\lasso\\lib\\site-packages\\geopandas\\tools\\sjoin.py:56: UserWarning: CRS of frames being joined does not match!(4326 != {'init': 'epsg:4326', 'no_defs': True})\n", - " '(%s != %s)' % (left_df.crs, right_df.crs))\n" + "c:\\users\\david.ory\\documents\\github\\lasso\\lasso\\roadway.py:423: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", + "\n", + " centroids_gdf[\"geometry\"] = centroids_gdf[\"geometry\"].centroid\n", + "c:\\users\\david.ory\\documents\\github\\lasso\\lasso\\roadway.py:288: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", + "\n", + " centroids_gdf[\"geometry\"] = centroids_gdf[\"geometry\"].centroid\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2021-03-16 13:54:08, INFO: Finished Calculating Area Type from Spatial Data into variable: area_type\n", - "2021-03-16 13:54:08, INFO: Adding roadway network variable for county using a spatial join with: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\county\\cb_2017_us_county_5m.shp\n", - "2021-03-16 13:54:10, INFO: Finished Calculating county variable: county\n", - "2021-03-16 13:54:10, INFO: Calculating MPO as roadway network variable: mpo\n", - "2021-03-16 13:54:10, INFO: Finished calculating MPO variable: mpo\n", - "2021-03-16 13:54:10, INFO: Adding Counts\n", - "2021-03-16 13:54:10, INFO: Adding Variable AADT using Shared Streets Reference from z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\count_mn\\mn_count_ShSt_API_match.csv\n", - "2021-03-16 13:54:10, INFO: Added variable: AADT using Shared Streets Reference\n", - "2021-03-16 13:54:10, INFO: Adding Variable AADT using Shared Streets Reference from z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\Wisconsin_Lanes_Counts_Median\\wi_count_ShSt_API_match.csv\n", - "2021-03-16 13:54:10, INFO: Added variable: AADT using Shared Streets Reference\n", - "2021-03-16 13:54:10, INFO: Finished adding counts variable: AADT\n", - "2021-03-16 13:54:10, INFO: Finished creating ML lanes variable: ML_lanes\n", - "2021-03-16 13:54:10, INFO: Finished creating hov corridor variable: segment_id\n", - "2021-03-16 13:54:10, INFO: Finished creating managed variable: managed\n", - "2021-03-16 13:54:10, INFO: Overwriting existing distance Variable 'distance' already in network\n", - "2021-03-16 13:54:10, INFO: Calculating distance for all links\n", - "2021-03-16 13:54:10, INFO: Filling nan for network from network wrangler\n", - "2021-03-16 13:54:10, INFO: Splitting variables by time period and category\n", - "2021-03-16 13:54:10, WARNING: Specified variable to split: ML_lanes not in network variables: Index(['model_link_id', 'osm_link_id', 'shstReferenceId', 'shstGeometryId',\n", + "2021-03-16 12:21:48, WARNING: Specified variable to split: ML_lanes not in network variables: Index(['model_link_id', 'osm_link_id', 'shstReferenceId', 'shstGeometryId',\n", " 'shape_id', 'u', 'v', 'A', 'B', 'locationReferences', 'distance',\n", " 'roadway', 'name', 'ref', 'bridge', 'tunnel', 'width', 'max_speed',\n", " 'bike_facility', 'drive_access', 'walk_access', 'bike_access',\n", @@ -261,9 +192,7 @@ " 'trn_priority_NT', 'ttime_assert_AM', 'ttime_assert_MD',\n", " 'ttime_assert_PM', 'ttime_assert_NT', 'lanes_AM', 'lanes_MD',\n", " 'lanes_PM', 'lanes_NT'],\n", - " dtype='object'). Returning 0.\n", - "2021-03-16 13:54:11, INFO: Converting variable type to MetCouncil standard\n", - "2021-03-16 13:54:11, INFO: Setting Coordinate Reference System to EPSG 26915\n" + " dtype='object'). Returning 0.\n" ] } ], @@ -277,27 +206,27 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ - "# model_road_net.write_roadway_as_fixedwidth(\n", - "# output_link_txt = os.path.join(output_dir, \"links.txt\"),\n", - "# output_node_txt = os.path.join(output_dir, \"nodes.txt\"),\n", - "# output_link_header_width_txt = os.path.join(output_dir, \"links_header_width.txt\"),\n", - "# output_node_header_width_txt = os.path.join(output_dir, \"nodes_header_width.txt\"),\n", - "# output_cube_network_script = os.path.join(output_dir, \"make_complete_network_from_fixed_width_file.s\"),\n", - "#)" + "model_road_net.write_roadway_as_fixedwidth(\n", + " output_link_txt = os.path.join(output_dir, \"links.txt\"),\n", + " output_node_txt = os.path.join(output_dir, \"nodes.txt\"),\n", + " output_link_header_width_txt = os.path.join(output_dir, \"links_header_width.txt\"),\n", + " output_node_header_width_txt = os.path.join(output_dir, \"nodes_header_width.txt\"),\n", + " output_cube_network_script = os.path.join(output_dir, \"make_complete_network_from_fixed_width_file.s\"),\n", + ")" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ - "#standard_transit = StandardTransit.fromTransitNetwork(transit_net)\n", - "#standard_transit.write_as_cube_lin(outpath = os.path.join(output_dir, \"transit.lin\") )" + "standard_transit = StandardTransit.fromTransitNetwork(transit_net)\n", + "standard_transit.write_as_cube_lin(outpath = os.path.join(output_dir, \"transit.lin\") )" ] }, { @@ -309,60 +238,32 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "2021-03-16 13:54:12, INFO: No base transit network.\n", - "2021-03-16 13:54:12, INFO: No transit changes given or processed.\n", - "2021-03-16 13:54:12, INFO: Reading logfile: Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\cube\\st_paul_example.log\n", - "2021-03-16 13:54:12, INFO: Processed 0 Node lines and 1 Link lines\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:12, INFO: Evaluating compatibility between roadway network changes and base network. Not evaluating deletions.\n", - "2021-03-16 13:54:12, INFO: Evaluating project changes.\n", - "2021-03-16 13:54:12, WARNING: The following attributes are specified in the changes but do not exist in the base network: ['OPERATION_final']\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-16 13:54:12, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "z:\\data\\users\\sijia\\met_council\\github\\client_met_council_wrangler_utilities\\lasso\\project.py:613: RuntimeWarning: divide by zero encountered in double_scalars\n", - " / base_row[col].astype(float)\n" + "2021-03-16 12:24:04, WARNING: The following attributes are specified in the changes but do not exist in the base network: ['OPERATION_final']\n" ] } ], "source": [ "project = Project.create_project(\n", " base_roadway_network = model_road_net,\n", - " roadway_log_file = os.path.join(lasso_dir, \"examples\", \"stpaul\", \"cube\", \"st_paul_example.log\"),\n", + " roadway_log_file = os.path.join(output_dir, \"st_paul_example.log\"),\n", " project_name = \"Example\",\n", - " )" + ")" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:54:12, INFO: Wrote project card to: Z:/Data/Users/Sijia/Met_Council/github/client_met_council_wrangler_utilities\\examples\\stpaul\\ohio_mug\\Example.yml\n" - ] - } - ], + "outputs": [], "source": [ - "project.write_project_card(os.path.join(output_dir, \"ohio_mug\", \"Example.yml\"))" + "project.write_project_card(os.path.join(output_dir, \"cards\", \"Example.yml\"))" ] }, { @@ -374,93 +275,35 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [ - "#build_scenario = Scenario.create_scenario(base_scenario = {\"road_net\": roadway_net, \"transit_net\": transit_net},\n", - "# card_directory = os.path.join(lasso_dir, \"examples\", \"stpaul\", \"ohio_mug\"),\n", - "# #tags = ['checked'],\n", - "# validate_project_cards = False)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ - "#build_scenario.apply_all_projects()" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:54:13, INFO: Creating Scenario\n" - ] - } - ], - "source": [ - "build_scenario = Scenario.create_scenario(base_scenario = {\"road_net\": roadway_net, \"transit_net\": transit_net})" + "build_scenario = Scenario.create_scenario(base_scenario = {\"road_net\": roadway_net, \"transit_net\": transit_net},\n", + " card_directory = os.path.join(output_dir, \"cards\"),\n", + " validate_project_cards = False)" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-16 13:54:13, INFO: Applying Example\n", - "2021-03-16 13:54:13, INFO: Applying Example\n", - "2021-03-16 13:54:13, INFO: Applying Project to Roadway Network: Example\n" - ] - }, { "name": "stderr", "output_type": "stream", "text": [ - "z:\\data\\users\\sijia\\met_council\\github\\client_met_council_wrangler_utilities\\lasso\\src\\network-wrangler\\network_wrangler\\roadwaynetwork.py:870: SettingWithCopyWarning: \n", + "C:\\Users\\david.ory\\anaconda3\\envs\\lasso_x\\lib\\site-packages\\geopandas\\geodataframe.py:853: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", - "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", - " candidate_links[\"i\"] = 0\n" + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " super(GeoDataFrame, self).__setitem__(key, value)\n" ] } ], "source": [ - "build_scenario.apply_project(project.card_data)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['Example']" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "build_scenario.applied_projects" + "build_scenario.apply_all_projects()" ] }, { @@ -471,12 +314,7 @@ { "data": { "text/plain": [ - "{'project': 'Example',\n", - " 'changes': [{'category': 'Roadway Property Change',\n", - " 'facility': {'link': [{'model_link_id': [389369]}]},\n", - " 'properties': [{'existing': 0.0, 'set': 0.1251, 'property': 'distance'},\n", - " {'existing': 2, 'set': 3, 'property': 'lanes'}],\n", - " 'project': 'Example'}]}" + "['Example']" ] }, "execution_count": 17, @@ -485,28 +323,7 @@ } ], "source": [ - "project.card_data" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "7588 3\n", - "Name: lanes, dtype: int64" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "build_scenario.road_net.links_df[build_scenario.road_net.links_df.model_link_id == 389369].lanes" + "build_scenario.applied_projects" ] }, { @@ -518,51 +335,26 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 18, "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-15 18:21:47, INFO: Lasso base directory set as: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\n", - "2021-03-15 18:21:47, INFO: Renaming roadway attributes to be consistent with what metcouncil's model is expecting\n", - "2021-03-15 18:21:47, INFO: Didn't detect managed lanes in network.\n", - "2021-03-15 18:21:47, INFO: Creating calculated roadway variables.\n", - "2021-03-15 18:21:47, INFO: Calculating Area Type from Spatial Data and adding as roadway network variable: area_type\n" - ] - }, { "name": "stderr", "output_type": "stream", "text": [ - "C:\\Users\\wangs1\\.conda\\envs\\lasso\\lib\\site-packages\\geopandas\\tools\\sjoin.py:56: UserWarning: CRS of frames being joined does not match!(4326 != {'init': 'epsg:4326', 'no_defs': True})\n", - " '(%s != %s)' % (left_df.crs, right_df.crs))\n" + "c:\\users\\david.ory\\documents\\github\\lasso\\lasso\\roadway.py:423: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", + "\n", + " centroids_gdf[\"geometry\"] = centroids_gdf[\"geometry\"].centroid\n", + "c:\\users\\david.ory\\documents\\github\\lasso\\lasso\\roadway.py:288: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.\n", + "\n", + " centroids_gdf[\"geometry\"] = centroids_gdf[\"geometry\"].centroid\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ - "2021-03-15 18:21:56, INFO: Finished Calculating Area Type from Spatial Data into variable: area_type\n", - "2021-03-15 18:21:56, INFO: Adding roadway network variable for county using a spatial join with: z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\county\\cb_2017_us_county_5m.shp\n", - "2021-03-15 18:22:01, INFO: Finished Calculating county variable: county\n", - "2021-03-15 18:22:01, INFO: Calculating MPO as roadway network variable: mpo\n", - "2021-03-15 18:22:01, INFO: Finished calculating MPO variable: mpo\n", - "2021-03-15 18:22:01, INFO: Adding Counts\n", - "2021-03-15 18:22:01, INFO: Adding Variable AADT using Shared Streets Reference from z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\count_mn\\mn_count_ShSt_API_match.csv\n", - "2021-03-15 18:22:02, INFO: Added variable: AADT using Shared Streets Reference\n", - "2021-03-15 18:22:02, INFO: Adding Variable AADT using Shared Streets Reference from z:\\Data\\Users\\Sijia\\Met_Council\\github\\client_met_council_wrangler_utilities\\metcouncil_data\\Wisconsin_Lanes_Counts_Median\\wi_count_ShSt_API_match.csv\n", - "2021-03-15 18:22:02, INFO: Added variable: AADT using Shared Streets Reference\n", - "2021-03-15 18:22:02, INFO: Finished adding counts variable: AADT\n", - "2021-03-15 18:22:02, INFO: Finished creating ML lanes variable: ML_lanes\n", - "2021-03-15 18:22:02, INFO: Finished creating hov corridor variable: segment_id\n", - "2021-03-15 18:22:02, INFO: Finished creating managed variable: managed\n", - "2021-03-15 18:22:02, INFO: Overwriting existing distance Variable 'distance' already in network\n", - "2021-03-15 18:22:04, INFO: Calculating distance for all links\n", - "2021-03-15 18:22:04, INFO: Filling nan for network from network wrangler\n", - "2021-03-15 18:22:05, INFO: Splitting variables by time period and category\n", - "2021-03-15 18:22:06, WARNING: Specified variable to split: ML_lanes not in network variables: Index(['model_link_id', 'osm_link_id', 'shstReferenceId', 'shstGeometryId',\n", + "2021-03-16 12:26:13, WARNING: Specified variable to split: ML_lanes not in network variables: Index(['model_link_id', 'osm_link_id', 'shstReferenceId', 'shstGeometryId',\n", " 'shape_id', 'u', 'v', 'A', 'B', 'locationReferences', 'distance',\n", " 'roadway', 'name', 'ref', 'bridge', 'tunnel', 'width', 'max_speed',\n", " 'bike_facility', 'drive_access', 'walk_access', 'bike_access',\n", @@ -573,58 +365,22 @@ " 'trn_priority_MD', 'trn_priority_PM', 'trn_priority_NT',\n", " 'ttime_assert_AM', 'ttime_assert_MD', 'ttime_assert_PM',\n", " 'ttime_assert_NT', 'lanes_AM', 'lanes_MD', 'lanes_PM', 'lanes_NT'],\n", - " dtype='object'). Returning 0.\n", - "2021-03-15 18:22:07, INFO: Converting variable type to MetCouncil standard\n", - "2021-03-15 18:22:07, INFO: Setting Coordinate Reference System to EPSG 26915\n" + " dtype='object'). Returning 0.\n" ] } ], "source": [ - "model_road_net = ModelRoadwayNetwork.from_RoadwayNetwork(build_scenario.road_net)\n", - "model_road_net.roadway_standard_to_met_council_network()" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "7588 3\n", - "Name: lanes_AM, dtype: int32" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "model_road_net.links_metcouncil_df[model_road_net.links_metcouncil_df.model_link_id == 389369][\"lanes_AM\"]" + "build_model_road_net = ModelRoadwayNetwork.from_RoadwayNetwork(build_scenario.road_net)\n", + "build_model_road_net.roadway_standard_to_met_council_network()" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 19, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "2021-03-15 18:22:56, INFO: Starting fixed width conversion\n", - "2021-03-15 18:24:25, INFO: Writing out link database\n", - "2021-03-15 18:24:28, INFO: Writing out link header and width ----\n", - "2021-03-15 18:24:28, INFO: Starting fixed width conversion\n", - "2021-03-15 18:24:31, INFO: Writing out node database\n", - "2021-03-15 18:24:31, INFO: Writing out node header and width\n" - ] - } - ], + "outputs": [], "source": [ - "model_road_net.write_roadway_as_fixedwidth(\n", + "build_model_road_net.write_roadway_as_fixedwidth(\n", " output_link_txt = os.path.join(output_dir, \"links.txt\"),\n", " output_node_txt = os.path.join(output_dir, \"nodes.txt\"),\n", " output_link_header_width_txt = os.path.join(output_dir, \"links_header_width.txt\"),\n", @@ -632,13 +388,20 @@ " output_cube_network_script = os.path.join(output_dir, \"make_complete_network_from_fixed_width_file.s\"),\n", ")" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "lasso", + "display_name": "Python 3", "language": "python", - "name": "lasso" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -650,7 +413,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.7.7" } }, "nbformat": 4,