processors

package
v0.0.0-...-abaed77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2024 License: GPL-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEG_TO_RAD float64 = 0.017453292519943295769236907684886127134428718885417254560
View Source
var DEG_TO_RAD32 float32 = float32(DEG_TO_RAD)

Functions

func FloatEquals

func FloatEquals(a float32, b float32, e float32) bool

FloatEquals checks if the difference of two floats is smaller than epsilon

func GetActDays

func GetActDays(service *gtfs.Service) int

GetActDays returns the number of active days of a gtfs.Service

func MaxParallelism

func MaxParallelism() int

MaxParallelism returns the number of CPUs, or the maximum number of processes if the latter is smaller than the former

Types

type AdjacentStopTimeGrouper

type AdjacentStopTimeGrouper struct {
}

AdjacentStopTimeGrouper groups adjacent stop times with the same stop (this can happen if arrival and departure are modelled as separate stop events)

func (AdjacentStopTimeGrouper) Run

Run the FrequencyMinimizer on a feed

type AgencyDuplicateRemover

type AgencyDuplicateRemover struct {
}

AgencyDuplicateRemover merges semantically equivalent routes

func (AgencyDuplicateRemover) Run

func (adr AgencyDuplicateRemover) Run(feed *gtfsparser.Feed)

Run this AgencyDuplicateRemover on some feed

type BySimi

type BySimi []ClusterCand

BySimi implements sort.Interface for []ClusterCand based on the similarity (bigger = first)

func (BySimi) Len

func (a BySimi) Len() int

func (BySimi) Less

func (a BySimi) Less(i, j int) bool

func (BySimi) Swap

func (a BySimi) Swap(i, j int)

type ClusterCand

type ClusterCand struct {
	// contains filtered or unexported fields
}

Merge cluster candidate with cluster id and similarity score [0, 1]

type CompleteTripsGeoFilter

type CompleteTripsGeoFilter struct {
	Polygons []gtfsparser.Polygon
}

StopDuplicateRemover merges semantically equivalent stops

func (CompleteTripsGeoFilter) Run

func (f CompleteTripsGeoFilter) Run(feed *gtfsparser.Feed)

Run this StopDuplicateRemover on some feed

type DateRange

type DateRange struct {
	Start gtfs.Date
	End   gtfs.Date
}

DateRange specified a date range from Start to End

func GetDateRange

func GetDateRange(service *gtfs.Service) DateRange

GetDateRange returns the active date range of a gtfs.Service

type DayType

type DayType struct {
	Dates []gtfs.Date
	Trips []*gtfs.Trip
}

type FrequencyMinimizer

type FrequencyMinimizer struct {
	MinHeadway int
	MaxHeadway int
}

FrequencyMinimizer minimizes trips, stop_times and frequencies by searching optimal covers for trip times.

func (FrequencyMinimizer) Run

func (m FrequencyMinimizer) Run(feed *gtfsparser.Feed)

Run the FrequencyMinimizer on a feed

type IDMinimizer

type IDMinimizer struct {
	Prefix           string
	Base             int
	KeepStations     bool
	KeepBlocks       bool
	KeepTrips        bool
	KeepRoutes       bool
	KeepFares        bool
	KeepShapes       bool
	KeepLevels       bool
	KeepServices     bool
	KeepAgencies     bool
	KeepPathways     bool
	KeepAttributions bool
}

IDMinimizer minimizes IDs by replacing them be continuous integer

func (IDMinimizer) Run

func (minimizer IDMinimizer) Run(feed *gtfsparser.Feed)

Run this IDMinimizer on a feed

type Item

type Item struct {
	// contains filtered or unexported fields
}

type OrphanRemover

type OrphanRemover struct {
}

OrphanRemover removes entities that aren't referenced anywhere

func (OrphanRemover) Run

func (or OrphanRemover) Run(feed *gtfsparser.Feed)

Run the OrphanRemover on some feed

type Overlap

type Overlap struct {
	Trip  *gtfs.Trip
	Dates []uint64
}

type PlatformCodeDropper

type PlatformCodeDropper struct {
}

PlatformCodeDropper removes platform codes from stops without a parent

func (PlatformCodeDropper) Run

func (sdr PlatformCodeDropper) Run(feed *gtfsparser.Feed)

Run this PlatformCodeDropper on some feed

type PriorityQueue

type PriorityQueue struct {
	Items []*Item
	Pqids []int
}

A PriorityQueue implements heap.Interface and holds Items.

func NewPriorityQueue

func NewPriorityQueue(len int) PriorityQueue

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type Processor

type Processor interface {
	Run(*gtfsparser.Feed)
}

Processor modifies an existing GTFS feed in-place

type RouteDuplicateRemover

type RouteDuplicateRemover struct {
}

RouteDuplicateRemover merges semantically equivalent routes

func (RouteDuplicateRemover) Run

func (rdr RouteDuplicateRemover) Run(feed *gtfsparser.Feed)

Run this RouteDuplicateRemover on some feed

type ServiceCalDatesRem

type ServiceCalDatesRem struct {
	ServiceMinimizer
	// contains filtered or unexported fields
}

ServiceCalDatesRemover removes any entry in calendar_dates.txt by splitting services into continuous blocks

func (ServiceCalDatesRem) Run

func (sm ServiceCalDatesRem) Run(feed *gtfsparser.Feed)

Run this ServiceMinimizer on some feed

type ServiceCompressed

type ServiceCompressed struct {
	// contains filtered or unexported fields
}

type ServiceDuplicateRemover

type ServiceDuplicateRemover struct {
}

ServiceDuplicateRemover removes duplicate services. Services are considered equal if they resolve to exactly the same service dates

func (ServiceDuplicateRemover) Run

func (sdr ServiceDuplicateRemover) Run(feed *gtfsparser.Feed)

Run this ServiceDuplicateRemover on some feed

type ServiceMinimizer

type ServiceMinimizer struct {
}

ServiceMinimizer minimizes services by finding optimal calendar.txt and calendar_dates.txt coverages.

func (ServiceMinimizer) Run

func (sm ServiceMinimizer) Run(feed *gtfsparser.Feed)

Run this ServiceMinimizer on some feed

type ServiceNonOverlapper

type ServiceNonOverlapper struct {
	DayNames     []string
	YearWeekName string
}

ServiceNonOverlapper constructs day-wise non-overlapping trips. Basically, this works as follows: uniqe day types are constructed for each day of the week. A day type is one DOW on which *excactly* the same trips are served. Similary day types are than aggreated, and outfitted with an ID "<Weekday> (WW<list of calendar weeks served)".

func (ServiceNonOverlapper) Run

func (sm ServiceNonOverlapper) Run(feed *gtfsparser.Feed)

Run this ServiceMinimizer on some feed

type ShapeDuplicateRemover

type ShapeDuplicateRemover struct {
	MaxEqDist float64
	// contains filtered or unexported fields
}

ShapeDuplicateRemover removes duplicate shapes

func (ShapeDuplicateRemover) Run

func (sdr ShapeDuplicateRemover) Run(feed *gtfsparser.Feed)

Run this ShapeDuplicateRemover on some feed

type ShapeIdx

type ShapeIdx struct {
	// contains filtered or unexported fields
}

ShapeIdx stores objects for fast nearest-neighbor retrieval

func NewShapeIdx

func NewShapeIdx(shapes []*gtfs.Shape, mercs map[*gtfs.Shape][][]float64, cellWidth, cellHeight float64) *ShapeIdx

func (*ShapeIdx) Add

func (gi *ShapeIdx) Add(origShp *gtfs.Shape, shp [][]float64)

func (*ShapeIdx) GetNeighbors

func (gi *ShapeIdx) GetNeighbors(shp [][]float64, d float64) map[*gtfs.Shape]bool

type ShapeMinimizer

type ShapeMinimizer struct {
	Epsilon float64
}

ShapeMinimizer minimizes shapes.

func (ShapeMinimizer) Run

func (sm ShapeMinimizer) Run(feed *gtfsparser.Feed)

Run this ShapeMinimizer on some feed

type ShapeRemeasurer

type ShapeRemeasurer struct {
}

ShapeRemeasurer remeasure shapes

func (ShapeRemeasurer) Run

func (s ShapeRemeasurer) Run(feed *gtfsparser.Feed)

Run this ShapeRemeasurer on some feed

type ShapeSnapper

type ShapeSnapper struct {
	MaxDist float64
	// contains filtered or unexported fields
}

ShapeMinimizer minimizes shapes.

func (ShapeSnapper) Run

func (sm ShapeSnapper) Run(feed *gtfsparser.Feed)

Run this ShapeMinimizer on some feed

type StopCluster

type StopCluster struct {
	Parents []*gtfs.Stop
	Childs  []*gtfs.Stop
}

A StopCluster contains stops in .Childs which are grouped by stops in in .Parents (all stops in .Parents have location_type = 1). If a StopCluster contains multiple parents, the best matching parent will be chosen later on

func NewStopCluster

func NewStopCluster(stop *gtfs.Stop) *StopCluster

Create a new StopCluster from a single stops

type StopClusterIdx

type StopClusterIdx struct {
	// contains filtered or unexported fields
}

StopClusterIdx stores objects for fast nearest-neighbor retrieval

func NewStopClusterIdx

func NewStopClusterIdx(clusters []*StopCluster, cellWidth, cellHeight float64) *StopClusterIdx

func (*StopClusterIdx) Add

func (gi *StopClusterIdx) Add(lat float64, lon float64, obj int)

func (*StopClusterIdx) GetNeighbors

func (gi *StopClusterIdx) GetNeighbors(excludeCid int, c *StopCluster, d float64) map[int]bool

func (*StopClusterIdx) GetNeighborsByLatLon

func (gi *StopClusterIdx) GetNeighborsByLatLon(lat float64, lon float64, d float64) map[int]bool

type StopDuplicateRemover

type StopDuplicateRemover struct {
	DistThresholdStop    float64
	DistThresholdStation float64
	Fuzzy                bool
}

StopDuplicateRemover merges semantically equivalent stops

func (StopDuplicateRemover) Run

func (sdr StopDuplicateRemover) Run(feed *gtfsparser.Feed)

Run this StopDuplicateRemover on some feed

type StopParentAverager

type StopParentAverager struct {
	MaxDist float64
}

StopParentAverager takes stop parents that are more than MaxDist meter away from one of their childs and checks whether moving them to the centroid of all childs fixes this. If not, nothing is changed!

func (StopParentAverager) Run

func (sdr StopParentAverager) Run(feed *gtfsparser.Feed)

Run this StopParentEnforcer on some feed

type StopParentEnforcer

type StopParentEnforcer struct {
}

StopParentEnforcer makes sure that all stops have parents

func (StopParentEnforcer) Run

func (sdr StopParentEnforcer) Run(feed *gtfsparser.Feed)

Run this StopParentEnforcer on some feed

type StopReclusterer

type StopReclusterer struct {
	DistThreshold     float64
	NameSimiThreshold float64
	GridCellSize      float64
	// contains filtered or unexported fields
}

StopReclusterer reclusters stops

func (StopReclusterer) Run

func (m StopReclusterer) Run(feed *gtfsparser.Feed)

Run this StopReclusterer on some feed

type TooFastTripRemover

type TooFastTripRemover struct {
}

StopDuplicateRemover merges semantically equivalent stops

func (TooFastTripRemover) Run

func (f TooFastTripRemover) Run(feed *gtfsparser.Feed)

Run this StopDuplicateRemover on some feed

type TripDuplicateRemover

type TripDuplicateRemover struct {
	Fuzzy      bool
	Aggressive bool
	MaxDayDist int
	// contains filtered or unexported fields
}

TripDuplicateRemover merges semantically equivalent routes

func (TripDuplicateRemover) Run

func (m TripDuplicateRemover) Run(feed *gtfsparser.Feed)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL