Skip to content

Commit 0c9b600

Browse files
authored
Merge pull request #1278 from cal-itp/speedmaps-split-peaks
segment speeds for speedmaps part 2
2 parents 6adecac + 0287a8f commit 0c9b600

File tree

92 files changed

+1093
-2459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+1093
-2459
lines changed

_shared_utils/shared_utils/gtfs_analytics_data.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ speedmap_segments:
119119
trip_stop_cols: ["trip_instance_key", "stop_sequence", "stop_sequence1"]
120120
shape_stop_cols: ["shape_array_key", "shape_id"]
121121
stop_pair_cols: ["stop_pair", "stop_pair_name", "segment_id"]
122-
route_dir_cols: ["route_id", "route_short_name"]
122+
route_dir_cols: ["route_id", "direction_id"]
123123
segments_file: "segment_options/speedmap_segments"
124124
shape_stop_single_segment: "rollup_singleday/speeds_shape_speedmap_segments"
125+
shape_stop_single_segment_detail: "rollup_singleday/speeds_shape_speedmap_segments_detail"
125126
route_dir_single_segment: "rollup_singleday/speeds_route_dir_speedmap_segments"
126127
route_dir_multi_segment: "rollup_multiday/speeds_route_dir_speedmap_segments"
127128
min_trip_minutes: ${speed_vars.time_min_cutoff}

_shared_utils/shared_utils/rt_utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
MPH_PER_MPS = 2.237 # use to convert meters/second to miles/hour
4646
METERS_PER_MILE = 1609.34
4747
# Colorscale
48-
ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdYlGn_10.scale(vmin=0, vmax=30)
49-
ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)"
48+
# ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdYlGn_10.scale(vmin=0, vmax=30)
49+
# ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)"
5050
ACCESS_ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdBu_10.scale(vmin=0, vmax=30)
5151
ACCESS_ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)"
5252
VARIANCE_COLORS = branca.colormap.step.Blues_06.colors[1:] # actual breaks will vary
@@ -562,6 +562,13 @@ def categorize_time_of_day(value: Union[int, dt.datetime]) -> str:
562562
return "Evening"
563563

564564

565+
def time_of_day_durations() -> pd.Series:
566+
"""
567+
Get duration in hours of each time of day classification.
568+
"""
569+
return pd.Series([categorize_time_of_day(x) for x in range(25)]).value_counts()
570+
571+
565572
@jit(nopython=True) # numba gives huge speedup here (~60x)
566573
def time_at_position_numba(desired_position, shape_array, dt_float_array):
567574
if desired_position < shape_array.max() and desired_position > shape_array.min():

0 commit comments

Comments
 (0)