Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up functions in segment_speed_utils #1326

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions rt_segment_speeds/scripts/interpolate_stop_arrival.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
from pathlib import Path
from typing import Literal, Optional

from segment_speed_utils import (array_utils, helpers,
segment_calcs)
from segment_speed_utils import helpers, segment_calcs
from update_vars import SEGMENT_GCS, GTFS_DATA_DICT
from segment_speed_utils.project_vars import PROJECT_CRS, SEGMENT_TYPES
from shared_utils import rt_dates
Expand Down Expand Up @@ -166,7 +165,7 @@ def enforce_monotonicity_and_interpolate_across_stops(
df = segment_calcs.convert_timestamp_to_seconds(
df, ["arrival_time"])

df = array_utils.rolling_window_make_array(
df = segment_calcs.rolling_window_make_array(
df,
window = 3, rolling_col = "arrival_time_sec"
)
Expand Down
3 changes: 2 additions & 1 deletion rt_segment_speeds/scripts/nearest_vp_to_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
import datetime
import geopandas as gpd
import numpy as np
import pandas as pd
import sys

Expand Down Expand Up @@ -158,7 +159,7 @@ def nearest_neighbor_for_stop(
gdf = neighbor.merge_stop_vp_for_nearest_neighbor(stop_times, analysis_date)

vp_before, vp_after, vp_before_meters, vp_after_meters = np.vectorize(
neighbor.subset_arrays_to_valid_directions
neighbor.two_nearest_neighbor_near_stop
)(
gdf.vp_primary_direction,
gdf.vp_geometry,
Expand Down
5 changes: 3 additions & 2 deletions rt_segment_speeds/scripts/pipeline_rt_stop_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

logger.remove()


LOG_FILE = "../logs/interpolate_stop_arrival.log"
logger.add(LOG_FILE, retention="3 months")
logger.add(sys.stderr,
Expand All @@ -57,7 +57,7 @@

logger.remove()


LOG_FILE = "../logs/speeds_by_segment_trip.log"
logger.add(LOG_FILE, retention="3 months")
logger.add(sys.stderr,
Expand All @@ -75,3 +75,4 @@
[compute(i)[0] for i in delayed_dfs]

logger.remove()

7 changes: 4 additions & 3 deletions rt_segment_speeds/scripts/pipeline_segment_speeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if __name__ == "__main__":

from segment_speed_utils.project_vars import analysis_date_list

segment_type = "stop_segments"
print(f"segment_type: {segment_type}")

Expand Down Expand Up @@ -59,7 +59,7 @@

logger.remove()


LOG_FILE = "../logs/speeds_by_segment_trip.log"
logger.add(LOG_FILE, retention="3 months")
logger.add(sys.stderr,
Expand All @@ -76,4 +76,5 @@

[compute(i)[0] for i in delayed_dfs]

logger.remove()
logger.remove()

7 changes: 4 additions & 3 deletions rt_segment_speeds/scripts/pipeline_speedmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def concatenate_speedmap_proxy_arrivals_with_remaining(

logger.remove()


LOG_FILE = "../logs/interpolate_stop_arrival.log"
logger.add(LOG_FILE, retention="3 months")
logger.add(sys.stderr,
Expand All @@ -109,7 +109,7 @@ def concatenate_speedmap_proxy_arrivals_with_remaining(

logger.remove()


t0 = datetime.datetime.now()
delayed_dfs = [
delayed(concatenate_speedmap_proxy_arrivals_with_remaining)(
Expand Down Expand Up @@ -139,4 +139,5 @@ def concatenate_speedmap_proxy_arrivals_with_remaining(

[compute(i)[0] for i in delayed_dfs]

logger.remove()
logger.remove()

269 changes: 0 additions & 269 deletions rt_segment_speeds/scripts/vp_around_stops.py

This file was deleted.

2 changes: 0 additions & 2 deletions rt_segment_speeds/segment_speed_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import (
array_utils,
gtfs_schedule_wrangling,
helpers,
metrics,
Expand All @@ -12,7 +11,6 @@
)

__all__ = [
"array_utils",
"gtfs_schedule_wrangling",
"helpers",
"metrics",
Expand Down
Loading
Loading