Skip to content

Commit

Permalink
quick fix for metcouncil pre-release
Browse files Browse the repository at this point in the history
need to revisit it later to fix them properly
  • Loading branch information
yueshuaing committed Sep 30, 2024
1 parent fed524b commit aec6669
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions network_wrangler/configs/wrangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ class IdGenerationConfig(ConfigItem):
TRANSIT_SHAPE_ID_SCALAR: int = 1000000
ROAD_SHAPE_ID_METHOD: Literal["scalar"] = "scalar"
ROAD_SHAPE_ID_SCALAR: int = 1000
ML_LINK_ID_METHOD: Literal["range", "scalar"] = "range"
ML_LINK_ID_METHOD: Literal["range", "scalar"] = "scalar"
ML_LINK_ID_RANGE: tuple[int, int] = (950000, 999999)
ML_LINK_ID_SCALAR: int = 15000
ML_LINK_ID_SCALAR: int = 2000000
ML_NODE_ID_METHOD: Literal["range", "scalar"] = "range"
ML_NODE_ID_RANGE: tuple[int, int] = (950000, 999999)
ML_NODE_ID_SCALAR: int = 15000
Expand Down
26 changes: 13 additions & 13 deletions network_wrangler/roadway/links/df_accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ class LinkOfTypeAccessor:
def __init__(self, links_df: DataFrame[RoadLinksTable]):
"""LinkOfTypeAccessor for RoadLinksTable."""
self._links_df = links_df
try:
links_df.attrs["name"] == "road_links"
except AttributeError:
WranglerLogger.warning(
"`of_type` should only be used on 'road_links' dataframes. \
No attr['name'] not found."
)
except AssertionError:
WranglerLogger.warning(
f"`of_type` should only be used on 'road_links' dataframes. \
Found type: {links_df.attr['name']}"
)
raise NotLinksError("`of_type` is only available to network_links dataframes.")
# try:
# links_df.attrs["name"] == "road_links"
# except AttributeError:
# WranglerLogger.warning(
# "`of_type` should only be used on 'road_links' dataframes. \
# No attr['name'] not found."
# )
# except AssertionError:
# WranglerLogger.warning(
# f"`of_type` should only be used on 'road_links' dataframes. \
# Found type: {links_df.attr['name']}"
# )
# raise NotLinksError("`of_type` is only available to network_links dataframes.")

@property
def managed(self):
Expand Down
2 changes: 1 addition & 1 deletion network_wrangler/roadway/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def _perform_selection(self):
WranglerLogger.info(f"Final selected links: {len(_selected_links_df)}")
if len(_selected_links_df) < 10:
WranglerLogger.debug(
f"\n{_selected_links_df[_selected_links_df.attrs['display_cols']]}"
f"\n{_selected_links_df}"
)

return _selected_links_df
Expand Down
2 changes: 1 addition & 1 deletion network_wrangler/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def extract_base_scenario_metadata(base_scenario: dict) -> dict:
_skip_copy = ["road_net", "transit_net", "config"]
out_dict = {k: v for k, v in base_scenario.items() if k not in _skip_copy}
if isinstance(base_scenario.get("road_net"), RoadwayNetwork):
nodes_file_path = base_scenario["road_net"].nodes_df.attrs["source_file"]
nodes_file_path = base_scenario["road_net"].nodes_df.attrs.get("source_file", None)
if nodes_file_path is not None:
out_dict["roadway"] = {
"dir": str(Path(nodes_file_path).parent),
Expand Down

1 comment on commit aec6669

@yueshuaing
Copy link
Collaborator Author

@yueshuaing yueshuaing commented on aec6669 Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@e-lo I’ve implemented temporary fixes to address #383 and scenario config . I tested the current changes by running the base year project cards and MetCouncil workflows, and I've also created a pre-release version for MetCouncil to begin testing today. This commit will need to be reverted once a proper solution is in place.

Please sign in to comment.