Skip to content

Commit

Permalink
small renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
e-lo committed Apr 18, 2024
1 parent a208654 commit 02a3cea
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions network_wrangler/roadway/model_roadway.py
Expand Up @@ -10,7 +10,7 @@
linestring_from_nodes,
length_of_linestring_miles,
)
from network_wrangler.roadway.links import _links_data_to_links_df
from network_wrangler.roadway.links import data_to_links_df
from .utils import compare_networks, compare_links, create_unique_shape_id

"""
Expand Down Expand Up @@ -418,7 +418,7 @@ def _create_dummy_connector_links(
"ref",
]
_keep_ae_cols = [c for c in _keep_ae_cols if c in access_egress_df.columns]
access_egress_df = _links_data_to_links_df(
access_egress_df = data_to_links_df(
access_egress_df[_keep_ae_cols],
links_params=net.links_df.params,
nodes_df=m_nodes_df,
Expand Down
8 changes: 4 additions & 4 deletions network_wrangler/roadway/projects/add.py
Expand Up @@ -2,8 +2,8 @@

import geopandas as gpd

from ..nodes import _nodes_data_to_nodes_df
from ..links import _links_data_to_links_df
from ..nodes import data_to_nodes_df
from ..links import data_to_links_df
from ...logger import WranglerLogger


Expand Down Expand Up @@ -36,13 +36,13 @@ def apply_new_roadway(
f"Adding New Roadway Features:\n-Links:\n{add_links}\n-Nodes:\n{add_nodes}"
)
if add_nodes:
_new_nodes_df = _nodes_data_to_nodes_df(
_new_nodes_df = data_to_nodes_df(
add_nodes, nodes_params=roadway_net.nodes_df.params
)
roadway_net.add_nodes(_new_nodes_df)

if add_links:
_new_links_df = _links_data_to_links_df(
_new_links_df = data_to_links_df(
add_links,
links_params=roadway_net.links_df.params,
nodes_df=roadway_net.nodes_df,
Expand Down
2 changes: 1 addition & 1 deletion network_wrangler/roadway/selection.py
Expand Up @@ -382,7 +382,7 @@ def selected_nodes_df(self) -> pd.DataFrame:

self._selected_nodes_df = _selected_nodes_df

WranglerLogger.info(f"Final selected nodess: {len(_selected_nodes_df)}")
WranglerLogger.info(f"Final selected nodes: {len(_selected_nodes_df)}")
if len(_selected_nodes_df) < 10:
_cols = _selected_nodes_df.__dict__["params"].display_cols
WranglerLogger.debug(f"\n{_selected_nodes_df[_cols]}")
Expand Down
1 change: 1 addition & 0 deletions requirements.tests.txt
Expand Up @@ -4,3 +4,4 @@ coverage
flake8
pytest
pytest-benchmark
pytest-cov
8 changes: 8 additions & 0 deletions tests/test_roadway/test_io.py
Expand Up @@ -81,6 +81,14 @@ def test_convert(example_dir, test_dir):
), "The parquet and geojson networks differ."


def test_roadway_model_coerce(small_net):
assert isinstance(small_net, RoadwayNetwork)
WranglerLogger.debug(f"small_net.nodes_df.cols:\n{small_net.nodes_df.columns}")
assert "osm_node_id" in small_net.nodes_df.columns
WranglerLogger.debug(f"small_net.links_df.cols:\n{small_net.links_df.columns}")
assert "osm_link_id" in small_net.links_df.columns


@pytest.mark.parametrize("write_format", ["parquet", "geojson"])
@pytest.mark.parametrize("ex", ["stpaul", "small"])
def test_roadway_write(stpaul_net, small_net, test_out_dir, write_format, ex):
Expand Down

0 comments on commit 02a3cea

Please sign in to comment.