Skip to content

flag_sentinel_coordinates

flag_sentinel_coordinates

flag_sentinel_coordinates(info: DataFrame, *, tol: float = 1e-06) -> Series

Boolean mask of stations sitting on the (0, 0) null-island sentinel.

Operators sometimes publish lat = lon = 0 as a placeholder for a station whose geolocation is pending. A single such point inflates a system's bounding-box area by orders of magnitude (the A5/A4 coupling behind the Sevici case), so it should be filtered before any geospatial rule. Use the mask to drop or quarantine these rows.

Parameters:

Name Type Description Default
info DataFrame

Requires lat and lon.

required
tol float

Degrees within which a coordinate counts as the (0, 0) sentinel.

1e-6

Returns:

Type Description
Series

Boolean mask aligned to info (True where a station is on the sentinel).

See Also

audit_static : The A1-A7 audit; filter the sentinel before its A4/A5 geometry rules.

Examples:

>>> import pandas as pd
>>> info = pd.DataFrame({"lat": [48.85, 0.0], "lon": [2.35, 0.0]})
>>> flag_sentinel_coordinates(info).tolist()
[False, True]
Source code in src/gbfs_toolkit/audit/static.py
def flag_sentinel_coordinates(info: pd.DataFrame, *, tol: float = 1e-6) -> pd.Series:
    """Boolean mask of stations sitting on the ``(0, 0)`` null-island sentinel.

    Operators sometimes publish ``lat = lon = 0`` as a placeholder for a station
    whose geolocation is pending. A single such point inflates a system's
    bounding-box area by orders of magnitude (the A5/A4 coupling behind the Sevici
    case), so it should be filtered before any geospatial rule. Use the mask to
    drop or quarantine these rows.

    Parameters
    ----------
    info : pandas.DataFrame
        Requires ``lat`` and ``lon``.
    tol : float, default 1e-6
        Degrees within which a coordinate counts as the ``(0, 0)`` sentinel.

    Returns
    -------
    pandas.Series
        Boolean mask aligned to ``info`` (``True`` where a station is on the sentinel).

    See Also
    --------
    [`audit_static`][gbfs_toolkit.audit_static] : The A1-A7 audit; filter the sentinel before its A4/A5 geometry rules.

    Examples
    --------
    >>> import pandas as pd
    >>> info = pd.DataFrame({"lat": [48.85, 0.0], "lon": [2.35, 0.0]})
    >>> flag_sentinel_coordinates(info).tolist()
    [False, True]
    """
    require_columns(info, ["lat", "lon"], what="flag_sentinel_coordinates")
    lat = info["lat"].astype("float64")
    lon = info["lon"].astype("float64")
    return (lat.abs() < tol) & (lon.abs() < tol)