Skip to content

Commit

Permalink
feb speeds, remove reference to utils_to_add
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffanychu90 committed Feb 15, 2024
1 parent 8cb342c commit edc2a8b
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 48 deletions.
5 changes: 5 additions & 0 deletions rt_segment_speeds/logs/avg_speeds.log
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
2024-01-30 10:22:12.414 | INFO | __main__:multi_day_averages:338 - route seg avg 0:02:29.962531
2024-01-30 10:22:54.131 | INFO | __main__:multi_day_averages:377 - route dir avg 0:00:41.717110
2024-01-30 10:22:54.176 | INFO | __main__:<module>:443 - average rollups for ['2023-10-09', '2023-10-10', '2023-10-11', '2023-10-12', '2023-10-13', '2023-10-14', '2023-10-15']: 0:03:11.725898
2024-02-15 14:52:09.597 | INFO | __main__:single_day_averages:194 - shape seg avg 0:00:47.942274
2024-02-15 14:52:55.960 | INFO | __main__:single_day_averages:227 - route dir seg avg 0:00:46.362889
2024-02-15 14:52:57.307 | INFO | __main__:single_day_averages:244 - trip avg 0:00:01.346473
2024-02-15 14:53:05.722 | INFO | __main__:single_day_averages:276 - route dir avg: 0:00:08.415679
2024-02-15 14:53:11.404 | INFO | __main__:<module>:433 - average rollups for 2024-01-17: 0:01:52.695658
7 changes: 1 addition & 6 deletions rt_segment_speeds/logs/cut_stop_segments.log
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
2024-01-17 08:51:37.506 | INFO | __main__:<module>:71 - Analysis date: 2023-12-13
2024-01-17 09:13:47.443 | INFO | __main__:<module>:118 - cut segments for all trips: 0:22:09.920160
2024-01-25 17:55:11.789 | INFO | __main__:<module>:151 - cut segments 2024-01-17: 0:15:20.866136
2024-01-25 18:10:52.489 | INFO | __main__:<module>:151 - cut segments 2023-12-13: 0:15:40.699105
2024-01-25 18:26:27.834 | INFO | __main__:<module>:151 - cut segments 2023-11-15: 0:15:35.343763
2024-01-25 18:41:57.495 | INFO | __main__:<module>:151 - cut segments 2023-10-11: 0:15:29.660398
0:15:29.6603982024-02-15 13:36:56.379 | INFO | __main__:<module>:156 - cut segments 2024-02-14: 0:13:55.835925
9 changes: 1 addition & 8 deletions rt_segment_speeds/logs/interpolate_stop_arrival.log
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
2023-12-14 11:37:11.735 | INFO | __main__:<module>:215 - Analysis date: 2023-12-13
2023-12-14 11:39:47.181 | INFO | __main__:main:184 - stop_segments: set up df with nearest / subseq vp info: 0:02:35.392831
2023-12-14 11:40:48.345 | INFO | __main__:main:190 - interpolate stop arrival: 0:01:01.164427
2023-12-14 11:40:59.919 | INFO | __main__:main:196 - execution time for stop_segments: 0:03:48.131217
2024-01-24 09:54:22.652 | INFO | __main__:interpolate_stop_arrivals:107 - get stop arrivals 2024-01-17: 0:10:11.131591
2024-01-27 19:51:50.425 | INFO | __main__:interpolate_stop_arrivals:110 - get stop arrivals 2023-12-13: 0:09:47.554048
2024-01-27 20:02:03.868 | INFO | __main__:interpolate_stop_arrivals:110 - get stop arrivals 2023-11-15: 0:10:13.251370
2024-01-27 20:11:39.908 | INFO | __main__:interpolate_stop_arrivals:110 - get stop arrivals 2023-10-11: 0:09:35.901028
2024-02-15 14:18:47.082 | INFO | __main__:interpolate_stop_arrivals:110 - get stop arrivals 2024-02-14: 0:09:37.655118
11 changes: 2 additions & 9 deletions rt_segment_speeds/logs/nearest_vp.log
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
2023-12-14 11:24:08.032 | INFO | __main__:<module>:342 - Analysis date: 2023-12-13
2023-12-14 11:30:59.475 | INFO | __main__:find_nearest_vp_to_stop:280 - map partitions to transform vp: 0:06:51.416122
2023-12-14 11:31:01.378 | INFO | __main__:find_nearest_vp_to_stop:312 - map partitions to find nearest vp to stop: 0:00:01.903498
2024-01-27 13:45:18.221 | INFO | __main__:nearest_neighbor_shape_segments:203 - shape segments 2023-12-13: 0:11:38.045844
2024-01-27 14:19:15.940 | INFO | __main__:nearest_neighbor_shape_segments:206 - shape segments 2023-12-13: 0:11:37.741682
2024-01-27 17:07:34.843 | INFO | __main__:nearest_neighbor_shape_segments:204 - shape segments 2023-11-15: 0:12:02.309702
2024-01-27 17:19:42.602 | INFO | __main__:nearest_neighbor_rt_stop_times:136 - RT stop times 2023-11-15: 0:12:04.187679
2024-01-27 17:46:11.054 | INFO | __main__:nearest_neighbor_shape_segments:204 - shape segments 2023-10-11: 0:11:47.793159
2024-01-27 17:58:02.005 | INFO | __main__:nearest_neighbor_rt_stop_times:136 - RT stop times 2023-10-11: 0:11:47.705595
2024-02-15 13:48:26.270 | INFO | __main__:nearest_neighbor_shape_segments:203 - shape segments 2024-02-14: 0:10:31.474349
2024-02-15 14:08:52.783 | INFO | __main__:nearest_neighbor_rt_stop_times:135 - RT stop times 2024-02-14: 0:11:07.883083
8 changes: 2 additions & 6 deletions rt_segment_speeds/logs/speeds_by_segment_trip.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
2024-01-24 17:15:10.165 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2024-01-17: 0:00:25.610204
2024-01-27 20:12:24.879 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2023-12-13: 0:00:26.567386
2024-01-27 20:12:50.577 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2023-11-15: 0:00:25.530726
2024-01-27 20:13:15.096 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2023-10-11: 0:00:24.355903
2024-01-28 15:12:19.958 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2023-09-13: 0:00:21.749183
2024-01-28 15:12:40.323 | INFO | __main__:calculate_speed_from_stop_arrivals:132 -
2024-02-15 14:19:36.965 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2024-02-14: 0:00:31.989535
2024-02-15 14:45:36.035 | INFO | __main__:calculate_speed_from_stop_arrivals:132 - speeds by segment: 2024-01-17: 0:00:32.109610
13 changes: 6 additions & 7 deletions rt_segment_speeds/scripts/average_speeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Literal

from calitp_data_analysis.geography_utils import WGS84
from shared_utils import utils_to_add
from calitp_data_analysis import utils
from segment_speed_utils import (gtfs_schedule_wrangling, helpers,
segment_calcs, time_helpers)
Expand Down Expand Up @@ -183,7 +182,7 @@ def single_day_averages(analysis_date: str, dict_inputs: dict):
columns = col_order + ["geometry"]
)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
shape_stop_segments,
SEGMENT_GCS,
f"{SHAPE_SEG_FILE}_{analysis_date}"
Expand Down Expand Up @@ -216,7 +215,7 @@ def single_day_averages(analysis_date: str, dict_inputs: dict):
columns = col_order + ["geometry"]
)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
route_dir_segments,
SEGMENT_GCS,
f"{ROUTE_SEG_FILE}_{analysis_date}"
Expand Down Expand Up @@ -265,7 +264,7 @@ def single_day_averages(analysis_date: str, dict_inputs: dict):
columns = col_order + ["route_name", "geometry"]
)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
route_dir_avg,
SEGMENT_GCS,
f"{ROUTE_DIR_FILE}_{analysis_date}"
Expand Down Expand Up @@ -328,7 +327,7 @@ def multi_day_averages(analysis_date_list: list, dict_inputs: dict):
columns = col_order + ["geometry"]
)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
route_dir_segments,
SEGMENT_GCS,
f"{ROUTE_SEG_FILE}_{time_span_str}"
Expand Down Expand Up @@ -433,7 +432,7 @@ def stage_open_data_exports(analysis_date: str, dict_inputs: dict):

logger.info(f"average rollups for {analysis_date}: {end - start}")


'''
for month in ["apr2023", "oct2023"]:
start = datetime.datetime.now()
Expand All @@ -443,5 +442,5 @@ def stage_open_data_exports(analysis_date: str, dict_inputs: dict):
end = datetime.datetime.now()
logger.info(f"average rollups for {one_week}: {end - start}")

'''

5 changes: 2 additions & 3 deletions rt_segment_speeds/scripts/cut_stop_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from loguru import logger

#from calitp_data_analysis import utils
from shared_utils import utils_to_add
from calitp_data_analysis import utils
from calitp_data_analysis.geography_utils import WGS84
from segment_speed_utils import gtfs_schedule_wrangling, helpers
from segment_speed_utils.project_vars import (SEGMENT_GCS,
Expand Down Expand Up @@ -145,7 +144,7 @@ def cut_stop_segments(analysis_date: str) -> gpd.GeoDataFrame:
how = "inner"
)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
segments,
SEGMENT_GCS,
f"{SEGMENT_FILE}_{analysis_date}"
Expand Down
9 changes: 4 additions & 5 deletions rt_segment_speeds/scripts/nearest_vp_to_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from loguru import logger

from calitp_data_analysis.geography_utils import WGS84
#from calitp_data_analysis import utils
from shared_utils import utils_to_add
from calitp_data_analysis import utils
from segment_speed_utils import helpers, neighbor
from segment_speed_utils.project_vars import SEGMENT_GCS

Expand Down Expand Up @@ -108,7 +107,7 @@ def nearest_neighbor_rt_stop_times(
includes all trips. Use stop sequences for each trip.
"""
start = datetime.datetime.now()
EXPORT_FILE = Path(f'{dict_inputs["stage2"]}')
EXPORT_FILE = f'{dict_inputs["stage2"]}'

stop_times = helpers.import_scheduled_stop_times(
analysis_date,
Expand All @@ -126,7 +125,7 @@ def nearest_neighbor_rt_stop_times(

results = add_nearest_neighbor_result(gdf, analysis_date)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
results,
SEGMENT_GCS,
f"{EXPORT_FILE}_{analysis_date}",
Expand Down Expand Up @@ -194,7 +193,7 @@ def nearest_neighbor_shape_segments(

del gdf

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
results,
SEGMENT_GCS,
f"{EXPORT_FILE}_{analysis_date}",
Expand Down
5 changes: 2 additions & 3 deletions rt_segment_speeds/scripts/select_stop_segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import geopandas as gpd
import pandas as pd

#from calitp_data_analysis import utils
from shared_utils import utils_to_add
from calitp_data_analysis import utils
from shared_utils import rt_dates
from segment_speed_utils import helpers
from segment_speed_utils.project_vars import SEGMENT_GCS
Expand Down Expand Up @@ -73,7 +72,7 @@ def select_one_trip_per_shape(analysis_date: str):

segments = select_one_trip_per_shape(analysis_date)

utils_to_add.geoparquet_gcs_export(
utils.geoparquet_gcs_export(
segments,
SEGMENT_GCS,
f"{SEGMENT_FILE}_{analysis_date}"
Expand Down
2 changes: 1 addition & 1 deletion rt_segment_speeds/segment_speed_utils/array_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def monotonic_check(arr: np.ndarray) -> bool:
"""
diff_arr = np.diff(arr)

if np.all(diff_arr >= 0):
if np.all(diff_arr > 0):
return True
else:
return False

0 comments on commit edc2a8b

Please sign in to comment.