openmobisim.services ==================== .. py:module:: openmobisim.services .. autoapi-nested-parse:: Shared-mobility services' tables: bike-sharing docks, a fleet's vehicles, chargers. ``dock_read_table`` and ``dock_read_gbfs`` read a bike-sharing system's docks: from a table (a CSV/TSV file, its text, or rows as dicts), or from the system's GBFS feed (the open standard bike-sharing systems publish: ``station_information.json`` and, for the bikes docked, ``station_status.json``). ``vehicle_read_table`` and ``charger_read_table`` read an electric fleet's vehicles and chargers from tables. A dock or charger may name the hub it belongs to (``hub_id``); without one it joins the hub of the nearest transit stop within 150 m, or is a hub of its own. Functions --------- .. autoapisummary:: openmobisim.services.charger_read_table openmobisim.services.dock_read_gbfs openmobisim.services.dock_read_table openmobisim.services.vehicle_read_table Module Contents --------------- .. py:function:: charger_read_table(source) Chargers from a table: one row per charger. Columns (names in any case): ``charger_id`` (unique), ``lon``, ``lat``, ``plugs`` (how many vehicles it charges at once) and, optionally, ``kw`` (its power per plug; empty: the service's ``charger_kw``, 50 by default) and ``hub_id`` (the hub it belongs to). Each is snapped to the road network; one farther than the service's ``snap_m``, or without plugs, is left out. :param source: A CSV/TSV file's path or text, or rows as dicts. :raises ValueError: If a required column is missing, a value is not valid, or an id repeats. .. py:function:: dock_read_gbfs(station_information, station_status = None) Docks from a bike-sharing system's GBFS feed (General Bikeshare Feed Specification). Every system publishes its stations in ``station_information.json`` (id, name, place, ``capacity``) and their state in ``station_status.json`` (bikes available now). Give the two files here, as paths, their text or their parsed JSON; versions 2 and 3 are read. A station without a ``capacity`` is left out. :param station_information: ``station_information.json``. :param station_status: ``station_status.json``, for the bikes docked when the day starts: each station's ``num_bikes_available`` (version 2) or ``num_vehicles_available`` (version 3), at most its capacity. Without it, a dock starts at the service's ``start_share`` of its slots. A snapshot of one moment: take one from early morning for a day's start. :raises ValueError: If a file is not a GBFS file or a station is not valid. .. py:function:: dock_read_table(source) Docks from a table: one row per dock. Columns (names in any case): * ``dock_id`` — unique in the table; * ``lon``, ``lat`` — where it is (WGS84 degrees); * ``capacity`` — its slots: how many bikes it holds; * optional: ``name``; ``hub_id`` (the hub it belongs to); ``bikes`` (bikes docked when the day starts; empty: the service's ``start_share`` of the slots, half by default). Each dock is snapped to the walk and bike layers; one too far from either (the service's ``snap_m``) or without slots is left out. :param source: A CSV/TSV file's path or text, or rows as dicts. :raises ValueError: If a required column is missing, a value is not valid, a dock holds more bikes than slots, or a ``dock_id`` repeats. .. py:function:: vehicle_read_table(source) An electric fleet's vehicles from a table: one row per vehicle. Columns (names in any case): ``vehicle_id`` (unique), ``lon``, ``lat`` (where it is when the day starts, WGS84 degrees) and, optionally, ``soc`` (its charge then, a share from 0 to 1; empty: the service's ``soc_start``, 0.8 by default). Each is snapped to the road network; one farther than the service's ``snap_m`` is left out. :param source: A CSV/TSV file's path or text, or rows as dicts. :raises ValueError: If a required column is missing, a value is not valid, or an id repeats.