wawbus.util package

Submodules

wawbus.util.dist module

wawbus.util.dist.haversine(lon1, lat1, lon2, lat2)

Calculate the great circle distance in kilometers between two points on the earth (specified in decimal degrees). Source: https://stackoverflow.com/a/4913653

Parameters:
  • lon1 (float) – longitude of point 1

  • lat1 (float) – latitude of point 1

  • lon2 (float) – longitude of point 2

  • lat2 (float) – latitude of point 2

Returns:

distance in kilometers

wawbus.util.dist.speed(row)

Pandas UDF to calculate speed from row.

Assumptions:

Used internally in WawBus class The vehicle is moving in a straight line between two points

wawbus.util.dist.stop_dist(row)

Pandas UDF to calculate distance from stop.

Assumptions:

Used internally in WawBus class Row contains ‘Lon’, ‘Lat’, ‘dlug_geo’, ‘szer_geo’

wawbus.util.time module

wawbus.util.time.timeint(x)

Pandas UDF which returns seconds from 00:00:00.

Parameters:

x – Timestamp

Returns:

Seconds from 00:00:00

Return type:

int

Module contents