original_docstring: Returns and array of SpeedLimitSection objects for the actual route ahead of current location
      
docstring: Returns and array of SpeedLimitSection objects for the actual route ahead of current location
docstring_tokens: Returns and array of SpeedLimitSection objects for the actual route ahead of current location
code: def speed_limits_ahead(self, ahead_idx, distance_to_node_ahead):
      """Returns and array of SpeedLimitSection objects for the actual route ahead of current location
      """
      if len(self._nodes_data) == 0 or ahead_idx is None:
        return []
  
      # Find the cumulative distances where speed limit changes. Build Speed limit sections for those.
      dist = np.concatenate(([distance_to_node_ahead], self.get(NodeDataIdx.dist_next)[ahead_idx:]))
      dist = np.cumsum(dist, axis=0)
      sl = self.get(NodeDataIdx.speed_limit)[ahead_idx - 1:]
      sl_next = np.concatenate((sl[1:], [0.]))
  
      # Create a boolean mask where speed limit changes and filter values
      sl_change = sl != sl_next
      distances = dist[sl_change]
      speed_limits = sl[sl_change]
  
      # Create speed limits sections combining all continious nodes that have same speed limit value.
      start = 0.
      limits_ahead = []
      for idx, end in enumerate(distances):
        limits_ahead.append(SpeedLimitSection(start, end, speed_limits[idx]))
        start = end
  
      return limits_ahead
code_tokens: def speed_limits_ahead ( self , ahead_idx , distance_to_node_ahead ) : if len ( self . _nodes_data ) == 0 or ahead_idx is None : return [ ] dist = np . concatenate ( ( [ distance_to_node_ahead ] , self . get ( NodeDataIdx . dist_next ) [ ahead_idx : ] ) ) dist = np . cumsum ( dist , axis = 0 ) sl = self . get ( NodeDataIdx . speed_limit ) [ ahead_idx - 1 : ] sl_next = np . concatenate ( ( sl [ 1 : ] , [ 0. ] ) ) sl_change = sl != sl_next distances = dist [ sl_change ] speed_limits = sl [ sl_change ] start = 0. limits_ahead = [ ] for idx , end in enumerate ( distances ) : limits_ahead . append ( SpeedLimitSection ( start , end , speed_limits [ idx ] ) ) start = end return limits_ahead
short_docstring: Returns and array of SpeedLimitSection objects for the actual route ahead of current location
short_docstring_tokens: Returns and array of SpeedLimitSection objects for the actual route ahead of current location
comment: """Returns and array of SpeedLimitSection objects for the actual route ahead of current location
      """$SEP$# Find the cumulative distances where speed limit changes. Build Speed limit sections for those.$SEP$# Create a boolean mask where speed limit changes and filter values$SEP$# Create speed limits sections combining all continious nodes that have same speed limit value.