diff --git a/rt_segment_speeds/logs/avg_speeds.log b/rt_segment_speeds/logs/avg_speeds.log index 31e4d476b..7b5f7d87d 100644 --- a/rt_segment_speeds/logs/avg_speeds.log +++ b/rt_segment_speeds/logs/avg_speeds.log @@ -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__::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__::433 - average rollups for 2024-01-17: 0:01:52.695658 diff --git a/rt_segment_speeds/logs/cut_stop_segments.log b/rt_segment_speeds/logs/cut_stop_segments.log index bf73b7f77..9948fde98 100644 --- a/rt_segment_speeds/logs/cut_stop_segments.log +++ b/rt_segment_speeds/logs/cut_stop_segments.log @@ -1,6 +1 @@ -2024-01-17 08:51:37.506 | INFO | __main__::71 - Analysis date: 2023-12-13 -2024-01-17 09:13:47.443 | INFO | __main__::118 - cut segments for all trips: 0:22:09.920160 -2024-01-25 17:55:11.789 | INFO | __main__::151 - cut segments 2024-01-17: 0:15:20.866136 -2024-01-25 18:10:52.489 | INFO | __main__::151 - cut segments 2023-12-13: 0:15:40.699105 -2024-01-25 18:26:27.834 | INFO | __main__::151 - cut segments 2023-11-15: 0:15:35.343763 -2024-01-25 18:41:57.495 | INFO | __main__::151 - cut segments 2023-10-11: 0:15:29.660398 \ No newline at end of file +0:15:29.6603982024-02-15 13:36:56.379 | INFO | __main__::156 - cut segments 2024-02-14: 0:13:55.835925 diff --git a/rt_segment_speeds/logs/interpolate_stop_arrival.log b/rt_segment_speeds/logs/interpolate_stop_arrival.log index db06f6283..5e358198e 100644 --- a/rt_segment_speeds/logs/interpolate_stop_arrival.log +++ b/rt_segment_speeds/logs/interpolate_stop_arrival.log @@ -1,8 +1 @@ -2023-12-14 11:37:11.735 | INFO | __main__::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 \ No newline at end of file +2024-02-15 14:18:47.082 | INFO | __main__:interpolate_stop_arrivals:110 - get stop arrivals 2024-02-14: 0:09:37.655118 diff --git a/rt_segment_speeds/logs/nearest_vp.log b/rt_segment_speeds/logs/nearest_vp.log index 1084cda97..03724a3f0 100644 --- a/rt_segment_speeds/logs/nearest_vp.log +++ b/rt_segment_speeds/logs/nearest_vp.log @@ -1,9 +1,2 @@ -2023-12-14 11:24:08.032 | INFO | __main__::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 \ No newline at end of file +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 diff --git a/rt_segment_speeds/logs/speeds_by_segment_trip.log b/rt_segment_speeds/logs/speeds_by_segment_trip.log index 291d0dbee..a350bda9e 100644 --- a/rt_segment_speeds/logs/speeds_by_segment_trip.log +++ b/rt_segment_speeds/logs/speeds_by_segment_trip.log @@ -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 - \ No newline at end of file +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 diff --git a/rt_segment_speeds/scripts/average_speeds.py b/rt_segment_speeds/scripts/average_speeds.py index cda502b92..4f9b6a47a 100644 --- a/rt_segment_speeds/scripts/average_speeds.py +++ b/rt_segment_speeds/scripts/average_speeds.py @@ -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) @@ -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}" @@ -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}" @@ -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}" @@ -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}" @@ -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() @@ -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}") - + ''' \ No newline at end of file diff --git a/rt_segment_speeds/scripts/cut_stop_segments.py b/rt_segment_speeds/scripts/cut_stop_segments.py index a5dfb464c..6b29a6392 100644 --- a/rt_segment_speeds/scripts/cut_stop_segments.py +++ b/rt_segment_speeds/scripts/cut_stop_segments.py @@ -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, @@ -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}" diff --git a/rt_segment_speeds/scripts/nearest_vp_to_stop.py b/rt_segment_speeds/scripts/nearest_vp_to_stop.py index 8e3973e06..115f2492f 100644 --- a/rt_segment_speeds/scripts/nearest_vp_to_stop.py +++ b/rt_segment_speeds/scripts/nearest_vp_to_stop.py @@ -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 @@ -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, @@ -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}", @@ -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}", diff --git a/rt_segment_speeds/scripts/select_stop_segments.py b/rt_segment_speeds/scripts/select_stop_segments.py index 4ad607197..15035544a 100644 --- a/rt_segment_speeds/scripts/select_stop_segments.py +++ b/rt_segment_speeds/scripts/select_stop_segments.py @@ -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 @@ -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}" diff --git a/rt_segment_speeds/segment_speed_utils/array_utils.py b/rt_segment_speeds/segment_speed_utils/array_utils.py index 8568e177a..5900f7744 100644 --- a/rt_segment_speeds/segment_speed_utils/array_utils.py +++ b/rt_segment_speeds/segment_speed_utils/array_utils.py @@ -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 \ No newline at end of file