metrics

metrics

Metrics to assess the performance of transport networks.

Functions

Name Description
transport_performance Calculate the transport performance.

transport_performance

metrics.transport_performance(travel_times_path, centroid_gdf, pop_gdf, travel_time_threshold=45, distance_threshold=11.25, sources_col='from_id', destinations_col='to_id', backend='pandas', descriptive_stats=True, urban_centre_name=None, urban_centre_country=None, urban_centre_gdf=None)

Calculate the transport performance.

Parameters

Name Type Description Default
travel_times_path Union[str, pathlib.Path] File path or directory path to analyse_network output(s). Files must be in ‘.parquet’ format. required
centroid_gdf gpd.GeoDataFrame Cell centroid geometry. Output from RasterPop.get_pop(). required
pop_gdf gpd.GeoDataFrame Cell geometry with population estimates. Output from RasterPop.get_pop(). required
travel_time_threshold int Maximum threshold for travel times, by default 45 (minutes). Used when calculating accessibility. 45
distance_threshold Union[int, float] Maximum threshold for source/destination distance, by default 11.25 (km). Used when calculating accessibility and proximity. 11.25
sources_col str The sources column name in the travel time data, by default “from_id”. 'from_id'
destinations_col str The destinations column name in the travel time data, by default “to_id”. 'to_id'
backend str The ‘backend’ to use to calculate transport performance, by default “pandas”. Other backends not yet implemented. 'pandas'
descriptive_stats bool Calculate transport performance descriptive statistics and return them in a separate dataframe. By default True, means descriptive statistics will be calculated and returned. True
urban_centre_name str The urban centre name, by default None meaning the name will not be set. Only considered when descriptive_stats is True. None
urban_centre_country str The country in which the urban centre resides, by default None meaning the country will not be set. Only considered when descriptive_stats is True. None
urban_centre_gdf gpd.GeoDataFrame Output from UrbanCentre, containg the urban centre geometry information. By default None meaning the urban centre area will not be calculated. Only considered when descriptive_stats is True. None

Returns

Type Description
Tuple[pd.DataFrame, Optional[pd.DataFrame]] The first element of the tuple is the Transport performance metrics dataframe, grouped by destination column IDs. When descriptive_stats is True the second element will be the descriptive statistics output, otherwise this is None.

Raises

Type Description
ValueError When an invalid backend is provided.