From a425e0bce492ec87585af4ff1907c0e7b2e843b4 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 1 Nov 2024 02:31:45 +0000 Subject: [PATCH 01/13] speedmaps accessible by default! --- .../build_speedmaps_index.py | 2 +- ca_transit_speed_maps/speedmaps.ipynb | 1581 +---------------- ...dmaps__district_01-eureka__itp_id_18.ipynb | 4 +- ...maps__district_01-eureka__itp_id_108.ipynb | 4 +- ...maps__district_01-eureka__itp_id_135.ipynb | 4 +- ...maps__district_01-eureka__itp_id_159.ipynb | 4 +- ...aps__district_02-redding__itp_id_259.ipynb | 4 +- ...__district_03-marysville__itp_id_105.ipynb | 4 +- ...__district_03-marysville__itp_id_331.ipynb | 4 +- ...__district_03-marysville__itp_id_372.ipynb | 4 +- ...dmaps__district_04-oakland__itp_id_4.ipynb | 4 +- ...maps__district_04-oakland__itp_id_56.ipynb | 4 +- ...maps__district_04-oakland__itp_id_61.ipynb | 4 +- ...aps__district_04-oakland__itp_id_282.ipynb | 4 +- ...aps__district_04-oakland__itp_id_110.ipynb | 4 +- ...aps__district_04-oakland__itp_id_247.ipynb | 4 +- ...aps__district_04-oakland__itp_id_301.ipynb | 4 +- ...aps__district_04-oakland__itp_id_350.ipynb | 4 +- ...maps__district_04-oakland__itp_id_70.ipynb | 4 +- ...aps__district_04-oakland__itp_id_336.ipynb | 4 +- ...aps__district_04-oakland__itp_id_127.ipynb | 4 +- ...aps__district_04-oakland__itp_id_194.ipynb | 4 +- ...aps__district_04-oakland__itp_id_218.ipynb | 4 +- ...aps__district_04-oakland__itp_id_246.ipynb | 4 +- ...aps__district_04-oakland__itp_id_257.ipynb | 4 +- ...aps__district_04-oakland__itp_id_280.ipynb | 4 +- ...aps__district_04-oakland__itp_id_290.ipynb | 4 +- ...aps__district_04-oakland__itp_id_294.ipynb | 4 +- ...aps__district_04-oakland__itp_id_310.ipynb | 4 +- ...aps__district_04-oakland__itp_id_381.ipynb | 4 +- ...aps__district_04-oakland__itp_id_314.ipynb | 4 +- ...aps__district_04-oakland__itp_id_315.ipynb | 4 +- ...maps__district_04-oakland__itp_id_33.ipynb | 4 +- ...aps__district_04-oakland__itp_id_368.ipynb | 4 +- ...trict_05-san-luis-obispo__itp_id_298.ipynb | 4 +- ...trict_05-san-luis-obispo__itp_id_312.ipynb | 4 +- ...trict_05-san-luis-obispo__itp_id_208.ipynb | 4 +- ...trict_05-san-luis-obispo__itp_id_289.ipynb | 4 +- ...trict_05-san-luis-obispo__itp_id_296.ipynb | 4 +- ...maps__district_06-fresno__itp_id_116.ipynb | 4 +- ...maps__district_06-fresno__itp_id_361.ipynb | 4 +- ...maps__district_06-fresno__itp_id_126.ipynb | 4 +- ...maps__district_06-fresno__itp_id_148.ipynb | 4 +- ...maps__district_06-fresno__itp_id_188.ipynb | 4 +- ...__district_07-los-angeles__itp_id_16.ipynb | 4 +- ...__district_07-los-angeles__itp_id_45.ipynb | 4 +- ...__district_07-los-angeles__itp_id_54.ipynb | 4 +- ...__district_07-los-angeles__itp_id_87.ipynb | 4 +- ...__district_07-los-angeles__itp_id_97.ipynb | 4 +- ..._district_07-los-angeles__itp_id_183.ipynb | 4 +- ..._district_07-los-angeles__itp_id_210.ipynb | 4 +- ..._district_07-los-angeles__itp_id_228.ipynb | 4 +- ..._district_07-los-angeles__itp_id_231.ipynb | 4 +- ..._district_07-los-angeles__itp_id_243.ipynb | 4 +- ..._district_07-los-angeles__itp_id_260.ipynb | 4 +- ..._district_07-los-angeles__itp_id_295.ipynb | 4 +- ..._district_07-los-angeles__itp_id_300.ipynb | 4 +- ..._district_07-los-angeles__itp_id_308.ipynb | 4 +- ..._district_07-los-angeles__itp_id_337.ipynb | 4 +- ..._district_07-los-angeles__itp_id_339.ipynb | 4 +- ..._district_07-los-angeles__itp_id_112.ipynb | 4 +- ..._district_07-los-angeles__itp_id_123.ipynb | 4 +- ..._district_07-los-angeles__itp_id_182.ipynb | 4 +- ..._district_07-los-angeles__itp_id_380.ipynb | 4 +- ...istrict_08-san-bernardino__itp_id_34.ipynb | 4 +- ...strict_08-san-bernardino__itp_id_214.ipynb | 4 +- ...strict_08-san-bernardino__itp_id_232.ipynb | 4 +- ...strict_08-san-bernardino__itp_id_238.ipynb | 4 +- ...strict_08-san-bernardino__itp_id_269.ipynb | 4 +- ...strict_08-san-bernardino__itp_id_360.ipynb | 4 +- ...dmaps__district_09-bishop__itp_id_99.ipynb | 4 +- ...ps__district_10-stockton__itp_id_107.ipynb | 4 +- ...ps__district_10-stockton__itp_id_349.ipynb | 4 +- ...aps__district_10-stockton__itp_id_10.ipynb | 4 +- ...ps__district_10-stockton__itp_id_284.ipynb | 4 +- ...ps__district_10-stockton__itp_id_484.ipynb | 4 +- ...s__district_11-san-diego__itp_id_226.ipynb | 4 +- ...s__district_11-san-diego__itp_id_277.ipynb | 4 +- ...s__district_11-san-diego__itp_id_278.ipynb | 4 +- ...maps__district_12-irvine__itp_id_235.ipynb | 4 +- portfolio/sites/rt.yml | 1 + 81 files changed, 173 insertions(+), 1723 deletions(-) diff --git a/ca_transit_speed_maps/build_speedmaps_index.py b/ca_transit_speed_maps/build_speedmaps_index.py index 75b972450..baa2b454e 100644 --- a/ca_transit_speed_maps/build_speedmaps_index.py +++ b/ca_transit_speed_maps/build_speedmaps_index.py @@ -62,6 +62,6 @@ def build_speedmaps_index(analysis_date: dt.date, how: str = 'new') -> pd.DataFr if __name__ == "__main__": print(f'analysis date from shared_utils/rt_dates: {ANALYSIS_DATE}') - speedmaps_index = build_speedmaps_index(ANALYSIS_DATE) + speedmaps_index = build_speedmaps_index(ANALYSIS_DATE, how = 'old') # speedmaps_index = rt_utils.check_intermediate_data(speedmaps_index) speedmaps_index.to_parquet(PROGRESS_PATH) \ No newline at end of file diff --git a/ca_transit_speed_maps/speedmaps.ipynb b/ca_transit_speed_maps/speedmaps.ipynb index cdb8ed59e..857731d13 100644 --- a/ca_transit_speed_maps/speedmaps.ipynb +++ b/ca_transit_speed_maps/speedmaps.ipynb @@ -23,1498 +23,6 @@ { "cell_type": "code", "execution_count": 2, - "id": "aa3b6148-7a82-4c38-89f5-537983c34cf4", - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "89339475-3297-418a-8aba-932b1ee4f44e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "5480334a-7018-4fbd-87c5-0a3d74fcba00", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
organization_nameorganization_itp_idorganization_source_record_idcaltrans_district_is_currentanalysis_datestatus
0Nevada County221reczUcQgqgtMpkpKC03 - MarysvilleTrue2024-08-14parser_failed
1City of Rosemead270recKA7jKmdhFnj2ki07 - Los AngelesTrue2024-08-14map_failed
2City of Union City350recmB4uxrVLRXYF3L04 - OaklandTrue2024-08-14map_confirmed
3City of Elk Grove105recaJnArpFEk5QooE03 - MarysvilleTrue2024-08-14map_confirmed
4Capitol Corridor Joint Powers Authority56recvEBkSBc7UxlarC04 - OaklandTrue2024-08-14map_confirmed
5Golden Gate Bridge, Highway and Transportation...127recoX7qMhlPrgfuz304 - OaklandTrue2024-08-14map_confirmed
6Sonoma-Marin Area Rail Transit District315recUmm4gcNXaqrwpn04 - OaklandTrue2024-08-14map_confirmed
7Central Contra Costa Transit Authority61recjnaKVDEgulsko304 - OaklandTrue2024-08-14map_confirmed
8University of California, Berkeley33recD9x7GHPrN46v6m04 - OaklandTrue2024-08-14map_confirmed
9Solano County Transit310reclLbvvKE1V4zsZg04 - OaklandTrue2024-08-14map_confirmed
10Solano Transportation Authority381rec7ShjfgRPLU0yjY04 - OaklandTrue2024-08-14map_confirmed
11City of Santa Clarita295recImm5SmW2zq9rMT07 - Los AngelesTrue2024-08-14map_confirmed
12Monterey-Salinas Transit208receZJ9sEnP9vy3g005 - San Luis ObispoTrue2024-08-14map_confirmed
13City of Solvang312reckp33bhAuZlmO1M05 - San Luis ObispoTrue2024-08-14map_confirmed
14University of California, Davis351recS1JKEz73Hev8pJ03 - MarysvilleTrue2024-08-14map_failed
15Victor Valley Transit Authority360recJcXMNC5MUm2uDe08 - San BernardinoTrue2024-08-14map_confirmed
16San Mateo County Transit District290recw3mRsmKDTNnVlT04 - OaklandTrue2024-08-14map_confirmed
17Butte County Association of Governments48recf7l9tozKXOmqqZ03 - MarysvilleTrue2024-08-14parser_failed
18Kings County Area Public Transit Agency148rec5MLJKrAgeM8f6H06 - FresnoTrue2024-08-14map_confirmed
19City of Burbank45rec6z2ivjTxc8Sag307 - Los AngelesTrue2024-08-14map_confirmed
20Santa Barbara Metropolitan Transit District293recswCrw6a6htmXJ405 - San Luis ObispoTrue2024-08-14parser_failed
21Peninsula Corridor Joint Powers Board246rec2ErIfztLMJ4rgG04 - OaklandTrue2024-08-14map_confirmed
22Anaheim Transportation Network14recsrIZdx5Wt6n3ol12 - IrvineTrue2024-08-14map_failed
23City of Duarte97recZm8PD8WIdcDL0M07 - Los AngelesTrue2024-08-14map_confirmed
24Foothill Transit112recSqgaa8QiQ8CRjl07 - Los AngelesTrue2024-08-14map_confirmed
25City of Beaumont34reciWrBgYsAIm9eKK08 - San BernardinoTrue2024-08-14map_confirmed
26City of Santa Maria298rec9zGMJgNnes75K105 - San Luis ObispoTrue2024-08-14map_confirmed
27City of Santa Rosa301recsNvWvLQwGsoxlE04 - OaklandTrue2024-08-14map_confirmed
28Riverside Transit Agency269recYgajd92VLqio1p08 - San BernardinoTrue2024-08-14map_confirmed
29Commute.org76reczvlrgxLUDiBgAy04 - OaklandTrue2024-08-14parser_failed
30City of Santa Monica300recJHFDLpGRMIFgnL07 - Los AngelesFalse2024-08-14map_confirmed
31Golden Empire Transit District126recIh3vq8jwuuJlvL06 - FresnoTrue2024-08-14map_confirmed
32Western Contra Costa Transit Authority368recIKnsnTdKQ0vsiv04 - OaklandTrue2024-08-14map_confirmed
33Southern California Regional Rail Authority323rec7YtRySB7AsTfLw07 - Los AngelesTrue2024-08-14parser_failed
34City of Pasadena243reczF5Y8R9CUJmfSy07 - Los AngelesTrue2024-08-14map_confirmed
35City of Gardena118recX4nQfupRQf3xGD07 - Los AngelesTrue2024-08-14map_failed
36City of Escalon107recNeVOEwWUtYe8xm10 - StocktonTrue2024-08-14map_confirmed
37City of Torrance339recvzE9NXgGMmqcTH07 - Los AngelesTrue2024-08-14map_confirmed
38Santa Cruz Metropolitan Transit District296recDFXyxaWQpiY4mw05 - San Luis ObispoTrue2024-08-14map_confirmed
39Livermore-Amador Valley Transit Authority167recANs4M9yDhvDyob04 - OaklandTrue2024-08-14parser_failed
40Tulare County Regional Transit Agency474rec4YWVqVwJ9XqDbq06 - FresnoTrue2024-08-14map_failed
41City of Fairfield110recot6qBamlOoLcrM04 - OaklandTrue2024-08-14map_confirmed
42Los Angeles County Metropolitan Transportation...182recPnGkwdpnr8jmHB07 - Los AngelesTrue2024-08-14map_confirmed
43San Joaquin Regional Rail Commission10recpgYVeU3VePMeWx10 - StocktonTrue2024-08-14map_confirmed
44San Francisco Bay Area Rapid Transit District279recoQLeNRISCKF8I004 - OaklandTrue2024-08-14parser_failed
45Redwood Coast Transit Authority261recOnKhqF25crJt4q01 - EurekaTrue2024-08-14parser_failed
46Eastern Contra Costa Transit Authority336recEEJVeGrHGoTwgj04 - OaklandTrue2024-08-14map_confirmed
47City of Eureka108recynxkqEoo9dJEvw01 - EurekaTrue2024-08-14map_confirmed
48Humboldt Transit Authority135recaa3naoNR4a5RsJ01 - EurekaTrue2024-08-14map_confirmed
49City of Arcata18recaaoqEDvwhcmIVT01 - EurekaTrue2024-08-14map_confirmed
50Cloverdale Transit70recRM3c9Zfaft4V2B04 - OaklandTrue2024-08-14map_confirmed
51Sonoma County314recDupUxInMUgxeiz04 - OaklandTrue2024-08-14map_confirmed
52Tahoe Transportation District331rec3u4aMplqObcoTR03 - MarysvilleTrue2024-08-14map_confirmed
53City of San Luis Obispo287recMM99msxjmc6PPv05 - San Luis ObispoFalse2024-08-14parser_failed
54OmniTrans232recG5aXxDPI645S8608 - San BernardinoTrue2024-08-14map_confirmed
55Eastern Sierra Transit Authority99recRajLNJI206nnAr09 - BishopTrue2024-08-14map_confirmed
56City of Turlock349recmQVsPDG6sLtD6j10 - StocktonTrue2024-08-14map_confirmed
57City of Ojai231reckQmUdXUzHFmlVf07 - Los AngelesTrue2024-08-14map_confirmed
58Ventura County Transportation Commission380rec7EN71rsZxDFxZd07 - Los AngelesTrue2024-08-14map_confirmed
59Gold Coast Transit District123recS7GnKTcQVX20HE07 - Los AngelesTrue2024-08-14map_confirmed
60City of Simi Valley308rec1ErIn9gG1Isk5W07 - Los AngelesTrue2024-08-14map_confirmed
61City of Moorpark210recojKzQsBzE1hjVu07 - Los AngelesTrue2024-08-14map_confirmed
62City of Thousand Oaks337recPJULRJk1Yn824N07 - Los AngelesTrue2024-08-14map_confirmed
63City of Camarillo54recD4Vzt0EDC3VY7I07 - Los AngelesTrue2024-08-14map_confirmed
64City of Arcadia17recjaoK08lDmhjQga07 - Los AngelesTrue2024-08-14map_failed
65Mountain Area Regional Transit Authority214recHbquam1bWEwC3P08 - San BernardinoTrue2024-08-14map_confirmed
66Palo Verde Valley Transit Agency238recGcv4NidDjwVSiN08 - San BernardinoTrue2024-08-14map_confirmed
67Long Beach Transit170rec00qSzZL8KqiXAo07 - Los AngelesTrue2024-08-14parser_failed
68Lake Transit Authority159recPwXKbGLL4aIqXV01 - EurekaTrue2024-08-14map_confirmed
69City of Fresno116rec0bKUhHAajTNIlf06 - FresnoTrue2024-08-14map_confirmed
70Napa Valley Transportation Authority218rec9RGrya9SjWYp2p04 - OaklandTrue2024-08-14map_confirmed
71Stanislaus Regional Transit Authority484recSiaaMmBXW7fUZS10 - StocktonTrue2024-08-14map_confirmed
72Santa Clara Valley Transportation Authority294recC5CT95EufmQCXr04 - OaklandTrue2024-08-14map_confirmed
73San Diego Metropolitan Transit System278recZALk4vysuoTVjF11 - San DiegoTrue2024-08-14map_confirmed
74San Diego International Airport277recfbLFdDnCxgIfAB11 - San DiegoTrue2024-08-14map_confirmed
75San Joaquin Regional Transit District284recZgWVXkpix390of10 - StocktonTrue2024-08-14map_confirmed
76Orange County Transportation Authority235recfma7GNR5lQTTTg12 - IrvineTrue2024-08-14map_confirmed
77Yolo County Transportation District372recH2FdHvrL7nIpHA03 - MarysvilleTrue2024-08-14map_confirmed
78North County Transit District226recRBcrX4ZvTyvSnm11 - San DiegoTrue2024-08-14map_confirmed
79City of Norwalk228recPkUZgzjCjk5GrV07 - Los AngelesTrue2024-08-14map_confirmed
80City of Petaluma247recUbGDXhPdx3494b04 - OaklandTrue2024-08-14map_confirmed
81City of Commerce75recd0hxcumVMausDU07 - Los AngelesTrue2024-08-14map_failed
82Redding Area Bus Authority259recI1fuNpr306H0hw02 - ReddingTrue2024-08-14map_confirmed
83San Francisco International Airport281recd6X5l7vkBXk9hc04 - OaklandTrue2024-08-14parser_failed
84City and County of San Francisco282rechaapWbeffO33OX04 - OaklandTrue2024-08-14map_confirmed
85Transit Joint Powers Authority for Merced County343recVSX7dwjxAb557T10 - StocktonTrue2024-08-14parser_failed
86Antelope Valley Transit Authority16recxsWR0KRrQTdjmg07 - Los AngelesTrue2024-08-14map_confirmed
87City of Visalia361rec6gNibVKjDVy4aX06 - FresnoTrue2024-08-14map_confirmed
88Alameda-Contra Costa Transit District4recOZgevYf7Jimm9L04 - OaklandTrue2024-08-14map_confirmed
89City of Redondo Beach260rec8zhnCPETu6qEiH07 - Los AngelesTrue2024-08-14map_confirmed
90City of South San Francisco481recPtsCi89lKcXaTW04 - OaklandTrue2024-08-14parser_failed
91City of Culver City87rec5ome04BbA9uf4y07 - Los AngelesFalse2024-08-14map_confirmed
92City of Vacaville356recdujao2F9Hga9Od04 - OaklandTrue2024-08-14parser_failed
93Mendocino Transit Authority198recpWBEjXzLHqCjhE01 - EurekaTrue2024-08-14parser_failed
94Madera County188recWLwvtjXhiVWjKt06 - FresnoTrue2024-08-14map_confirmed
95City of Roseville271recUdTq5QiUjJRiAe03 - MarysvilleTrue2024-08-14parser_failed
96City of Rancho Cordova489rec43oyrfhtPDdRHj03 - MarysvilleTrue2024-08-14parser_failed
97Sacramento Regional Transit District273recX9lccSE1jmjsmG03 - MarysvilleTrue2024-08-14parser_failed
98San Francisco Bay Area Water Emergency Transit...280recmatCuQAUrNcs8j04 - OaklandTrue2024-08-14map_confirmed
99SunLine Transit Agency327recAsbHMwQWB7cri808 - San BernardinoTrue2024-08-14map_failed
100City of Rio Vista264recaUmi7EJdPiG06704 - OaklandTrue2024-08-14parser_failed
101City of Los Angeles183rec4pgjrmdhCh4z0107 - Los AngelesTrue2024-08-14map_confirmed
102City of Montebello206recohwwty1Jn4lnsb07 - Los AngelesTrue2024-08-14map_failed
103City of Monterey Park207reccAVEcMntkbh6aY07 - Los AngelesTrue2024-08-14map_failed
104Marin County Transit District194recNOb7pqBRlQVG5e04 - OaklandTrue2024-08-14map_confirmed
105City of West Hollywood367rec2LbE0IBKBAkvQr07 - Los AngelesTrue2024-08-14map_failed
106San Luis Obispo Regional Transit Authority289reciakGBN1DP9dK9N05 - San Luis ObispoTrue2024-08-14map_confirmed
107Presidio Trust257recsBfXgev9ICDCY104 - OaklandTrue2024-08-14map_confirmed
108City of Downey95rec21lizHh1D0uU0007 - Los AngelesTrue2024-08-14parser_failed
\n", - "
" - ], - "text/plain": [ - " organization_name organization_itp_id \\\n", - "0 Nevada County 221 \n", - "1 City of Rosemead 270 \n", - "2 City of Union City 350 \n", - "3 City of Elk Grove 105 \n", - "4 Capitol Corridor Joint Powers Authority 56 \n", - "5 Golden Gate Bridge, Highway and Transportation... 127 \n", - "6 Sonoma-Marin Area Rail Transit District 315 \n", - "7 Central Contra Costa Transit Authority 61 \n", - "8 University of California, Berkeley 33 \n", - "9 Solano County Transit 310 \n", - "10 Solano Transportation Authority 381 \n", - "11 City of Santa Clarita 295 \n", - "12 Monterey-Salinas Transit 208 \n", - "13 City of Solvang 312 \n", - "14 University of California, Davis 351 \n", - "15 Victor Valley Transit Authority 360 \n", - "16 San Mateo County Transit District 290 \n", - "17 Butte County Association of Governments 48 \n", - "18 Kings County Area Public Transit Agency 148 \n", - "19 City of Burbank 45 \n", - "20 Santa Barbara Metropolitan Transit District 293 \n", - "21 Peninsula Corridor Joint Powers Board 246 \n", - "22 Anaheim Transportation Network 14 \n", - "23 City of Duarte 97 \n", - "24 Foothill Transit 112 \n", - "25 City of Beaumont 34 \n", - "26 City of Santa Maria 298 \n", - "27 City of Santa Rosa 301 \n", - "28 Riverside Transit Agency 269 \n", - "29 Commute.org 76 \n", - "30 City of Santa Monica 300 \n", - "31 Golden Empire Transit District 126 \n", - "32 Western Contra Costa Transit Authority 368 \n", - "33 Southern California Regional Rail Authority 323 \n", - "34 City of Pasadena 243 \n", - "35 City of Gardena 118 \n", - "36 City of Escalon 107 \n", - "37 City of Torrance 339 \n", - "38 Santa Cruz Metropolitan Transit District 296 \n", - "39 Livermore-Amador Valley Transit Authority 167 \n", - "40 Tulare County Regional Transit Agency 474 \n", - "41 City of Fairfield 110 \n", - "42 Los Angeles County Metropolitan Transportation... 182 \n", - "43 San Joaquin Regional Rail Commission 10 \n", - "44 San Francisco Bay Area Rapid Transit District 279 \n", - "45 Redwood Coast Transit Authority 261 \n", - "46 Eastern Contra Costa Transit Authority 336 \n", - "47 City of Eureka 108 \n", - "48 Humboldt Transit Authority 135 \n", - "49 City of Arcata 18 \n", - "50 Cloverdale Transit 70 \n", - "51 Sonoma County 314 \n", - "52 Tahoe Transportation District 331 \n", - "53 City of San Luis Obispo 287 \n", - "54 OmniTrans 232 \n", - "55 Eastern Sierra Transit Authority 99 \n", - "56 City of Turlock 349 \n", - "57 City of Ojai 231 \n", - "58 Ventura County Transportation Commission 380 \n", - "59 Gold Coast Transit District 123 \n", - "60 City of Simi Valley 308 \n", - "61 City of Moorpark 210 \n", - "62 City of Thousand Oaks 337 \n", - "63 City of Camarillo 54 \n", - "64 City of Arcadia 17 \n", - "65 Mountain Area Regional Transit Authority 214 \n", - "66 Palo Verde Valley Transit Agency 238 \n", - "67 Long Beach Transit 170 \n", - "68 Lake Transit Authority 159 \n", - "69 City of Fresno 116 \n", - "70 Napa Valley Transportation Authority 218 \n", - "71 Stanislaus Regional Transit Authority 484 \n", - "72 Santa Clara Valley Transportation Authority 294 \n", - "73 San Diego Metropolitan Transit System 278 \n", - "74 San Diego International Airport 277 \n", - "75 San Joaquin Regional Transit District 284 \n", - "76 Orange County Transportation Authority 235 \n", - "77 Yolo County Transportation District 372 \n", - "78 North County Transit District 226 \n", - "79 City of Norwalk 228 \n", - "80 City of Petaluma 247 \n", - "81 City of Commerce 75 \n", - "82 Redding Area Bus Authority 259 \n", - "83 San Francisco International Airport 281 \n", - "84 City and County of San Francisco 282 \n", - "85 Transit Joint Powers Authority for Merced County 343 \n", - "86 Antelope Valley Transit Authority 16 \n", - "87 City of Visalia 361 \n", - "88 Alameda-Contra Costa Transit District 4 \n", - "89 City of Redondo Beach 260 \n", - "90 City of South San Francisco 481 \n", - "91 City of Culver City 87 \n", - "92 City of Vacaville 356 \n", - "93 Mendocino Transit Authority 198 \n", - "94 Madera County 188 \n", - "95 City of Roseville 271 \n", - "96 City of Rancho Cordova 489 \n", - "97 Sacramento Regional Transit District 273 \n", - "98 San Francisco Bay Area Water Emergency Transit... 280 \n", - "99 SunLine Transit Agency 327 \n", - "100 City of Rio Vista 264 \n", - "101 City of Los Angeles 183 \n", - "102 City of Montebello 206 \n", - "103 City of Monterey Park 207 \n", - "104 Marin County Transit District 194 \n", - "105 City of West Hollywood 367 \n", - "106 San Luis Obispo Regional Transit Authority 289 \n", - "107 Presidio Trust 257 \n", - "108 City of Downey 95 \n", - "\n", - " organization_source_record_id caltrans_district _is_current \\\n", - "0 reczUcQgqgtMpkpKC 03 - Marysville True \n", - "1 recKA7jKmdhFnj2ki 07 - Los Angeles True \n", - "2 recmB4uxrVLRXYF3L 04 - Oakland True \n", - "3 recaJnArpFEk5QooE 03 - Marysville True \n", - "4 recvEBkSBc7UxlarC 04 - Oakland True \n", - "5 recoX7qMhlPrgfuz3 04 - Oakland True \n", - "6 recUmm4gcNXaqrwpn 04 - Oakland True \n", - "7 recjnaKVDEgulsko3 04 - Oakland True \n", - "8 recD9x7GHPrN46v6m 04 - Oakland True \n", - "9 reclLbvvKE1V4zsZg 04 - Oakland True \n", - "10 rec7ShjfgRPLU0yjY 04 - Oakland True \n", - "11 recImm5SmW2zq9rMT 07 - Los Angeles True \n", - "12 receZJ9sEnP9vy3g0 05 - San Luis Obispo True \n", - "13 reckp33bhAuZlmO1M 05 - San Luis Obispo True \n", - "14 recS1JKEz73Hev8pJ 03 - Marysville True \n", - "15 recJcXMNC5MUm2uDe 08 - San Bernardino True \n", - "16 recw3mRsmKDTNnVlT 04 - Oakland True \n", - "17 recf7l9tozKXOmqqZ 03 - Marysville True \n", - "18 rec5MLJKrAgeM8f6H 06 - Fresno True \n", - "19 rec6z2ivjTxc8Sag3 07 - Los Angeles True \n", - "20 recswCrw6a6htmXJ4 05 - San Luis Obispo True \n", - "21 rec2ErIfztLMJ4rgG 04 - Oakland True \n", - "22 recsrIZdx5Wt6n3ol 12 - Irvine True \n", - "23 recZm8PD8WIdcDL0M 07 - Los Angeles True \n", - "24 recSqgaa8QiQ8CRjl 07 - Los Angeles True \n", - "25 reciWrBgYsAIm9eKK 08 - San Bernardino True \n", - "26 rec9zGMJgNnes75K1 05 - San Luis Obispo True \n", - "27 recsNvWvLQwGsoxlE 04 - Oakland True \n", - "28 recYgajd92VLqio1p 08 - San Bernardino True \n", - "29 reczvlrgxLUDiBgAy 04 - Oakland True \n", - "30 recJHFDLpGRMIFgnL 07 - Los Angeles False \n", - "31 recIh3vq8jwuuJlvL 06 - Fresno True \n", - "32 recIKnsnTdKQ0vsiv 04 - Oakland True \n", - "33 rec7YtRySB7AsTfLw 07 - Los Angeles True \n", - "34 reczF5Y8R9CUJmfSy 07 - Los Angeles True \n", - "35 recX4nQfupRQf3xGD 07 - Los Angeles True \n", - "36 recNeVOEwWUtYe8xm 10 - Stockton True \n", - "37 recvzE9NXgGMmqcTH 07 - Los Angeles True \n", - "38 recDFXyxaWQpiY4mw 05 - San Luis Obispo True \n", - "39 recANs4M9yDhvDyob 04 - Oakland True \n", - "40 rec4YWVqVwJ9XqDbq 06 - Fresno True \n", - "41 recot6qBamlOoLcrM 04 - Oakland True \n", - "42 recPnGkwdpnr8jmHB 07 - Los Angeles True \n", - "43 recpgYVeU3VePMeWx 10 - Stockton True \n", - "44 recoQLeNRISCKF8I0 04 - Oakland True \n", - "45 recOnKhqF25crJt4q 01 - Eureka True \n", - "46 recEEJVeGrHGoTwgj 04 - Oakland True \n", - "47 recynxkqEoo9dJEvw 01 - Eureka True \n", - "48 recaa3naoNR4a5RsJ 01 - Eureka True \n", - "49 recaaoqEDvwhcmIVT 01 - Eureka True \n", - "50 recRM3c9Zfaft4V2B 04 - Oakland True \n", - "51 recDupUxInMUgxeiz 04 - Oakland True \n", - "52 rec3u4aMplqObcoTR 03 - Marysville True \n", - "53 recMM99msxjmc6PPv 05 - San Luis Obispo False \n", - "54 recG5aXxDPI645S86 08 - San Bernardino True \n", - "55 recRajLNJI206nnAr 09 - Bishop True \n", - "56 recmQVsPDG6sLtD6j 10 - Stockton True \n", - "57 reckQmUdXUzHFmlVf 07 - Los Angeles True \n", - "58 rec7EN71rsZxDFxZd 07 - Los Angeles True \n", - "59 recS7GnKTcQVX20HE 07 - Los Angeles True \n", - "60 rec1ErIn9gG1Isk5W 07 - Los Angeles True \n", - "61 recojKzQsBzE1hjVu 07 - Los Angeles True \n", - "62 recPJULRJk1Yn824N 07 - Los Angeles True \n", - "63 recD4Vzt0EDC3VY7I 07 - Los Angeles True \n", - "64 recjaoK08lDmhjQga 07 - Los Angeles True \n", - "65 recHbquam1bWEwC3P 08 - San Bernardino True \n", - "66 recGcv4NidDjwVSiN 08 - San Bernardino True \n", - "67 rec00qSzZL8KqiXAo 07 - Los Angeles True \n", - "68 recPwXKbGLL4aIqXV 01 - Eureka True \n", - "69 rec0bKUhHAajTNIlf 06 - Fresno True \n", - "70 rec9RGrya9SjWYp2p 04 - Oakland True \n", - "71 recSiaaMmBXW7fUZS 10 - Stockton True \n", - "72 recC5CT95EufmQCXr 04 - Oakland True \n", - "73 recZALk4vysuoTVjF 11 - San Diego True \n", - "74 recfbLFdDnCxgIfAB 11 - San Diego True \n", - "75 recZgWVXkpix390of 10 - Stockton True \n", - "76 recfma7GNR5lQTTTg 12 - Irvine True \n", - "77 recH2FdHvrL7nIpHA 03 - Marysville True \n", - "78 recRBcrX4ZvTyvSnm 11 - San Diego True \n", - "79 recPkUZgzjCjk5GrV 07 - Los Angeles True \n", - "80 recUbGDXhPdx3494b 04 - Oakland True \n", - "81 recd0hxcumVMausDU 07 - Los Angeles True \n", - "82 recI1fuNpr306H0hw 02 - Redding True \n", - "83 recd6X5l7vkBXk9hc 04 - Oakland True \n", - "84 rechaapWbeffO33OX 04 - Oakland True \n", - "85 recVSX7dwjxAb557T 10 - Stockton True \n", - "86 recxsWR0KRrQTdjmg 07 - Los Angeles True \n", - "87 rec6gNibVKjDVy4aX 06 - Fresno True \n", - "88 recOZgevYf7Jimm9L 04 - Oakland True \n", - "89 rec8zhnCPETu6qEiH 07 - Los Angeles True \n", - "90 recPtsCi89lKcXaTW 04 - Oakland True \n", - "91 rec5ome04BbA9uf4y 07 - Los Angeles False \n", - "92 recdujao2F9Hga9Od 04 - Oakland True \n", - "93 recpWBEjXzLHqCjhE 01 - Eureka True \n", - "94 recWLwvtjXhiVWjKt 06 - Fresno True \n", - "95 recUdTq5QiUjJRiAe 03 - Marysville True \n", - "96 rec43oyrfhtPDdRHj 03 - Marysville True \n", - "97 recX9lccSE1jmjsmG 03 - Marysville True \n", - "98 recmatCuQAUrNcs8j 04 - Oakland True \n", - "99 recAsbHMwQWB7cri8 08 - San Bernardino True \n", - "100 recaUmi7EJdPiG067 04 - Oakland True \n", - "101 rec4pgjrmdhCh4z01 07 - Los Angeles True \n", - "102 recohwwty1Jn4lnsb 07 - Los Angeles True \n", - "103 reccAVEcMntkbh6aY 07 - Los Angeles True \n", - "104 recNOb7pqBRlQVG5e 04 - Oakland True \n", - "105 rec2LbE0IBKBAkvQr 07 - Los Angeles True \n", - "106 reciakGBN1DP9dK9N 05 - San Luis Obispo True \n", - "107 recsBfXgev9ICDCY1 04 - Oakland True \n", - "108 rec21lizHh1D0uU00 07 - Los Angeles True \n", - "\n", - " analysis_date status \n", - "0 2024-08-14 parser_failed \n", - "1 2024-08-14 map_failed \n", - "2 2024-08-14 map_confirmed \n", - "3 2024-08-14 map_confirmed \n", - "4 2024-08-14 map_confirmed \n", - "5 2024-08-14 map_confirmed \n", - "6 2024-08-14 map_confirmed \n", - "7 2024-08-14 map_confirmed \n", - "8 2024-08-14 map_confirmed \n", - "9 2024-08-14 map_confirmed \n", - "10 2024-08-14 map_confirmed \n", - "11 2024-08-14 map_confirmed \n", - "12 2024-08-14 map_confirmed \n", - "13 2024-08-14 map_confirmed \n", - "14 2024-08-14 map_failed \n", - "15 2024-08-14 map_confirmed \n", - "16 2024-08-14 map_confirmed \n", - "17 2024-08-14 parser_failed \n", - "18 2024-08-14 map_confirmed \n", - "19 2024-08-14 map_confirmed \n", - "20 2024-08-14 parser_failed \n", - "21 2024-08-14 map_confirmed \n", - "22 2024-08-14 map_failed \n", - "23 2024-08-14 map_confirmed \n", - "24 2024-08-14 map_confirmed \n", - "25 2024-08-14 map_confirmed \n", - "26 2024-08-14 map_confirmed \n", - "27 2024-08-14 map_confirmed \n", - "28 2024-08-14 map_confirmed \n", - "29 2024-08-14 parser_failed \n", - "30 2024-08-14 map_confirmed \n", - "31 2024-08-14 map_confirmed \n", - "32 2024-08-14 map_confirmed \n", - "33 2024-08-14 parser_failed \n", - "34 2024-08-14 map_confirmed \n", - "35 2024-08-14 map_failed \n", - "36 2024-08-14 map_confirmed \n", - "37 2024-08-14 map_confirmed \n", - "38 2024-08-14 map_confirmed \n", - "39 2024-08-14 parser_failed \n", - "40 2024-08-14 map_failed \n", - "41 2024-08-14 map_confirmed \n", - "42 2024-08-14 map_confirmed \n", - "43 2024-08-14 map_confirmed \n", - "44 2024-08-14 parser_failed \n", - "45 2024-08-14 parser_failed \n", - "46 2024-08-14 map_confirmed \n", - "47 2024-08-14 map_confirmed \n", - "48 2024-08-14 map_confirmed \n", - "49 2024-08-14 map_confirmed \n", - "50 2024-08-14 map_confirmed \n", - "51 2024-08-14 map_confirmed \n", - "52 2024-08-14 map_confirmed \n", - "53 2024-08-14 parser_failed \n", - "54 2024-08-14 map_confirmed \n", - "55 2024-08-14 map_confirmed \n", - "56 2024-08-14 map_confirmed \n", - "57 2024-08-14 map_confirmed \n", - "58 2024-08-14 map_confirmed \n", - "59 2024-08-14 map_confirmed \n", - "60 2024-08-14 map_confirmed \n", - "61 2024-08-14 map_confirmed \n", - "62 2024-08-14 map_confirmed \n", - "63 2024-08-14 map_confirmed \n", - "64 2024-08-14 map_failed \n", - "65 2024-08-14 map_confirmed \n", - "66 2024-08-14 map_confirmed \n", - "67 2024-08-14 parser_failed \n", - "68 2024-08-14 map_confirmed \n", - "69 2024-08-14 map_confirmed \n", - "70 2024-08-14 map_confirmed \n", - "71 2024-08-14 map_confirmed \n", - "72 2024-08-14 map_confirmed \n", - "73 2024-08-14 map_confirmed \n", - "74 2024-08-14 map_confirmed \n", - "75 2024-08-14 map_confirmed \n", - "76 2024-08-14 map_confirmed \n", - "77 2024-08-14 map_confirmed \n", - "78 2024-08-14 map_confirmed \n", - "79 2024-08-14 map_confirmed \n", - "80 2024-08-14 map_confirmed \n", - "81 2024-08-14 map_failed \n", - "82 2024-08-14 map_confirmed \n", - "83 2024-08-14 parser_failed \n", - "84 2024-08-14 map_confirmed \n", - "85 2024-08-14 parser_failed \n", - "86 2024-08-14 map_confirmed \n", - "87 2024-08-14 map_confirmed \n", - "88 2024-08-14 map_confirmed \n", - "89 2024-08-14 map_confirmed \n", - "90 2024-08-14 parser_failed \n", - "91 2024-08-14 map_confirmed \n", - "92 2024-08-14 parser_failed \n", - "93 2024-08-14 parser_failed \n", - "94 2024-08-14 map_confirmed \n", - "95 2024-08-14 parser_failed \n", - "96 2024-08-14 parser_failed \n", - "97 2024-08-14 parser_failed \n", - "98 2024-08-14 map_confirmed \n", - "99 2024-08-14 map_failed \n", - "100 2024-08-14 parser_failed \n", - "101 2024-08-14 map_confirmed \n", - "102 2024-08-14 map_failed \n", - "103 2024-08-14 map_failed \n", - "104 2024-08-14 map_confirmed \n", - "105 2024-08-14 map_failed \n", - "106 2024-08-14 map_confirmed \n", - "107 2024-08-14 map_confirmed \n", - "108 2024-08-14 parser_failed " - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "shared_utils.rt_utils.show_full_df(pd.read_parquet('_rt_progress_2024-08-14.parquet'))" - ] - }, - { - "cell_type": "code", - "execution_count": 18, "id": "9f15ed6a-5ab7-4f57-9695-3f762781b74c", "metadata": { "tags": [ @@ -1524,12 +32,12 @@ "outputs": [], "source": [ "## parameters cell\n", - "itp_id = 48" + "itp_id = 170" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 5, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], @@ -1541,15 +49,25 @@ "elif itp_id == 170:\n", " analysis_date = shared_utils.rt_dates.DATES['may2024']\n", "elif itp_id == 48:\n", - " analysis_date = shared_utils.rt_dates.DATES['mar2024']" + " analysis_date = shared_utils.rt_dates.DATES['mar2024']\n", + "\n", + "if type(analysis_date) == str: analysis_date = dt.date.fromisoformat(analysis_date)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "47c79d99-c82f-4e1e-b11e-2b1e83c13a1b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\"human_date\": \"May 22 2024 (Wednesday)\"}\n" + ] + } + ], "source": [ "%%capture_parameters\n", "human_date = analysis_date.strftime('%B %d %Y (%A)')\n", @@ -1661,29 +179,6 @@ "rt_day.map_gz_export(access_cmap=True)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ae4a2e32-9258-4881-869c-b4a5995d6e9e", - "metadata": {}, - "outputs": [], - "source": [ - "rt_day.render_spa_link(text='Colorblind Safe Map')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1fb98926-11f6-47f5-b54c-dcc305668caf", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "%%capture\n", - "rt_day.map_gz_export()" - ] - }, { "cell_type": "code", "execution_count": null, @@ -1815,29 +310,6 @@ "rt_day.map_gz_export(access_cmap=True)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c58c59b-3669-4aaa-8773-c7e75b8b5be2", - "metadata": {}, - "outputs": [], - "source": [ - "rt_day.render_spa_link(text='Colorblind Safe Map')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "72419146-46bc-42c6-8478-ccd6cebea18d", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "%%capture\n", - "rt_day.map_gz_export()" - ] - }, { "cell_type": "code", "execution_count": null, @@ -1969,29 +441,6 @@ "rt_day.map_gz_export(access_cmap=True)" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "da6d778e-53c5-4759-bcba-100298afdd7f", - "metadata": {}, - "outputs": [], - "source": [ - "rt_day.render_spa_link(text='Colorblind Safe Map')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "af6d23ea-4f20-4d0f-9855-40c43052c8e5", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "%%capture\n", - "rt_day.map_gz_export()" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/portfolio/rt/district_01-eureka/00__speedmaps__district_01-eureka__itp_id_18.ipynb b/portfolio/rt/district_01-eureka/00__speedmaps__district_01-eureka__itp_id_18.ipynb index cfd3685b3..97c580a49 100644 --- a/portfolio/rt/district_01-eureka/00__speedmaps__district_01-eureka__itp_id_18.ipynb +++ b/portfolio/rt/district_01-eureka/00__speedmaps__district_01-eureka__itp_id_18.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0db9ce98ad22b4c30dcc285aabccad3ee8dc94ba34ca65d71252f7f852febf06 -size 89018 +oid sha256:6dbbba50e732f37bd28fd9200f081ce2f04184ea76b48ecce9878f37883001be +size 71403 diff --git a/portfolio/rt/district_01-eureka/01__speedmaps__district_01-eureka__itp_id_108.ipynb b/portfolio/rt/district_01-eureka/01__speedmaps__district_01-eureka__itp_id_108.ipynb index 70bfbc35b..9a913d017 100644 --- a/portfolio/rt/district_01-eureka/01__speedmaps__district_01-eureka__itp_id_108.ipynb +++ b/portfolio/rt/district_01-eureka/01__speedmaps__district_01-eureka__itp_id_108.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1f88bfb433535cd41dbaa1267ce84f6760ec4505dfd1a79f3864464b3a82458 -size 89023 +oid sha256:9326a1d34984fca32e5ca363f7de97d078799466595010f86c682677052cdef9 +size 71411 diff --git a/portfolio/rt/district_01-eureka/02__speedmaps__district_01-eureka__itp_id_135.ipynb b/portfolio/rt/district_01-eureka/02__speedmaps__district_01-eureka__itp_id_135.ipynb index 4b7556242..86f36eb62 100644 --- a/portfolio/rt/district_01-eureka/02__speedmaps__district_01-eureka__itp_id_135.ipynb +++ b/portfolio/rt/district_01-eureka/02__speedmaps__district_01-eureka__itp_id_135.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:34db41063bcb1c20e7e288a156affe46d153b3875f20f6da07352569de000e0c -size 89289 +oid sha256:0147672cad08a97ac96e7d12cd58f304eb975261c58028cd4ff1276621daa231 +size 71626 diff --git a/portfolio/rt/district_01-eureka/03__speedmaps__district_01-eureka__itp_id_159.ipynb b/portfolio/rt/district_01-eureka/03__speedmaps__district_01-eureka__itp_id_159.ipynb index 4682a485b..14c547a3f 100644 --- a/portfolio/rt/district_01-eureka/03__speedmaps__district_01-eureka__itp_id_159.ipynb +++ b/portfolio/rt/district_01-eureka/03__speedmaps__district_01-eureka__itp_id_159.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ac3ba9e35b232442252f1f810ed052cbf4e5c449205559fa57ed899fed9dc02 -size 91177 +oid sha256:e51ceb45158aca0884c733575f100494e7efa2dc4e4bddf48448fd821ae2e320 +size 73528 diff --git a/portfolio/rt/district_02-redding/00__speedmaps__district_02-redding__itp_id_259.ipynb b/portfolio/rt/district_02-redding/00__speedmaps__district_02-redding__itp_id_259.ipynb index fcb6a3e51..b67c04d45 100644 --- a/portfolio/rt/district_02-redding/00__speedmaps__district_02-redding__itp_id_259.ipynb +++ b/portfolio/rt/district_02-redding/00__speedmaps__district_02-redding__itp_id_259.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1bc4dfd1dc8ca329630c4c79acbb3d914d5f73a956fe15c241f9d3e37eb2a1de -size 92444 +oid sha256:7371e8831923db7f22eb4e4f28e264a15331a9f5ab8293ce8e392899444efd4f +size 74776 diff --git a/portfolio/rt/district_03-marysville/00__speedmaps__district_03-marysville__itp_id_105.ipynb b/portfolio/rt/district_03-marysville/00__speedmaps__district_03-marysville__itp_id_105.ipynb index e654d537b..5ddc1c8d0 100644 --- a/portfolio/rt/district_03-marysville/00__speedmaps__district_03-marysville__itp_id_105.ipynb +++ b/portfolio/rt/district_03-marysville/00__speedmaps__district_03-marysville__itp_id_105.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ab028cb7ff31f6b372514139933395fa3d204c6612a63011eec6c37768dd2cc -size 91836 +oid sha256:d97f43cca9c3c062b239b84e2f0cc1785c12864421e0e30f05ccc5fd30bdda97 +size 74208 diff --git a/portfolio/rt/district_03-marysville/01__speedmaps__district_03-marysville__itp_id_331.ipynb b/portfolio/rt/district_03-marysville/01__speedmaps__district_03-marysville__itp_id_331.ipynb index e132e3dbe..70cc01002 100644 --- a/portfolio/rt/district_03-marysville/01__speedmaps__district_03-marysville__itp_id_331.ipynb +++ b/portfolio/rt/district_03-marysville/01__speedmaps__district_03-marysville__itp_id_331.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ca1247e250c05bdb997b5600ac5f94e7422db5d637bd62206a8b2ab54a51ac4 -size 92006 +oid sha256:e77271e96cb7821e853b051e32182632aa55be00943d8f0b440a9bb3af7ca878 +size 74320 diff --git a/portfolio/rt/district_03-marysville/02__speedmaps__district_03-marysville__itp_id_372.ipynb b/portfolio/rt/district_03-marysville/02__speedmaps__district_03-marysville__itp_id_372.ipynb index 5814e8f26..6461308f2 100644 --- a/portfolio/rt/district_03-marysville/02__speedmaps__district_03-marysville__itp_id_372.ipynb +++ b/portfolio/rt/district_03-marysville/02__speedmaps__district_03-marysville__itp_id_372.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4283e9628535513ed63a5d79fe886adbda19aee3462413236b675d80c585b13 -size 89511 +oid sha256:72cbf32333134ea67389cdc039c9710b6ea97fe37ff7a140f31228e12692a144 +size 71803 diff --git a/portfolio/rt/district_04-oakland/00__speedmaps__district_04-oakland__itp_id_4.ipynb b/portfolio/rt/district_04-oakland/00__speedmaps__district_04-oakland__itp_id_4.ipynb index ad4f5673b..b2ab069d0 100644 --- a/portfolio/rt/district_04-oakland/00__speedmaps__district_04-oakland__itp_id_4.ipynb +++ b/portfolio/rt/district_04-oakland/00__speedmaps__district_04-oakland__itp_id_4.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:de244c401a4b2def3e0c2b2298a9ab51189f46679d283ab0a4b494b2a40f48f3 -size 89389 +oid sha256:a6c05aa4c9e4f64b69b5ca6283f95eed579feeeb578609861e4aa2ff937f9879 +size 71690 diff --git a/portfolio/rt/district_04-oakland/01__speedmaps__district_04-oakland__itp_id_56.ipynb b/portfolio/rt/district_04-oakland/01__speedmaps__district_04-oakland__itp_id_56.ipynb index 60ab822aa..84545e81b 100644 --- a/portfolio/rt/district_04-oakland/01__speedmaps__district_04-oakland__itp_id_56.ipynb +++ b/portfolio/rt/district_04-oakland/01__speedmaps__district_04-oakland__itp_id_56.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dacf2236addd155c05f5ab110b2ad8a30480c51ef416e18ed2cbd966187cc608 -size 90573 +oid sha256:80257edece1b45453b4e5032a3522fe28e3687466f906923c4dc7d5610d53d72 +size 72853 diff --git a/portfolio/rt/district_04-oakland/02__speedmaps__district_04-oakland__itp_id_61.ipynb b/portfolio/rt/district_04-oakland/02__speedmaps__district_04-oakland__itp_id_61.ipynb index 456a3cdc4..fea04d1fe 100644 --- a/portfolio/rt/district_04-oakland/02__speedmaps__district_04-oakland__itp_id_61.ipynb +++ b/portfolio/rt/district_04-oakland/02__speedmaps__district_04-oakland__itp_id_61.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1425f21aa560d9df3d23d4eadd1d8c8a5d800c3883c3bb478c6ba8883357fedd -size 90511 +oid sha256:4eefa759c7f700dc18025895b90b1b8508e8fcd617f6c78519dd9e54652f2d42 +size 72788 diff --git a/portfolio/rt/district_04-oakland/03__speedmaps__district_04-oakland__itp_id_282.ipynb b/portfolio/rt/district_04-oakland/03__speedmaps__district_04-oakland__itp_id_282.ipynb index bd6a6d93a..b2d0724c5 100644 --- a/portfolio/rt/district_04-oakland/03__speedmaps__district_04-oakland__itp_id_282.ipynb +++ b/portfolio/rt/district_04-oakland/03__speedmaps__district_04-oakland__itp_id_282.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0057bc550ed36307e58b97be99c9dd4873acaf3d79127ccd519890a0be36ea4 -size 88305 +oid sha256:9275a6713c5ace92e989aab41f6ec6c952eb6a49b0df9f28125bf5d5fdf4fbba +size 70619 diff --git a/portfolio/rt/district_04-oakland/04__speedmaps__district_04-oakland__itp_id_110.ipynb b/portfolio/rt/district_04-oakland/04__speedmaps__district_04-oakland__itp_id_110.ipynb index 4682f2126..8bd7fa4df 100644 --- a/portfolio/rt/district_04-oakland/04__speedmaps__district_04-oakland__itp_id_110.ipynb +++ b/portfolio/rt/district_04-oakland/04__speedmaps__district_04-oakland__itp_id_110.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3abbce56559c599077aa0615c0bc045d57b828d2fc38741e1e3fcbe3e17c6f9b -size 88916 +oid sha256:4d27281f4e0dc481f462f4f8715d5e51a18375038327084a97b8e77d2e25cbd7 +size 71293 diff --git a/portfolio/rt/district_04-oakland/05__speedmaps__district_04-oakland__itp_id_247.ipynb b/portfolio/rt/district_04-oakland/05__speedmaps__district_04-oakland__itp_id_247.ipynb index 2fb6c8055..5f40a04be 100644 --- a/portfolio/rt/district_04-oakland/05__speedmaps__district_04-oakland__itp_id_247.ipynb +++ b/portfolio/rt/district_04-oakland/05__speedmaps__district_04-oakland__itp_id_247.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f7cc21fd6e76c7ced14f607078a183264e55f099672a210956da0a871bde0945 -size 91289 +oid sha256:f14d73d8d6439b3840dc1e0217291c54963623e8440ca118651d5995f680babe +size 73661 diff --git a/portfolio/rt/district_04-oakland/06__speedmaps__district_04-oakland__itp_id_301.ipynb b/portfolio/rt/district_04-oakland/06__speedmaps__district_04-oakland__itp_id_301.ipynb index 75d742030..54c0ee71b 100644 --- a/portfolio/rt/district_04-oakland/06__speedmaps__district_04-oakland__itp_id_301.ipynb +++ b/portfolio/rt/district_04-oakland/06__speedmaps__district_04-oakland__itp_id_301.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0e6bd8bbcea7be4fc82c2324509cf9496cf27ce5c0ba0121eaca9d0aca06f4c1 -size 88947 +oid sha256:7622c7af6e3aa8f4b8e464d8374bb4fafa26edb862679649586c0cee9a34f2bd +size 71313 diff --git a/portfolio/rt/district_04-oakland/07__speedmaps__district_04-oakland__itp_id_350.ipynb b/portfolio/rt/district_04-oakland/07__speedmaps__district_04-oakland__itp_id_350.ipynb index d75ad5049..129ca72d8 100644 --- a/portfolio/rt/district_04-oakland/07__speedmaps__district_04-oakland__itp_id_350.ipynb +++ b/portfolio/rt/district_04-oakland/07__speedmaps__district_04-oakland__itp_id_350.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:760c331f2cd877808c7396fdbb324ef5e3ebf8a913c4863f73c7bd3413482b91 -size 90101 +oid sha256:124a1d2da1c938710359fa45b3930a92ae332e1f7f79888e797f053e8480ff0c +size 72472 diff --git a/portfolio/rt/district_04-oakland/08__speedmaps__district_04-oakland__itp_id_70.ipynb b/portfolio/rt/district_04-oakland/08__speedmaps__district_04-oakland__itp_id_70.ipynb index 035253a51..33b993edc 100644 --- a/portfolio/rt/district_04-oakland/08__speedmaps__district_04-oakland__itp_id_70.ipynb +++ b/portfolio/rt/district_04-oakland/08__speedmaps__district_04-oakland__itp_id_70.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:060a131b777c5f10d7204c618a78bea92e468a1ab620e55bac7c6d9c1d5127af -size 88567 +oid sha256:db43c3c9cf003c95067e8365141280b190db8dfd224c26a712301cea95594579 +size 70921 diff --git a/portfolio/rt/district_04-oakland/09__speedmaps__district_04-oakland__itp_id_336.ipynb b/portfolio/rt/district_04-oakland/09__speedmaps__district_04-oakland__itp_id_336.ipynb index 8b0190667..dbfcea85f 100644 --- a/portfolio/rt/district_04-oakland/09__speedmaps__district_04-oakland__itp_id_336.ipynb +++ b/portfolio/rt/district_04-oakland/09__speedmaps__district_04-oakland__itp_id_336.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2fcc80cbce9b30720266721ad3bc27eeb3094f96eb214dd0544791f23991730 -size 89983 +oid sha256:b4d125d2b4914da1beb1e4a9c63056de065f33a270066af31a19bf8347a48c28 +size 72263 diff --git a/portfolio/rt/district_04-oakland/10__speedmaps__district_04-oakland__itp_id_127.ipynb b/portfolio/rt/district_04-oakland/10__speedmaps__district_04-oakland__itp_id_127.ipynb index e41a7dccb..4508029b8 100644 --- a/portfolio/rt/district_04-oakland/10__speedmaps__district_04-oakland__itp_id_127.ipynb +++ b/portfolio/rt/district_04-oakland/10__speedmaps__district_04-oakland__itp_id_127.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3c826f37f677a2b5b4c6cf37b10040962e36bf3ad9186c5b6ec8ed121de2c28 -size 93555 +oid sha256:57f2d98e8233f4e7b4d66477f97e1668ab71400564e2a5187de26e33f4252a69 +size 75769 diff --git a/portfolio/rt/district_04-oakland/11__speedmaps__district_04-oakland__itp_id_194.ipynb b/portfolio/rt/district_04-oakland/11__speedmaps__district_04-oakland__itp_id_194.ipynb index 726a2e582..d04a912f0 100644 --- a/portfolio/rt/district_04-oakland/11__speedmaps__district_04-oakland__itp_id_194.ipynb +++ b/portfolio/rt/district_04-oakland/11__speedmaps__district_04-oakland__itp_id_194.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f8216c822dc764b4547d3ceec63c47d44654f44c3eb903c8afaff187892a47fe -size 90287 +oid sha256:348d2d4d2d0c6845712421ae269367a6da2509d101923de0c93aef58ed358243 +size 72592 diff --git a/portfolio/rt/district_04-oakland/12__speedmaps__district_04-oakland__itp_id_218.ipynb b/portfolio/rt/district_04-oakland/12__speedmaps__district_04-oakland__itp_id_218.ipynb index 404fe4611..5dbaef066 100644 --- a/portfolio/rt/district_04-oakland/12__speedmaps__district_04-oakland__itp_id_218.ipynb +++ b/portfolio/rt/district_04-oakland/12__speedmaps__district_04-oakland__itp_id_218.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:830bfee5bc375d6db4ec31def9767d722806cc8940bd9c12b6013e9601cd6204 -size 92181 +oid sha256:5cb1f2f8f9da058859edd0b0a8a4ddca3799011e5bde99886995c8bc3cb03f80 +size 74480 diff --git a/portfolio/rt/district_04-oakland/13__speedmaps__district_04-oakland__itp_id_246.ipynb b/portfolio/rt/district_04-oakland/13__speedmaps__district_04-oakland__itp_id_246.ipynb index 93e3ef12b..8b6bcd4f1 100644 --- a/portfolio/rt/district_04-oakland/13__speedmaps__district_04-oakland__itp_id_246.ipynb +++ b/portfolio/rt/district_04-oakland/13__speedmaps__district_04-oakland__itp_id_246.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8bbf2b0fdf3b9edbcbecdbc47d92e946bc3232f19752ae33a0deb832cfc817b1 -size 91715 +oid sha256:bed4a4d4e7f9456260cb9a6daae4989d241d5c397f1c1f9bfefe76f411b13f00 +size 73997 diff --git a/portfolio/rt/district_04-oakland/14__speedmaps__district_04-oakland__itp_id_257.ipynb b/portfolio/rt/district_04-oakland/14__speedmaps__district_04-oakland__itp_id_257.ipynb index 1fc48c72e..20ba64f44 100644 --- a/portfolio/rt/district_04-oakland/14__speedmaps__district_04-oakland__itp_id_257.ipynb +++ b/portfolio/rt/district_04-oakland/14__speedmaps__district_04-oakland__itp_id_257.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b61810f1fe20d4b8a0427b75fc98a7cd8575bb0a02a46f93850463b6cc43398c -size 89819 +oid sha256:a85972773ac19d0b40fe57edd6549051dc0210a6c62d1a1952ef4100c59a52fd +size 72206 diff --git a/portfolio/rt/district_04-oakland/15__speedmaps__district_04-oakland__itp_id_280.ipynb b/portfolio/rt/district_04-oakland/15__speedmaps__district_04-oakland__itp_id_280.ipynb index b0e885a06..0a0d50cd6 100644 --- a/portfolio/rt/district_04-oakland/15__speedmaps__district_04-oakland__itp_id_280.ipynb +++ b/portfolio/rt/district_04-oakland/15__speedmaps__district_04-oakland__itp_id_280.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43fac59d1a1a698df200d5689161113a584a82d76806e51b71adc54b6caec1b6 -size 89458 +oid sha256:876699d898cc6b770e3360478bc801f21911f5d2470569db00958e61132eac13 +size 71666 diff --git a/portfolio/rt/district_04-oakland/16__speedmaps__district_04-oakland__itp_id_290.ipynb b/portfolio/rt/district_04-oakland/16__speedmaps__district_04-oakland__itp_id_290.ipynb index 3ad04ec44..dedb8f991 100644 --- a/portfolio/rt/district_04-oakland/16__speedmaps__district_04-oakland__itp_id_290.ipynb +++ b/portfolio/rt/district_04-oakland/16__speedmaps__district_04-oakland__itp_id_290.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63254e8fe14525e4a5986ee5517d34e2a27e621bfaeecff0267f73a1aef31e70 -size 90054 +oid sha256:a09822b26d48d41f0fba38202cee63ac01e5b4cd8ebf8afe39a02d46f6fbaaee +size 72355 diff --git a/portfolio/rt/district_04-oakland/17__speedmaps__district_04-oakland__itp_id_294.ipynb b/portfolio/rt/district_04-oakland/17__speedmaps__district_04-oakland__itp_id_294.ipynb index 41ec3220b..fe557c3b6 100644 --- a/portfolio/rt/district_04-oakland/17__speedmaps__district_04-oakland__itp_id_294.ipynb +++ b/portfolio/rt/district_04-oakland/17__speedmaps__district_04-oakland__itp_id_294.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35625eb0fe2d95b770723853a31c5f56e0f38290addd1e7fd29f681c3e385a6e -size 90067 +oid sha256:949a7b8f725610810385d57a08f98146b6277c81d7c7ad5574edd86f1f8b3cb6 +size 72332 diff --git a/portfolio/rt/district_04-oakland/18__speedmaps__district_04-oakland__itp_id_310.ipynb b/portfolio/rt/district_04-oakland/18__speedmaps__district_04-oakland__itp_id_310.ipynb index 533cbe0ec..2639ad28c 100644 --- a/portfolio/rt/district_04-oakland/18__speedmaps__district_04-oakland__itp_id_310.ipynb +++ b/portfolio/rt/district_04-oakland/18__speedmaps__district_04-oakland__itp_id_310.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:66d79f492f3f8dd0d680c207aeb7aaac7c6fa3328e57af4bc6904ade2813a735 -size 89852 +oid sha256:df827ae34c7a01a18632e6023068b783dd5af3dc85588050da22550628fd24b4 +size 72206 diff --git a/portfolio/rt/district_04-oakland/19__speedmaps__district_04-oakland__itp_id_381.ipynb b/portfolio/rt/district_04-oakland/19__speedmaps__district_04-oakland__itp_id_381.ipynb index 5975673c6..8c68ead86 100644 --- a/portfolio/rt/district_04-oakland/19__speedmaps__district_04-oakland__itp_id_381.ipynb +++ b/portfolio/rt/district_04-oakland/19__speedmaps__district_04-oakland__itp_id_381.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad462dc9a71916a2417d44751654096a0463b860d34a3645d79e3e9c041f6f4d -size 90081 +oid sha256:4fe1a6d931adbd5d9b378a8fa163a8314d428a854fa54584292ab4942e2039ad +size 72387 diff --git a/portfolio/rt/district_04-oakland/20__speedmaps__district_04-oakland__itp_id_314.ipynb b/portfolio/rt/district_04-oakland/20__speedmaps__district_04-oakland__itp_id_314.ipynb index b88251e11..712861225 100644 --- a/portfolio/rt/district_04-oakland/20__speedmaps__district_04-oakland__itp_id_314.ipynb +++ b/portfolio/rt/district_04-oakland/20__speedmaps__district_04-oakland__itp_id_314.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6aea76496b22fa63088dbbd6fada3a9ea51b8c7476c6afd8f9e9c26cc0dbd5f1 -size 88454 +oid sha256:7f0209725403d7c444bdd947c1128b65b94a93127d3bffe13ce6f467850a739a +size 70845 diff --git a/portfolio/rt/district_04-oakland/21__speedmaps__district_04-oakland__itp_id_315.ipynb b/portfolio/rt/district_04-oakland/21__speedmaps__district_04-oakland__itp_id_315.ipynb index 6582a50b0..316150ac5 100644 --- a/portfolio/rt/district_04-oakland/21__speedmaps__district_04-oakland__itp_id_315.ipynb +++ b/portfolio/rt/district_04-oakland/21__speedmaps__district_04-oakland__itp_id_315.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:41e21e74569bd216fadef50615e2a12a15f42ae6a2b4f813625879ef89664622 -size 90911 +oid sha256:5cf22324dca80f660eef6ceab10f30772ece191729f996170e6bc2d6c9496f3e +size 73191 diff --git a/portfolio/rt/district_04-oakland/22__speedmaps__district_04-oakland__itp_id_33.ipynb b/portfolio/rt/district_04-oakland/22__speedmaps__district_04-oakland__itp_id_33.ipynb index 4a35e106d..b196e2d47 100644 --- a/portfolio/rt/district_04-oakland/22__speedmaps__district_04-oakland__itp_id_33.ipynb +++ b/portfolio/rt/district_04-oakland/22__speedmaps__district_04-oakland__itp_id_33.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3597955292b98de560140c6cfc88a4795a013821db72fac12f518fd5207b8d3 -size 88587 +oid sha256:b5149c99d064f48617d9b766a9a26c885d12a2750b600fe905857382e346b337 +size 70893 diff --git a/portfolio/rt/district_04-oakland/23__speedmaps__district_04-oakland__itp_id_368.ipynb b/portfolio/rt/district_04-oakland/23__speedmaps__district_04-oakland__itp_id_368.ipynb index 21825a57a..c315c6dc1 100644 --- a/portfolio/rt/district_04-oakland/23__speedmaps__district_04-oakland__itp_id_368.ipynb +++ b/portfolio/rt/district_04-oakland/23__speedmaps__district_04-oakland__itp_id_368.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64c075a0bbc89788bf6f938ff3dc4335c426580ce97f07e5d8a61ca8bc05b64a -size 89628 +oid sha256:f77cd345cebd8bff683797f62415b45dd523430fa84a8f86cca341ef4a1e7aef +size 71913 diff --git a/portfolio/rt/district_05-san-luis-obispo/00__speedmaps__district_05-san-luis-obispo__itp_id_298.ipynb b/portfolio/rt/district_05-san-luis-obispo/00__speedmaps__district_05-san-luis-obispo__itp_id_298.ipynb index 5adb3839d..660743840 100644 --- a/portfolio/rt/district_05-san-luis-obispo/00__speedmaps__district_05-san-luis-obispo__itp_id_298.ipynb +++ b/portfolio/rt/district_05-san-luis-obispo/00__speedmaps__district_05-san-luis-obispo__itp_id_298.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:abba1acb23ef762a172f8fdcea33942dcd189b340b78994ba935d37571e6fd26 -size 91521 +oid sha256:390528057958efed1c6bd60020928d76f96746def0a7a00dc1ebb2b6db84d204 +size 73883 diff --git a/portfolio/rt/district_05-san-luis-obispo/01__speedmaps__district_05-san-luis-obispo__itp_id_312.ipynb b/portfolio/rt/district_05-san-luis-obispo/01__speedmaps__district_05-san-luis-obispo__itp_id_312.ipynb index f77e152f2..eef0533ba 100644 --- a/portfolio/rt/district_05-san-luis-obispo/01__speedmaps__district_05-san-luis-obispo__itp_id_312.ipynb +++ b/portfolio/rt/district_05-san-luis-obispo/01__speedmaps__district_05-san-luis-obispo__itp_id_312.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:31f833447c3447f014826c63a497b913b211856c341ffa3317fd3a85525ec3a2 -size 87336 +oid sha256:db60af11ce7ed08d6a2332f39c7996fa7b2e1a5dd08ff7fb5c1ecba63d7dfe0a +size 69721 diff --git a/portfolio/rt/district_05-san-luis-obispo/02__speedmaps__district_05-san-luis-obispo__itp_id_208.ipynb b/portfolio/rt/district_05-san-luis-obispo/02__speedmaps__district_05-san-luis-obispo__itp_id_208.ipynb index 5915e0e5f..c1f6af021 100644 --- a/portfolio/rt/district_05-san-luis-obispo/02__speedmaps__district_05-san-luis-obispo__itp_id_208.ipynb +++ b/portfolio/rt/district_05-san-luis-obispo/02__speedmaps__district_05-san-luis-obispo__itp_id_208.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c9bfbdced12132de177df4ee771666c59d99efc3a74b99f48dbde01cc7c2c6b -size 89254 +oid sha256:acd7e90af33830b2a6c03af6e000cbcda3f2d3c11ebdb3bf7c1f260bdce14ea7 +size 71602 diff --git a/portfolio/rt/district_05-san-luis-obispo/03__speedmaps__district_05-san-luis-obispo__itp_id_289.ipynb b/portfolio/rt/district_05-san-luis-obispo/03__speedmaps__district_05-san-luis-obispo__itp_id_289.ipynb index 78f532735..1b7266002 100644 --- a/portfolio/rt/district_05-san-luis-obispo/03__speedmaps__district_05-san-luis-obispo__itp_id_289.ipynb +++ b/portfolio/rt/district_05-san-luis-obispo/03__speedmaps__district_05-san-luis-obispo__itp_id_289.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:726b68b4fb50cc827ff97be4c761bdcbe1c8f1e1b73c5e423bc7c43fc199f27c -size 91020 +oid sha256:5f2a3d1686fe7dcf250cff24562625aa98b2771f3b97fb9d32ac4f6b630d5e03 +size 73292 diff --git a/portfolio/rt/district_05-san-luis-obispo/04__speedmaps__district_05-san-luis-obispo__itp_id_296.ipynb b/portfolio/rt/district_05-san-luis-obispo/04__speedmaps__district_05-san-luis-obispo__itp_id_296.ipynb index 0a987a82b..eed9b6ccf 100644 --- a/portfolio/rt/district_05-san-luis-obispo/04__speedmaps__district_05-san-luis-obispo__itp_id_296.ipynb +++ b/portfolio/rt/district_05-san-luis-obispo/04__speedmaps__district_05-san-luis-obispo__itp_id_296.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1cdf3c461b446841e034263e05e629fd96030ec01b5eab5a5b86b5fdead99c3a -size 92363 +oid sha256:813b91e48e4427a68f3106c6a0442ad9c6582459a0963ca6b85d9103ce2ba7ab +size 74638 diff --git a/portfolio/rt/district_06-fresno/00__speedmaps__district_06-fresno__itp_id_116.ipynb b/portfolio/rt/district_06-fresno/00__speedmaps__district_06-fresno__itp_id_116.ipynb index dbb1921a1..b24a72051 100644 --- a/portfolio/rt/district_06-fresno/00__speedmaps__district_06-fresno__itp_id_116.ipynb +++ b/portfolio/rt/district_06-fresno/00__speedmaps__district_06-fresno__itp_id_116.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:92f9fb7d40cfa17f57430dccc551c7467ca9edb6b50e5bcd7ada2ec68e3018a1 -size 89432 +oid sha256:cd3301d1efdfbdf693d2fe5a229b72ad03384a89ccc856bc3544668a678067ee +size 71805 diff --git a/portfolio/rt/district_06-fresno/01__speedmaps__district_06-fresno__itp_id_361.ipynb b/portfolio/rt/district_06-fresno/01__speedmaps__district_06-fresno__itp_id_361.ipynb index 450236cab..c80e45ecd 100644 --- a/portfolio/rt/district_06-fresno/01__speedmaps__district_06-fresno__itp_id_361.ipynb +++ b/portfolio/rt/district_06-fresno/01__speedmaps__district_06-fresno__itp_id_361.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0b23fe866984e0360bd0cc8b972705f7ff556525538ee5c4953eb3070bd141ef -size 91812 +oid sha256:644cb279d4401690f3699988141eb760f7835e2c0e8386a8d4189e5ae727e6dc +size 74194 diff --git a/portfolio/rt/district_06-fresno/02__speedmaps__district_06-fresno__itp_id_126.ipynb b/portfolio/rt/district_06-fresno/02__speedmaps__district_06-fresno__itp_id_126.ipynb index e6fab2395..24d94260a 100644 --- a/portfolio/rt/district_06-fresno/02__speedmaps__district_06-fresno__itp_id_126.ipynb +++ b/portfolio/rt/district_06-fresno/02__speedmaps__district_06-fresno__itp_id_126.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e348fbc0307c3c8bec26cf152c835f5d19bc14b3252432fc12a47e87c7e56e11 -size 90531 +oid sha256:5a4e7d6579b5cd78935d1e24d6bf6d3b05f2550718622e500ac6687faf35695a +size 72843 diff --git a/portfolio/rt/district_06-fresno/03__speedmaps__district_06-fresno__itp_id_148.ipynb b/portfolio/rt/district_06-fresno/03__speedmaps__district_06-fresno__itp_id_148.ipynb index a74e68da9..cde3cd422 100644 --- a/portfolio/rt/district_06-fresno/03__speedmaps__district_06-fresno__itp_id_148.ipynb +++ b/portfolio/rt/district_06-fresno/03__speedmaps__district_06-fresno__itp_id_148.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ae4c576ca0368781ce1e680c7f33e0df122affebb659c9377ca8aae0613d50e -size 89966 +oid sha256:1b2c1b3a934912ba54f962c10d80d3af7c25de90b3c4852f808313187a3d4a86 +size 72251 diff --git a/portfolio/rt/district_06-fresno/04__speedmaps__district_06-fresno__itp_id_188.ipynb b/portfolio/rt/district_06-fresno/04__speedmaps__district_06-fresno__itp_id_188.ipynb index 2885a059b..0f4fe1c20 100644 --- a/portfolio/rt/district_06-fresno/04__speedmaps__district_06-fresno__itp_id_188.ipynb +++ b/portfolio/rt/district_06-fresno/04__speedmaps__district_06-fresno__itp_id_188.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20aa789d0d6ad460d7396e5047d586e8e7661a8e848d8937158ac940f0499917 -size 90399 +oid sha256:bed5eca41f0a110dc39647f7e29b550f4fa4631ad7829dbab4b1f5c9a1515e83 +size 72788 diff --git a/portfolio/rt/district_07-los-angeles/00__speedmaps__district_07-los-angeles__itp_id_16.ipynb b/portfolio/rt/district_07-los-angeles/00__speedmaps__district_07-los-angeles__itp_id_16.ipynb index 70196dacc..33621c17b 100644 --- a/portfolio/rt/district_07-los-angeles/00__speedmaps__district_07-los-angeles__itp_id_16.ipynb +++ b/portfolio/rt/district_07-los-angeles/00__speedmaps__district_07-los-angeles__itp_id_16.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82088bd5922aed7a16b84226d7828dbc5118d5ada176edd21fdc59bdf50175d4 -size 89840 +oid sha256:7d1825b129b73a0e3bbdd121bd0d06c4c4ffa60b2bb2fba2d7acfd1ab7691d2f +size 72145 diff --git a/portfolio/rt/district_07-los-angeles/01__speedmaps__district_07-los-angeles__itp_id_45.ipynb b/portfolio/rt/district_07-los-angeles/01__speedmaps__district_07-los-angeles__itp_id_45.ipynb index 47a5a49c0..2f8e3f49f 100644 --- a/portfolio/rt/district_07-los-angeles/01__speedmaps__district_07-los-angeles__itp_id_45.ipynb +++ b/portfolio/rt/district_07-los-angeles/01__speedmaps__district_07-los-angeles__itp_id_45.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0702ccd664dd0d3b104d8ada26078c74c7204212bca2876024bfd05929b5961c -size 89035 +oid sha256:096aaa5715512773302920324611e19fc7c8a69c457cca01773b558708d6765b +size 71411 diff --git a/portfolio/rt/district_07-los-angeles/02__speedmaps__district_07-los-angeles__itp_id_54.ipynb b/portfolio/rt/district_07-los-angeles/02__speedmaps__district_07-los-angeles__itp_id_54.ipynb index 4013f679d..a90835e44 100644 --- a/portfolio/rt/district_07-los-angeles/02__speedmaps__district_07-los-angeles__itp_id_54.ipynb +++ b/portfolio/rt/district_07-los-angeles/02__speedmaps__district_07-los-angeles__itp_id_54.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3a2e2d69aa68c05cbe7af9b21e9879cbbfe719e59321a4fd9143f9713c9ff42b -size 89697 +oid sha256:1049b5ecb39ee4a3cb79012f99bbca125b998be7c0b313d60442ea09a3afb0e3 +size 72063 diff --git a/portfolio/rt/district_07-los-angeles/03__speedmaps__district_07-los-angeles__itp_id_87.ipynb b/portfolio/rt/district_07-los-angeles/03__speedmaps__district_07-los-angeles__itp_id_87.ipynb index af5d6f7d3..aa01153d1 100644 --- a/portfolio/rt/district_07-los-angeles/03__speedmaps__district_07-los-angeles__itp_id_87.ipynb +++ b/portfolio/rt/district_07-los-angeles/03__speedmaps__district_07-los-angeles__itp_id_87.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1ef8e6f09680db5746a3e3e612185a63ce2f84494cc3f1248f501e73b4304b7e -size 89118 +oid sha256:426ed037257abcd8279b100f828288fc3f68442ebf5edd15e4683c72b98c6e12 +size 71491 diff --git a/portfolio/rt/district_07-los-angeles/04__speedmaps__district_07-los-angeles__itp_id_97.ipynb b/portfolio/rt/district_07-los-angeles/04__speedmaps__district_07-los-angeles__itp_id_97.ipynb index 7822afd69..e84d3c0fc 100644 --- a/portfolio/rt/district_07-los-angeles/04__speedmaps__district_07-los-angeles__itp_id_97.ipynb +++ b/portfolio/rt/district_07-los-angeles/04__speedmaps__district_07-los-angeles__itp_id_97.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39978e5be691eab307fca4c7d2dc79f29579562457b77d7476d54751e13c6f2c -size 90141 +oid sha256:304dcd698dc0c9430351d3bef56ceb06f391c2d41175ddb3ca519539276c4745 +size 72526 diff --git a/portfolio/rt/district_07-los-angeles/05__speedmaps__district_07-los-angeles__itp_id_183.ipynb b/portfolio/rt/district_07-los-angeles/05__speedmaps__district_07-los-angeles__itp_id_183.ipynb index b477550d2..a7e3681c7 100644 --- a/portfolio/rt/district_07-los-angeles/05__speedmaps__district_07-los-angeles__itp_id_183.ipynb +++ b/portfolio/rt/district_07-los-angeles/05__speedmaps__district_07-los-angeles__itp_id_183.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:db281257fa83c22c4e76928aadd86ff1b710c958cc622f22d755604c03e6fc91 -size 88310 +oid sha256:f5ad7274a2a3c75ba504329fd9f12758bc3bd30e4413edc4c4dad9c55fdeb95a +size 70668 diff --git a/portfolio/rt/district_07-los-angeles/06__speedmaps__district_07-los-angeles__itp_id_210.ipynb b/portfolio/rt/district_07-los-angeles/06__speedmaps__district_07-los-angeles__itp_id_210.ipynb index 1714acf00..9831a6d58 100644 --- a/portfolio/rt/district_07-los-angeles/06__speedmaps__district_07-los-angeles__itp_id_210.ipynb +++ b/portfolio/rt/district_07-los-angeles/06__speedmaps__district_07-los-angeles__itp_id_210.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3686938c0cebdc3409fded9d22cb18b0fba4d3c0e7786101a5409a9e37a86799 -size 89699 +oid sha256:a7085655d6534d948e07b9528cba85bc59050f207c5658449a1d7836785c438a +size 72064 diff --git a/portfolio/rt/district_07-los-angeles/07__speedmaps__district_07-los-angeles__itp_id_228.ipynb b/portfolio/rt/district_07-los-angeles/07__speedmaps__district_07-los-angeles__itp_id_228.ipynb index 617c6f002..fb665a99c 100644 --- a/portfolio/rt/district_07-los-angeles/07__speedmaps__district_07-los-angeles__itp_id_228.ipynb +++ b/portfolio/rt/district_07-los-angeles/07__speedmaps__district_07-los-angeles__itp_id_228.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:337a0b97f905411058fd04a5166ab181098a8267b78ff0733599ca502d184486 -size 89970 +oid sha256:5b61cafd3cc0de4b52b9704d8212a8aff707310578c0800dba8cd670051c4ec2 +size 72346 diff --git a/portfolio/rt/district_07-los-angeles/08__speedmaps__district_07-los-angeles__itp_id_231.ipynb b/portfolio/rt/district_07-los-angeles/08__speedmaps__district_07-los-angeles__itp_id_231.ipynb index d0ab5ed3d..43c22c02a 100644 --- a/portfolio/rt/district_07-los-angeles/08__speedmaps__district_07-los-angeles__itp_id_231.ipynb +++ b/portfolio/rt/district_07-los-angeles/08__speedmaps__district_07-los-angeles__itp_id_231.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd12c59b797ca9485a1ef87929fd18f42dbf9a0a47df1bcef5d19d7d1ba40575 -size 89601 +oid sha256:7c33214142bf9bd9d5e2a957ed5336a1499a2e17177b64678f268877823db643 +size 71991 diff --git a/portfolio/rt/district_07-los-angeles/09__speedmaps__district_07-los-angeles__itp_id_243.ipynb b/portfolio/rt/district_07-los-angeles/09__speedmaps__district_07-los-angeles__itp_id_243.ipynb index 0e0894eff..b9b548b56 100644 --- a/portfolio/rt/district_07-los-angeles/09__speedmaps__district_07-los-angeles__itp_id_243.ipynb +++ b/portfolio/rt/district_07-los-angeles/09__speedmaps__district_07-los-angeles__itp_id_243.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa4404ff94bf2e70c7761424e65ff4610a9c89a8822b2c0b9b0f2e781315867d -size 88880 +oid sha256:e71e71b4532b7df3d6e05418abca6f095cffbb919b50371f1d8752e4bcc89814 +size 71258 diff --git a/portfolio/rt/district_07-los-angeles/10__speedmaps__district_07-los-angeles__itp_id_260.ipynb b/portfolio/rt/district_07-los-angeles/10__speedmaps__district_07-los-angeles__itp_id_260.ipynb index 148051432..dbc911af3 100644 --- a/portfolio/rt/district_07-los-angeles/10__speedmaps__district_07-los-angeles__itp_id_260.ipynb +++ b/portfolio/rt/district_07-los-angeles/10__speedmaps__district_07-los-angeles__itp_id_260.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1681edc54ac8f8e203de6b7e089b36286cf2bde0a353d8dd8831f328607de4ae -size 89274 +oid sha256:9341c868200b51bdd239de504fc02e8c323f9516a88873830b27eaac951790c4 +size 71619 diff --git a/portfolio/rt/district_07-los-angeles/11__speedmaps__district_07-los-angeles__itp_id_295.ipynb b/portfolio/rt/district_07-los-angeles/11__speedmaps__district_07-los-angeles__itp_id_295.ipynb index 8d449fd20..d8388d1dd 100644 --- a/portfolio/rt/district_07-los-angeles/11__speedmaps__district_07-los-angeles__itp_id_295.ipynb +++ b/portfolio/rt/district_07-los-angeles/11__speedmaps__district_07-los-angeles__itp_id_295.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ddc221629f92cd914c20bf3c0aa689a459d0783ec2e55d5f9ddaadefab2927ac -size 93264 +oid sha256:eabc8d59d936f6de557fbab230f5b1b650e699670874dae75953062d1dfadcc9 +size 75608 diff --git a/portfolio/rt/district_07-los-angeles/12__speedmaps__district_07-los-angeles__itp_id_300.ipynb b/portfolio/rt/district_07-los-angeles/12__speedmaps__district_07-los-angeles__itp_id_300.ipynb index 786f43e61..0e790dcda 100644 --- a/portfolio/rt/district_07-los-angeles/12__speedmaps__district_07-los-angeles__itp_id_300.ipynb +++ b/portfolio/rt/district_07-los-angeles/12__speedmaps__district_07-los-angeles__itp_id_300.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ef4d195628b7c1f949633ddbe94b9316c24515506689d4dabc48b83d592bd9f -size 88769 +oid sha256:155abcdcfae155ab6887f3295fb36e06c6bd55b422ae620fb3b7f4d5510334bf +size 71126 diff --git a/portfolio/rt/district_07-los-angeles/13__speedmaps__district_07-los-angeles__itp_id_308.ipynb b/portfolio/rt/district_07-los-angeles/13__speedmaps__district_07-los-angeles__itp_id_308.ipynb index f5e692637..4eba95507 100644 --- a/portfolio/rt/district_07-los-angeles/13__speedmaps__district_07-los-angeles__itp_id_308.ipynb +++ b/portfolio/rt/district_07-los-angeles/13__speedmaps__district_07-los-angeles__itp_id_308.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:154f4de9f4085970869507d38148a4e70dd53736bbf6700d6c89c0d21c86a10f -size 89765 +oid sha256:1d478dcfc178265c1be3d803e8f1d0ba6e0648ea3092fc623349d643078975f7 +size 72118 diff --git a/portfolio/rt/district_07-los-angeles/14__speedmaps__district_07-los-angeles__itp_id_337.ipynb b/portfolio/rt/district_07-los-angeles/14__speedmaps__district_07-los-angeles__itp_id_337.ipynb index c67801b2a..0ea7508b3 100644 --- a/portfolio/rt/district_07-los-angeles/14__speedmaps__district_07-los-angeles__itp_id_337.ipynb +++ b/portfolio/rt/district_07-los-angeles/14__speedmaps__district_07-los-angeles__itp_id_337.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:352296eac01b1fd15fb671d0eb73c3c3bc8999d74fd783457ac50080233f9b40 -size 89799 +oid sha256:2cc14973cbfab0b9a760e730df2f10fd148475bcc10ce79091c0c255fa43ed01 +size 72159 diff --git a/portfolio/rt/district_07-los-angeles/15__speedmaps__district_07-los-angeles__itp_id_339.ipynb b/portfolio/rt/district_07-los-angeles/15__speedmaps__district_07-los-angeles__itp_id_339.ipynb index f4b93b3df..a8d11e2e3 100644 --- a/portfolio/rt/district_07-los-angeles/15__speedmaps__district_07-los-angeles__itp_id_339.ipynb +++ b/portfolio/rt/district_07-los-angeles/15__speedmaps__district_07-los-angeles__itp_id_339.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84b1e5709ff52a188e0af321c20037c634e2e73bb7df1c64e4526074e82942f6 -size 90011 +oid sha256:04778bb158fc6c14ae208ccd5c001e792e66be98122aa31175b8bcb67ed0609b +size 72381 diff --git a/portfolio/rt/district_07-los-angeles/16__speedmaps__district_07-los-angeles__itp_id_112.ipynb b/portfolio/rt/district_07-los-angeles/16__speedmaps__district_07-los-angeles__itp_id_112.ipynb index f44ea7484..f649c763f 100644 --- a/portfolio/rt/district_07-los-angeles/16__speedmaps__district_07-los-angeles__itp_id_112.ipynb +++ b/portfolio/rt/district_07-los-angeles/16__speedmaps__district_07-los-angeles__itp_id_112.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c894ecd8edb3838cb045613242045d74d00115e0bf45fb4994af322346b1d5b9 -size 90211 +oid sha256:f20bec26ba49f37cc49192f130da8c854e19ac8fc779160248760141f188b5df +size 72582 diff --git a/portfolio/rt/district_07-los-angeles/17__speedmaps__district_07-los-angeles__itp_id_123.ipynb b/portfolio/rt/district_07-los-angeles/17__speedmaps__district_07-los-angeles__itp_id_123.ipynb index 40a290cfb..e4c7f51b3 100644 --- a/portfolio/rt/district_07-los-angeles/17__speedmaps__district_07-los-angeles__itp_id_123.ipynb +++ b/portfolio/rt/district_07-los-angeles/17__speedmaps__district_07-los-angeles__itp_id_123.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01e196b5ed5539f1e5e7a0ba9d41a840896ab78235c7c01809ffad709520cc69 -size 89929 +oid sha256:591d75db49f341e284f31420301ae902559054eb262fb34ff584c92ed8ed3992 +size 72262 diff --git a/portfolio/rt/district_07-los-angeles/18__speedmaps__district_07-los-angeles__itp_id_182.ipynb b/portfolio/rt/district_07-los-angeles/18__speedmaps__district_07-los-angeles__itp_id_182.ipynb index 3023ed92e..0fea6e280 100644 --- a/portfolio/rt/district_07-los-angeles/18__speedmaps__district_07-los-angeles__itp_id_182.ipynb +++ b/portfolio/rt/district_07-los-angeles/18__speedmaps__district_07-los-angeles__itp_id_182.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c64015609338506f37ee62ba229038234222275e4d99ce88ddcaf20246958700 -size 90157 +oid sha256:96010494b5f6fdc7fe0f0c787f136d8bb673ae39df2d1260eeb47ab81af98821 +size 72352 diff --git a/portfolio/rt/district_07-los-angeles/19__speedmaps__district_07-los-angeles__itp_id_380.ipynb b/portfolio/rt/district_07-los-angeles/19__speedmaps__district_07-los-angeles__itp_id_380.ipynb index cb7616ed3..0af54bd51 100644 --- a/portfolio/rt/district_07-los-angeles/19__speedmaps__district_07-los-angeles__itp_id_380.ipynb +++ b/portfolio/rt/district_07-los-angeles/19__speedmaps__district_07-los-angeles__itp_id_380.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e24c1ee4e711d68c5652a144a7a3692ff4e5b17ba3a66abbab370389cff457d -size 90227 +oid sha256:37b943f0b0c236cceab21dd2f676e0c3bf15a7e46aacb7f7137d63678ea1e941 +size 72496 diff --git a/portfolio/rt/district_08-san-bernardino/00__speedmaps__district_08-san-bernardino__itp_id_34.ipynb b/portfolio/rt/district_08-san-bernardino/00__speedmaps__district_08-san-bernardino__itp_id_34.ipynb index 44320e695..39b05c40c 100644 --- a/portfolio/rt/district_08-san-bernardino/00__speedmaps__district_08-san-bernardino__itp_id_34.ipynb +++ b/portfolio/rt/district_08-san-bernardino/00__speedmaps__district_08-san-bernardino__itp_id_34.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:09dc6ff42ddf3b1463f1e82187c9bcfd27706d4abb3201bc0c16a8f746a4a249 -size 89001 +oid sha256:60c2a6c86f65d5c247e029dd12f84269e7df5a550e7cc6208f1a922afca143d6 +size 71375 diff --git a/portfolio/rt/district_08-san-bernardino/01__speedmaps__district_08-san-bernardino__itp_id_214.ipynb b/portfolio/rt/district_08-san-bernardino/01__speedmaps__district_08-san-bernardino__itp_id_214.ipynb index f780531b9..2ada12bb1 100644 --- a/portfolio/rt/district_08-san-bernardino/01__speedmaps__district_08-san-bernardino__itp_id_214.ipynb +++ b/portfolio/rt/district_08-san-bernardino/01__speedmaps__district_08-san-bernardino__itp_id_214.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7419c779e9826e82edaefc9df5b2890a5071cd6028717f930541621cd2c4be6a -size 93363 +oid sha256:c6e6ca3ce541eb34c1285bd2c23a2c73f2e1091039da4e48f354dd0764d89bc2 +size 75646 diff --git a/portfolio/rt/district_08-san-bernardino/02__speedmaps__district_08-san-bernardino__itp_id_232.ipynb b/portfolio/rt/district_08-san-bernardino/02__speedmaps__district_08-san-bernardino__itp_id_232.ipynb index 8e7e90daa..986f8ace4 100644 --- a/portfolio/rt/district_08-san-bernardino/02__speedmaps__district_08-san-bernardino__itp_id_232.ipynb +++ b/portfolio/rt/district_08-san-bernardino/02__speedmaps__district_08-san-bernardino__itp_id_232.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3eda66f6945bf6460e25e8caee568adea14b441c5e464f41c4bb1f1960934cb1 -size 89888 +oid sha256:c6a1f45216815daf4e723df264b52f3c66c1cca0a7352dacdd6c3f8336fcfb48 +size 72279 diff --git a/portfolio/rt/district_08-san-bernardino/03__speedmaps__district_08-san-bernardino__itp_id_238.ipynb b/portfolio/rt/district_08-san-bernardino/03__speedmaps__district_08-san-bernardino__itp_id_238.ipynb index abe6251a1..c504521bd 100644 --- a/portfolio/rt/district_08-san-bernardino/03__speedmaps__district_08-san-bernardino__itp_id_238.ipynb +++ b/portfolio/rt/district_08-san-bernardino/03__speedmaps__district_08-san-bernardino__itp_id_238.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f26072acf2884d879bf6a59434b9220080894f6a46d62ed85b85ce777932964 -size 87675 +oid sha256:68dd03c028216dd35ed1f73295c5c844e1309a1e587e7f20f4c3125115ffe67a +size 69981 diff --git a/portfolio/rt/district_08-san-bernardino/04__speedmaps__district_08-san-bernardino__itp_id_269.ipynb b/portfolio/rt/district_08-san-bernardino/04__speedmaps__district_08-san-bernardino__itp_id_269.ipynb index 3a856768c..08cd9101d 100644 --- a/portfolio/rt/district_08-san-bernardino/04__speedmaps__district_08-san-bernardino__itp_id_269.ipynb +++ b/portfolio/rt/district_08-san-bernardino/04__speedmaps__district_08-san-bernardino__itp_id_269.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:092dac7e1b4ab4a3b4a266eca2212f3b0abdcaa1b68a177787351cdccf7da288 -size 90259 +oid sha256:8ca115b8d8435c66b7a2e759e44397baedfae1649c5a777c95e5044ad99a8336 +size 72582 diff --git a/portfolio/rt/district_08-san-bernardino/05__speedmaps__district_08-san-bernardino__itp_id_360.ipynb b/portfolio/rt/district_08-san-bernardino/05__speedmaps__district_08-san-bernardino__itp_id_360.ipynb index ce97ea064..81d6f784b 100644 --- a/portfolio/rt/district_08-san-bernardino/05__speedmaps__district_08-san-bernardino__itp_id_360.ipynb +++ b/portfolio/rt/district_08-san-bernardino/05__speedmaps__district_08-san-bernardino__itp_id_360.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:44e0fb6c104a772ca226f5c8135c2a54b57031fce03a97eaacd0961449444714 -size 93202 +oid sha256:8fbd18a598b717f5994cf86b843c74d3cd5512d090f88d424814f7b9138cae5c +size 75506 diff --git a/portfolio/rt/district_09-bishop/00__speedmaps__district_09-bishop__itp_id_99.ipynb b/portfolio/rt/district_09-bishop/00__speedmaps__district_09-bishop__itp_id_99.ipynb index 972769f7c..c5e4c8bfc 100644 --- a/portfolio/rt/district_09-bishop/00__speedmaps__district_09-bishop__itp_id_99.ipynb +++ b/portfolio/rt/district_09-bishop/00__speedmaps__district_09-bishop__itp_id_99.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea2da450f4c2cbcf420865d6b7db064e796d8acb0aa139bd1d46e95d0ffc27b1 -size 89990 +oid sha256:acaac733ba4779faed85e71cd162430bf00a5cd5822c7f759b3535980a520981 +size 72297 diff --git a/portfolio/rt/district_10-stockton/00__speedmaps__district_10-stockton__itp_id_107.ipynb b/portfolio/rt/district_10-stockton/00__speedmaps__district_10-stockton__itp_id_107.ipynb index 8b95b494f..d448c2d7d 100644 --- a/portfolio/rt/district_10-stockton/00__speedmaps__district_10-stockton__itp_id_107.ipynb +++ b/portfolio/rt/district_10-stockton/00__speedmaps__district_10-stockton__itp_id_107.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67490c7ab016b88852229c3f8bab708feed7b5dd473c385269805d65431aa1f4 -size 87231 +oid sha256:ed0413c3b3c69ac1273225c6d177f3194a0aa36c778ee54a7d60b0da605029f2 +size 69606 diff --git a/portfolio/rt/district_10-stockton/01__speedmaps__district_10-stockton__itp_id_349.ipynb b/portfolio/rt/district_10-stockton/01__speedmaps__district_10-stockton__itp_id_349.ipynb index ccb77ad93..ac9e68733 100644 --- a/portfolio/rt/district_10-stockton/01__speedmaps__district_10-stockton__itp_id_349.ipynb +++ b/portfolio/rt/district_10-stockton/01__speedmaps__district_10-stockton__itp_id_349.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a1725e04770d41610bfb1645387e43d2cee3e630be96b4d1a9f119a0cb72ccaf -size 89869 +oid sha256:9c35d001e2474261dc1789eb2c8d798c48243dda440bdda29d8e25caee717d3d +size 72243 diff --git a/portfolio/rt/district_10-stockton/02__speedmaps__district_10-stockton__itp_id_10.ipynb b/portfolio/rt/district_10-stockton/02__speedmaps__district_10-stockton__itp_id_10.ipynb index ae90b028d..42585daec 100644 --- a/portfolio/rt/district_10-stockton/02__speedmaps__district_10-stockton__itp_id_10.ipynb +++ b/portfolio/rt/district_10-stockton/02__speedmaps__district_10-stockton__itp_id_10.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fddf152f867b53b4b567f3a1cb1407576b73ccd3d79941b557f4d8b87656bb8 -size 88438 +oid sha256:3b414ae047cbaef5aac43b67b9bfd776734d9840c28f01cf4062e1b2a00f6a82 +size 70738 diff --git a/portfolio/rt/district_10-stockton/03__speedmaps__district_10-stockton__itp_id_284.ipynb b/portfolio/rt/district_10-stockton/03__speedmaps__district_10-stockton__itp_id_284.ipynb index 5f101f585..4411a8be4 100644 --- a/portfolio/rt/district_10-stockton/03__speedmaps__district_10-stockton__itp_id_284.ipynb +++ b/portfolio/rt/district_10-stockton/03__speedmaps__district_10-stockton__itp_id_284.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:227f0730efab0b4bfa223eeab201430fbdb5c142dabd64eb68c163cf6b798695 -size 89441 +oid sha256:56fa3a49794882faaf5a76eabbce7c5129e2563cbca7b3a14b68e26f2c867fee +size 71716 diff --git a/portfolio/rt/district_10-stockton/04__speedmaps__district_10-stockton__itp_id_484.ipynb b/portfolio/rt/district_10-stockton/04__speedmaps__district_10-stockton__itp_id_484.ipynb index 6ee0e2f4d..f787c3221 100644 --- a/portfolio/rt/district_10-stockton/04__speedmaps__district_10-stockton__itp_id_484.ipynb +++ b/portfolio/rt/district_10-stockton/04__speedmaps__district_10-stockton__itp_id_484.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ba2ab772ca346451f87d3b8c48f2eaad6c88b4909f53240141deac63187a7f7 -size 89710 +oid sha256:38eeb4176070a3eb596e4dad4725477ac7c06626044bc231d6b65888619073b0 +size 72000 diff --git a/portfolio/rt/district_11-san-diego/00__speedmaps__district_11-san-diego__itp_id_226.ipynb b/portfolio/rt/district_11-san-diego/00__speedmaps__district_11-san-diego__itp_id_226.ipynb index 6aca8bf4b..c6fade8fe 100644 --- a/portfolio/rt/district_11-san-diego/00__speedmaps__district_11-san-diego__itp_id_226.ipynb +++ b/portfolio/rt/district_11-san-diego/00__speedmaps__district_11-san-diego__itp_id_226.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7bca1a8adc5508c72343452e866e6da4429e6b0137823f1b8e5794351539a5ee -size 92199 +oid sha256:15260fbe88d94b7fc39175cba46f4280582f5a5f7308974e2dcd507e212da6b3 +size 74503 diff --git a/portfolio/rt/district_11-san-diego/01__speedmaps__district_11-san-diego__itp_id_277.ipynb b/portfolio/rt/district_11-san-diego/01__speedmaps__district_11-san-diego__itp_id_277.ipynb index 21a67ab15..7b5d8de7d 100644 --- a/portfolio/rt/district_11-san-diego/01__speedmaps__district_11-san-diego__itp_id_277.ipynb +++ b/portfolio/rt/district_11-san-diego/01__speedmaps__district_11-san-diego__itp_id_277.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:63a6492c9823ffbdb5aae7c4d15163b14f357277fbb244e3eb8eb33c41826c23 -size 90557 +oid sha256:f58f8f7dc7aa6ddcbe6bece75cab6bd30a094d6b5d3475f62fa5ac9fd4774a4b +size 72853 diff --git a/portfolio/rt/district_11-san-diego/02__speedmaps__district_11-san-diego__itp_id_278.ipynb b/portfolio/rt/district_11-san-diego/02__speedmaps__district_11-san-diego__itp_id_278.ipynb index 7103b4666..2761825db 100644 --- a/portfolio/rt/district_11-san-diego/02__speedmaps__district_11-san-diego__itp_id_278.ipynb +++ b/portfolio/rt/district_11-san-diego/02__speedmaps__district_11-san-diego__itp_id_278.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67eb7782671c4723b8af5436a1121dd46245dbd1d6f26e31449cd37ee5f5699b -size 90689 +oid sha256:a37c4b9eea3ee63033c0a3d72e97444921d7a5e7dd6febddbd543bbdbd969d09 +size 72966 diff --git a/portfolio/rt/district_12-irvine/00__speedmaps__district_12-irvine__itp_id_235.ipynb b/portfolio/rt/district_12-irvine/00__speedmaps__district_12-irvine__itp_id_235.ipynb index 794f147c9..021854af5 100644 --- a/portfolio/rt/district_12-irvine/00__speedmaps__district_12-irvine__itp_id_235.ipynb +++ b/portfolio/rt/district_12-irvine/00__speedmaps__district_12-irvine__itp_id_235.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:18f85d3d1aefa5814f4ac6c363b81b934169863bd1b8ec52d8687df6058072b3 -size 89897 +oid sha256:c620d50155d1ca44c32c92cd2f578860b47f981760ee03a4c7da1a8fab327f64 +size 72168 diff --git a/portfolio/sites/rt.yml b/portfolio/sites/rt.yml index add773d81..be4e2854a 100644 --- a/portfolio/sites/rt.yml +++ b/portfolio/sites/rt.yml @@ -92,6 +92,7 @@ parts: - itp_id: 123 - itp_id: 182 - itp_id: 380 + - itp_id: 170 - caption: District 08 - San Bernardino params: district: 08 - San Bernardino From 20b0eea7cf62ef2f478ba8971337d68a2f9d6921 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 1 Nov 2024 16:34:14 +0000 Subject: [PATCH 02/13] speedmap shape segment aggregation across all times of day --- .../shared_utils/gtfs_analytics_data.yml | 1 + .../40_speedmap_scratchpad.ipynb | 763 ++++++++++++++---- rt_segment_speeds/logs/avg_speeds.log | 3 + .../scripts/average_segment_speeds.py | 56 ++ .../average_speedmap_segment_speeds.py | 10 +- 5 files changed, 681 insertions(+), 152 deletions(-) diff --git a/_shared_utils/shared_utils/gtfs_analytics_data.yml b/_shared_utils/shared_utils/gtfs_analytics_data.yml index 878d09ae6..cc4bab0a0 100644 --- a/_shared_utils/shared_utils/gtfs_analytics_data.yml +++ b/_shared_utils/shared_utils/gtfs_analytics_data.yml @@ -122,6 +122,7 @@ speedmap_segments: route_dir_cols: ["route_id", "route_short_name"] segments_file: "segment_options/speedmap_segments" shape_stop_single_segment: "rollup_singleday/speeds_shape_speedmap_segments" + shape_stop_single_segment_detail: "rollup_singleday/speeds_shape_speedmap_segments_detail" route_dir_single_segment: "rollup_singleday/speeds_route_dir_speedmap_segments" route_dir_multi_segment: "rollup_multiday/speeds_route_dir_speedmap_segments" min_trip_minutes: ${speed_vars.time_min_cutoff} diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 618ec46e8..5a521a634 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -2,12 +2,13 @@ "cells": [ { "cell_type": "code", - "execution_count": 25, + "execution_count": 13, "id": "d528f399-cf33-459e-b5dc-92e0b4ae389a", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", + "import geopandas as gpd\n", "from siuba import *\n", "import shared_utils\n", "\n", @@ -26,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 2, "id": "6cd318e5-5c4e-4249-b158-232f4d940770", "metadata": {}, "outputs": [], @@ -36,17 +37,17 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 3, "id": "6e86c1a8-d3de-4fc6-9478-c03133b6745c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id', 'route_id', 'route_short_name'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" + "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'route_short_name'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" ] }, - "execution_count": 29, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -57,17 +58,17 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 4, "id": "f766b50a-c70d-4681-992c-d7f8979ada69", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'2024-08-14'" + "'2024-10-16'" ] }, - "execution_count": 30, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -78,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 5, "id": "b4dd7af7-0cfa-4d94-a96d-f11e7cdc12f9", "metadata": {}, "outputs": [], @@ -88,17 +89,17 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 6, "id": "b59806c6-2b6e-449b-be04-2ac59771d122", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/speedmap/speeds_2024-08-14.parquet'" + "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/speedmap/speeds_2024-10-16.parquet'" ] }, - "execution_count": 32, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -109,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 7, "id": "6bd54bfc-cfad-487b-bf54-0cab10e72e36", "metadata": {}, "outputs": [], @@ -119,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 8, "id": "a4808944-fefa-486a-80f2-e75a1ae8b491", "metadata": {}, "outputs": [ @@ -136,7 +137,7 @@ " dtype='object')" ] }, - "execution_count": 34, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -147,25 +148,226 @@ }, { "cell_type": "code", - "execution_count": 36, - "id": "54ab4555-0720-47a0-bd74-3b4abdc6ac95", + "execution_count": 9, + "id": "9d0c6313-930a-4285-9f4a-0e5ac64cfde6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
trip_instance_keystop_sequencestop_sequence1shape_array_keystop_metersarrival_timearrival_time_secsubseq_arrival_time_secsubseq_stop_metersmeters_elapsed...route_iddirection_idroute_short_namescheduled_service_minutessched_rt_categorytime_of_dayshape_idsegment_idstop_pair_namestop_pair
000000ec4ec4f4cee317f06c981d4965f22.0d0a9e8989ac39227513e69a468f002b5258.5712024-10-16 12:43:014578145836.0442.814184.243...30.0361.0schedule_and_vpMidday3_0_9712166-91043-1Euclid Av & Unity Place Drwy__Euclid Av & Eucl...12166__91043
100000ec4ec4f4cee317f06c981d4965f33.0d0a9e8989ac39227513e69a468f002b5442.8142024-10-16 12:43:564583645894.0816.841374.027...30.0361.0schedule_and_vpMidday3_0_9791043-12165-1Euclid Av & Euclid Health Center__Euclid Av & ...91043__12165
200000ec4ec4f4cee317f06c981d4965f44.0d0a9e8989ac39227513e69a468f002b5816.8412024-10-16 12:44:544589445921.01248.511431.670...30.0361.0schedule_and_vpMidday3_0_9712165-12164-1Euclid Av & Brooks Huffman Plaza__Euclid Av & ...12165__12164
\n", + "

3 rows × 23 columns

\n", + "
" + ], + "text/plain": [ + " trip_instance_key stop_sequence stop_sequence1 \\\n", + "0 00000ec4ec4f4cee317f06c981d4965f 2 2.0 \n", + "1 00000ec4ec4f4cee317f06c981d4965f 3 3.0 \n", + "2 00000ec4ec4f4cee317f06c981d4965f 4 4.0 \n", + "\n", + " shape_array_key stop_meters arrival_time \\\n", + "0 d0a9e8989ac39227513e69a468f002b5 258.571 2024-10-16 12:43:01 \n", + "1 d0a9e8989ac39227513e69a468f002b5 442.814 2024-10-16 12:43:56 \n", + "2 d0a9e8989ac39227513e69a468f002b5 816.841 2024-10-16 12:44:54 \n", + "\n", + " arrival_time_sec subseq_arrival_time_sec subseq_stop_meters \\\n", + "0 45781 45836.0 442.814 \n", + "1 45836 45894.0 816.841 \n", + "2 45894 45921.0 1248.511 \n", + "\n", + " meters_elapsed ... route_id direction_id route_short_name \\\n", + "0 184.243 ... 3 0.0 3 \n", + "1 374.027 ... 3 0.0 3 \n", + "2 431.670 ... 3 0.0 3 \n", + "\n", + " scheduled_service_minutes sched_rt_category time_of_day shape_id \\\n", + "0 61.0 schedule_and_vp Midday 3_0_97 \n", + "1 61.0 schedule_and_vp Midday 3_0_97 \n", + "2 61.0 schedule_and_vp Midday 3_0_97 \n", + "\n", + " segment_id stop_pair_name \\\n", + "0 12166-91043-1 Euclid Av & Unity Place Drwy__Euclid Av & Eucl... \n", + "1 91043-12165-1 Euclid Av & Euclid Health Center__Euclid Av & ... \n", + "2 12165-12164-1 Euclid Av & Brooks Huffman Plaza__Euclid Av & ... \n", + "\n", + " stop_pair \n", + "0 12166__91043 \n", + "1 91043__12165 \n", + "2 12165__12164 \n", + "\n", + "[3 rows x 23 columns]" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df >> head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "5e047f33-bd0a-47dd-abec-884518618715", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Midday', 'Early AM', 'PM Peak', 'Evening', 'AM Peak', 'Owl'],\n", + " dtype=object)" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.time_of_day.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "12b824f2-4326-4f5e-ae86-95a46703c948", "metadata": {}, "outputs": [], "source": [ - "route_info = helpers.import_scheduled_trips(\n", - " analysis_date,\n", - " columns=[\n", - " \"gtfs_dataset_key\", \"trip_instance_key\",\n", - " \"route_id\", \"direction_id\", \"route_short_name\"\n", - " ],\n", - " get_pandas=True,\n", - ")" + "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" ] }, { "cell_type": "code", - "execution_count": 37, - "id": "e70276d9-382d-4262-81a7-ac172d1316e5", + "execution_count": 14, + "id": "7669d09d-c49e-448c-b57a-299112614bd0", + "metadata": {}, + "outputs": [], + "source": [ + "detail = gpd.read_parquet(path)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "ddf376af-9781-4943-b0d7-5f5418e07735", "metadata": {}, "outputs": [ { @@ -190,52 +392,136 @@ " \n", " \n", " schedule_gtfs_dataset_key\n", - " trip_instance_key\n", + " shape_array_key\n", + " shape_id\n", " route_id\n", - " direction_id\n", " route_short_name\n", + " stop_pair\n", + " stop_pair_name\n", + " segment_id\n", + " time_of_day\n", + " p50_mph\n", + " n_trips\n", + " p20_mph\n", + " p80_mph\n", + " name\n", + " caltrans_district\n", + " organization_source_record_id\n", + " organization_name\n", + " base64_url\n", + " geometry\n", " \n", " \n", " \n", " \n", " 0\n", - " 1770249a5a2e770ca90628434d4934b1\n", - " 7406077cb3ef2783f260ac5ddf06f884\n", - " 3407\n", - " 1.0\n", - " Route 18\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " AM Peak\n", + " 17.27\n", + " 4\n", + " 15.20\n", + " 20.96\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 1\n", - " 1770249a5a2e770ca90628434d4934b1\n", - " d9f1f0a4d53997858a48a340772c75a3\n", - " 3408\n", - " 0.0\n", - " Route 21\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " Midday\n", + " 20.38\n", + " 6\n", + " 18.46\n", + " 23.02\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 2\n", - " 1770249a5a2e770ca90628434d4934b1\n", - " 3c36b0976b9cd77a0862224d842fea5f\n", - " 3408\n", - " 0.0\n", - " Route 21\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " PM Peak\n", + " 23.90\n", + " 5\n", + " 22.49\n", + " 25.11\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 3\n", - " 1770249a5a2e770ca90628434d4934b1\n", - " a26bcf0a35ac9342d82435bb064f8700\n", - " 3408\n", - " 0.0\n", - " Route 21\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", + " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", + " AM Peak\n", + " 49.50\n", + " 8\n", + " 43.85\n", + " 51.81\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.10550 36.41377, -119.10562 36...\n", " \n", " \n", " 4\n", - " 1770249a5a2e770ca90628434d4934b1\n", - " 77b979dca36b0f4fd305210cee23f6a1\n", - " 3408\n", - " 0.0\n", - " Route 21\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", + " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", + " Midday\n", + " 47.58\n", + " 12\n", + " 44.74\n", + " 49.68\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.10550 36.41377, -119.10562 36...\n", " \n", " \n", " ...\n", @@ -244,129 +530,304 @@ " ...\n", " ...\n", " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", " \n", " \n", - " 98814\n", - " c4092405159366c705b62df938293a4e\n", - " 9f5b9be0653ea22d7c705fb8ccecf20f\n", - " Orange County Line\n", - " 0.0\n", - " None\n", + " 693202\n", + " fb467982dcc77a7f9199bebe709bb700\n", + " 8d34a33f017ea0d1498b0cebf26fc5f9\n", + " 114150\n", + " 21\n", + " 21\n", + " 61591__61592\n", + " California & Showers__California & Ortega\n", + " 61591-61592-1\n", + " Evening\n", + " 24.71\n", + " 1\n", + " 24.71\n", + " 24.71\n", + " Bay Area 511 Santa Clara Transit Schedule\n", + " 04 - Oakland\n", + " recC5CT95EufmQCXr\n", + " Santa Clara Valley Transportation Authority\n", + " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", + " LINESTRING (-122.10605 37.40280, -122.10581 37...\n", " \n", " \n", - " 98815\n", - " c4092405159366c705b62df938293a4e\n", - " c9284435d85c3cf9a5fa5afacbcfb5f0\n", - " Antelope Valley Line\n", - " 1.0\n", - " None\n", + " 693203\n", + " fb467982dcc77a7f9199bebe709bb700\n", + " 8d34a33f017ea0d1498b0cebf26fc5f9\n", + " 114150\n", + " 21\n", + " 21\n", + " 61592__61593\n", + " California & Ortega__California & Rengstorff\n", + " 61592-61593-1\n", + " Evening\n", + " 24.68\n", + " 1\n", + " 24.68\n", + " 24.68\n", + " Bay Area 511 Santa Clara Transit Schedule\n", + " 04 - Oakland\n", + " recC5CT95EufmQCXr\n", + " Santa Clara Valley Transportation Authority\n", + " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", + " LINESTRING (-122.10339 37.40108, -122.10266 37...\n", " \n", " \n", - " 98816\n", - " c4092405159366c705b62df938293a4e\n", - " 23bdf6228677587ad66658b818f8f3c8\n", - " Orange County Line\n", - " 1.0\n", - " None\n", + " 693204\n", + " fb467982dcc77a7f9199bebe709bb700\n", + " 8d34a33f017ea0d1498b0cebf26fc5f9\n", + " 114150\n", + " 21\n", + " 21\n", + " 61593__61422\n", + " California & Rengstorff__California & Escuela\n", + " 61593-61422-1\n", + " Evening\n", + " 24.44\n", + " 1\n", + " 24.44\n", + " 24.44\n", + " Bay Area 511 Santa Clara Transit Schedule\n", + " 04 - Oakland\n", + " recC5CT95EufmQCXr\n", + " Santa Clara Valley Transportation Authority\n", + " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", + " LINESTRING (-122.09992 37.39895, -122.09902 37...\n", " \n", " \n", - " 98817\n", - " c4092405159366c705b62df938293a4e\n", - " 633996f6d703cbff7838099bc4e8c6e0\n", - " San Bernardino Line\n", - " 0.0\n", - " None\n", + " 693205\n", + " fb467982dcc77a7f9199bebe709bb700\n", + " 8d34a33f017ea0d1498b0cebf26fc5f9\n", + " 114150\n", + " 21\n", + " 21\n", + " 61422__61423\n", + " California & Escuela__California & Mariposa\n", + " 61422-61423-1\n", + " Evening\n", + " 15.27\n", + " 1\n", + " 15.27\n", + " 15.27\n", + " Bay Area 511 Santa Clara Transit Schedule\n", + " 04 - Oakland\n", + " recC5CT95EufmQCXr\n", + " Santa Clara Valley Transportation Authority\n", + " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", + " LINESTRING (-122.09415 37.39670, -122.09225 37...\n", " \n", " \n", - " 98818\n", - " c4092405159366c705b62df938293a4e\n", - " 244d1863feeafcda8075111177de596a\n", - " Antelope Valley Line\n", - " 0.0\n", - " None\n", + " 693206\n", + " fb467982dcc77a7f9199bebe709bb700\n", + " 8d34a33f017ea0d1498b0cebf26fc5f9\n", + " 114150\n", + " 21\n", + " 21\n", + " 61423__61424\n", + " California & Mariposa__California & Palo Alto\n", + " 61423-61424-1\n", + " Evening\n", + " 14.83\n", + " 1\n", + " 14.83\n", + " 14.83\n", + " Bay Area 511 Santa Clara Transit Schedule\n", + " 04 - Oakland\n", + " recC5CT95EufmQCXr\n", + " Santa Clara Valley Transportation Authority\n", + " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", + " LINESTRING (-122.08948 37.39486, -122.08939 37...\n", " \n", " \n", "\n", - "

98819 rows × 5 columns

\n", + "

693207 rows × 19 columns

\n", "" ], "text/plain": [ - " schedule_gtfs_dataset_key trip_instance_key \\\n", - "0 1770249a5a2e770ca90628434d4934b1 7406077cb3ef2783f260ac5ddf06f884 \n", - "1 1770249a5a2e770ca90628434d4934b1 d9f1f0a4d53997858a48a340772c75a3 \n", - "2 1770249a5a2e770ca90628434d4934b1 3c36b0976b9cd77a0862224d842fea5f \n", - "3 1770249a5a2e770ca90628434d4934b1 a26bcf0a35ac9342d82435bb064f8700 \n", - "4 1770249a5a2e770ca90628434d4934b1 77b979dca36b0f4fd305210cee23f6a1 \n", - "... ... ... \n", - "98814 c4092405159366c705b62df938293a4e 9f5b9be0653ea22d7c705fb8ccecf20f \n", - "98815 c4092405159366c705b62df938293a4e c9284435d85c3cf9a5fa5afacbcfb5f0 \n", - "98816 c4092405159366c705b62df938293a4e 23bdf6228677587ad66658b818f8f3c8 \n", - "98817 c4092405159366c705b62df938293a4e 633996f6d703cbff7838099bc4e8c6e0 \n", - "98818 c4092405159366c705b62df938293a4e 244d1863feeafcda8075111177de596a \n", + " schedule_gtfs_dataset_key shape_array_key \\\n", + "0 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "1 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "2 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "3 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "4 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "... ... ... \n", + "693202 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693203 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693204 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693205 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693206 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", "\n", - " route_id direction_id route_short_name \n", - "0 3407 1.0 Route 18 \n", - "1 3408 0.0 Route 21 \n", - "2 3408 0.0 Route 21 \n", - "3 3408 0.0 Route 21 \n", - "4 3408 0.0 Route 21 \n", - "... ... ... ... \n", - "98814 Orange County Line 0.0 None \n", - "98815 Antelope Valley Line 1.0 None \n", - "98816 Orange County Line 1.0 None \n", - "98817 San Bernardino Line 0.0 None \n", - "98818 Antelope Valley Line 0.0 None \n", + " shape_id \\\n", + "0 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "1 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "2 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "3 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "4 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "... ... \n", + "693202 114150 \n", + "693203 114150 \n", + "693204 114150 \n", + "693205 114150 \n", + "693206 114150 \n", "\n", - "[98819 rows x 5 columns]" - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "route_info" - ] - }, - { - "cell_type": "code", - "execution_count": 49, - "id": "2849f073-df8e-4774-a755-1cac46c80e3e", - "metadata": {}, - "outputs": [], - "source": [ - "test = ['x', 'y', 'x']" - ] - }, - { - "cell_type": "code", - "execution_count": 50, - "id": "ed9c230d-ea3d-46bc-b570-203bde23fa0a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['x', 'y']" + " route_id route_short_name \\\n", + "0 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "1 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "2 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "3 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "4 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "... ... ... \n", + "693202 21 21 \n", + "693203 21 21 \n", + "693204 21 21 \n", + "693205 21 21 \n", + "693206 21 21 \n", + "\n", + " stop_pair \\\n", + "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "3 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", + "4 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", + "... ... \n", + "693202 61591__61592 \n", + "693203 61592__61593 \n", + "693204 61593__61422 \n", + "693205 61422__61423 \n", + "693206 61423__61424 \n", + "\n", + " stop_pair_name \\\n", + "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "3 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", + "4 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", + "... ... \n", + "693202 California & Showers__California & Ortega \n", + "693203 California & Ortega__California & Rengstorff \n", + "693204 California & Rengstorff__California & Escuela \n", + "693205 California & Escuela__California & Mariposa \n", + "693206 California & Mariposa__California & Palo Alto \n", + "\n", + " segment_id time_of_day \\\n", + "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak \n", + "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday \n", + "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak \n", + "3 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak \n", + "4 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... Midday \n", + "... ... ... \n", + "693202 61591-61592-1 Evening \n", + "693203 61592-61593-1 Evening \n", + "693204 61593-61422-1 Evening \n", + "693205 61422-61423-1 Evening \n", + "693206 61423-61424-1 Evening \n", + "\n", + " p50_mph n_trips p20_mph p80_mph \\\n", + "0 17.27 4 15.20 20.96 \n", + "1 20.38 6 18.46 23.02 \n", + "2 23.90 5 22.49 25.11 \n", + "3 49.50 8 43.85 51.81 \n", + "4 47.58 12 44.74 49.68 \n", + "... ... ... ... ... \n", + "693202 24.71 1 24.71 24.71 \n", + "693203 24.68 1 24.68 24.68 \n", + "693204 24.44 1 24.44 24.44 \n", + "693205 15.27 1 15.27 15.27 \n", + "693206 14.83 1 14.83 14.83 \n", + "\n", + " name caltrans_district \\\n", + "0 TCRTA TripShot Schedule 06 - Fresno \n", + "1 TCRTA TripShot Schedule 06 - Fresno \n", + "2 TCRTA TripShot Schedule 06 - Fresno \n", + "3 TCRTA TripShot Schedule 06 - Fresno \n", + "4 TCRTA TripShot Schedule 06 - Fresno \n", + "... ... ... \n", + "693202 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693203 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693204 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693205 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693206 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "\n", + " organization_source_record_id \\\n", + "0 rec4YWVqVwJ9XqDbq \n", + "1 rec4YWVqVwJ9XqDbq \n", + "2 rec4YWVqVwJ9XqDbq \n", + "3 rec4YWVqVwJ9XqDbq \n", + "4 rec4YWVqVwJ9XqDbq \n", + "... ... \n", + "693202 recC5CT95EufmQCXr \n", + "693203 recC5CT95EufmQCXr \n", + "693204 recC5CT95EufmQCXr \n", + "693205 recC5CT95EufmQCXr \n", + "693206 recC5CT95EufmQCXr \n", + "\n", + " organization_name \\\n", + "0 Tulare County Regional Transit Agency \n", + "1 Tulare County Regional Transit Agency \n", + "2 Tulare County Regional Transit Agency \n", + "3 Tulare County Regional Transit Agency \n", + "4 Tulare County Regional Transit Agency \n", + "... ... \n", + "693202 Santa Clara Valley Transportation Authority \n", + "693203 Santa Clara Valley Transportation Authority \n", + "693204 Santa Clara Valley Transportation Authority \n", + "693205 Santa Clara Valley Transportation Authority \n", + "693206 Santa Clara Valley Transportation Authority \n", + "\n", + " base64_url \\\n", + "0 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "3 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "4 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "... ... \n", + "693202 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693203 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693204 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693205 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693206 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "\n", + " geometry \n", + "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "2 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "3 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", + "4 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", + "... ... \n", + "693202 LINESTRING (-122.10605 37.40280, -122.10581 37... \n", + "693203 LINESTRING (-122.10339 37.40108, -122.10266 37... \n", + "693204 LINESTRING (-122.09992 37.39895, -122.09902 37... \n", + "693205 LINESTRING (-122.09415 37.39670, -122.09225 37... \n", + "693206 LINESTRING (-122.08948 37.39486, -122.08939 37... \n", + "\n", + "[693207 rows x 19 columns]" ] }, - "execution_count": 50, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "list(dict.fromkeys(test))" + "detail" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9964cea8-8418-4d4f-9987-019d34544012", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/rt_segment_speeds/logs/avg_speeds.log b/rt_segment_speeds/logs/avg_speeds.log index 238fee6c7..c91452ed7 100644 --- a/rt_segment_speeds/logs/avg_speeds.log +++ b/rt_segment_speeds/logs/avg_speeds.log @@ -534,3 +534,6 @@ 2024-10-28 10:25:32.613 | INFO | __main__:segment_averages:182 - stop_segments segment averaging for ['2024-10-18'] execution time: 0:04:26.943776 2024-10-28 10:28:46.725 | INFO | __main__:segment_averages:182 - stop_segments segment averaging for ['2024-10-19'] execution time: 0:03:14.004012 2024-10-28 10:31:47.037 | INFO | __main__:segment_averages:182 - stop_segments segment averaging for ['2024-10-20'] execution time: 0:03:00.245588 +2024-11-01 09:18:04.863 | INFO | average_segment_speeds:segment_averages_detail:239 - speedmap_segments detailed segment averaging for ['2024-10-16'] execution time: 0:06:29.243269 +2024-11-01 09:23:55.409 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:05:50.230382 +2024-11-01 09:28:10.012 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:04:14.446376 diff --git a/rt_segment_speeds/scripts/average_segment_speeds.py b/rt_segment_speeds/scripts/average_segment_speeds.py index c7b0b6368..d795407af 100644 --- a/rt_segment_speeds/scripts/average_segment_speeds.py +++ b/rt_segment_speeds/scripts/average_segment_speeds.py @@ -185,7 +185,63 @@ def segment_averages( ) return + +def segment_averages_detail( + analysis_date_list: list, + segment_type: Literal[SEGMENT_TYPES], + group_cols: list, + export_file: str, + weighted_averages: bool = True +): + """ + Experimental function for calculating average speeds. + Start from single day segment-trip speeds and + aggregate by all times of day. + """ + start = datetime.datetime.now() + assert len(analysis_date_list) == 1, 'detailed calculation only avail for single day' + + df = concatenate_trip_segment_speeds( + analysis_date_list, + segment_type, + get_pandas = False + ) + + if weighted_averages: + avg_speeds = delayed(segment_calcs.calculate_avg_speeds)( + df, + group_cols + ["time_of_day"], + ).pipe( + gtfs_schedule_wrangling.merge_operator_identifiers, + analysis_date_list, + columns = CROSSWALK_COLS + ) + + # If a single day is put in, use that date for segment geometry + analysis_date = analysis_date_list[0] + time_span_str = analysis_date + + avg_speeds_with_geom = delayed(merge_in_segment_geometry)( + avg_speeds, + analysis_date, + segment_type + ) + avg_speeds_with_geom = compute(avg_speeds_with_geom)[0] + + utils.geoparquet_gcs_export( + avg_speeds_with_geom, + SEGMENT_GCS, + f"{export_file}_{time_span_str}" + ) + + end = datetime.datetime.now() + logger.info( + f"{segment_type} detailed segment averaging for {analysis_date_list} " + f"execution time: {end - start}" + ) + + return if __name__ == "__main__": diff --git a/rt_segment_speeds/scripts/average_speedmap_segment_speeds.py b/rt_segment_speeds/scripts/average_speedmap_segment_speeds.py index c5643cb6e..cf82fb324 100644 --- a/rt_segment_speeds/scripts/average_speedmap_segment_speeds.py +++ b/rt_segment_speeds/scripts/average_speedmap_segment_speeds.py @@ -8,7 +8,7 @@ from loguru import logger from update_vars import GTFS_DATA_DICT, SEGMENT_GCS -from average_segment_speeds import segment_averages, OPERATOR_COLS +from average_segment_speeds import segment_averages_detail, segment_averages, OPERATOR_COLS if __name__ == "__main__": @@ -29,10 +29,18 @@ STOP_PAIR_COLS = [*dict_inputs["stop_pair_cols"]] SHAPE_SEG_FILE = dict_inputs["shape_stop_single_segment"] + SHAPE_SEG_DETAIL_FILE = dict_inputs["shape_stop_single_segment_detail"] ROUTE_SEG_FILE = dict_inputs["route_dir_single_segment"] for analysis_date in analysis_date_list: + segment_averages_detail( + [analysis_date], + segment_type, + group_cols = OPERATOR_COLS + SHAPE_STOP_COLS + ROUTE_DIR_COLS + STOP_PAIR_COLS, + export_file = SHAPE_SEG_DETAIL_FILE + ) + segment_averages( [analysis_date], segment_type, From f4aeed1132b0471463c3d37a28850012a42e162a Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 1 Nov 2024 16:59:58 +0000 Subject: [PATCH 03/13] create generic count trips by group --- _shared_utils/shared_utils/rt_utils.py | 4 +- ca_transit_speed_maps/01_new_speedmaps.ipynb | 248 ++++++++---------- .../build_speedmaps_index.py | 4 +- rt_delay/rt_analysis/rt_filter_map_plot.py | 2 +- .../40_speedmap_scratchpad.ipynb | 21 ++ .../gtfs_schedule_wrangling.py | 24 +- 6 files changed, 150 insertions(+), 153 deletions(-) diff --git a/_shared_utils/shared_utils/rt_utils.py b/_shared_utils/shared_utils/rt_utils.py index 11e21e0dd..d490fe3af 100644 --- a/_shared_utils/shared_utils/rt_utils.py +++ b/_shared_utils/shared_utils/rt_utils.py @@ -45,8 +45,8 @@ MPH_PER_MPS = 2.237 # use to convert meters/second to miles/hour METERS_PER_MILE = 1609.34 # Colorscale -ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdYlGn_10.scale(vmin=0, vmax=30) -ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)" +# ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdYlGn_10.scale(vmin=0, vmax=30) +# ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)" ACCESS_ZERO_THIRTY_COLORSCALE = branca.colormap.step.RdBu_10.scale(vmin=0, vmax=30) ACCESS_ZERO_THIRTY_COLORSCALE.caption = "Speed (miles per hour)" VARIANCE_COLORS = branca.colormap.step.Blues_06.colors[1:] # actual breaks will vary diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index 02442997c..7223dd258 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 20, "id": "46898b5c-b5cc-4096-ab68-8c3e42fab870", "metadata": {}, "outputs": [], @@ -21,18 +21,22 @@ "import geopandas as gpd\n", "from siuba import *\n", "\n", - "from segment_speed_utils.project_vars import (\n", - " COMPILED_CACHED_VIEWS,\n", - " PROJECT_CRS,\n", - " SEGMENT_GCS,\n", - ")\n", - "\n", "import shared_utils" ] }, { "cell_type": "code", "execution_count": 2, + "id": "cf3d8814-6f22-4a22-8b03-429ebb63a397", + "metadata": {}, + "outputs": [], + "source": [ + "catalog = shared_utils.catalog_utils.get_catalog('gtfs_analytics_data')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, "id": "9f15ed6a-5ab7-4f57-9695-3f762781b74c", "metadata": { "tags": [ @@ -47,7 +51,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 11, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], @@ -60,17 +64,7 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "d0cdaf1a-2c6d-452a-a5cc-210aa2fac2cb", - "metadata": {}, - "outputs": [], - "source": [ - "analysis_date = shared_utils.rt_dates.DATES['aug2024']" - ] - }, - { - "cell_type": "code", - "execution_count": 5, + "execution_count": 12, "id": "eea40f4b-c378-4b70-a80b-bbe79f8441bf", "metadata": { "tags": [] @@ -83,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 17, "id": "c54b78fd-de92-45d9-b54d-49c5b88945c7", "metadata": {}, "outputs": [ @@ -120,13 +114,13 @@ " \n", " \n", " \n", - " 89\n", + " 96\n", " Alameda-Contra Costa Transit District\n", " 4\n", " recOZgevYf7Jimm9L\n", " 04 - Oakland\n", " True\n", - " 2024-08-14\n", + " 2024-10-16\n", " c499f905e33929a641f083dad55c521e\n", " speedmap_segs_available\n", " \n", @@ -136,16 +130,16 @@ ], "text/plain": [ " organization_name organization_itp_id \\\n", - "89 Alameda-Contra Costa Transit District 4 \n", + "96 Alameda-Contra Costa Transit District 4 \n", "\n", " organization_source_record_id caltrans_district _is_current analysis_date \\\n", - "89 recOZgevYf7Jimm9L 04 - Oakland True 2024-08-14 \n", + "96 recOZgevYf7Jimm9L 04 - Oakland True 2024-10-16 \n", "\n", " schedule_gtfs_dataset_key status \n", - "89 c499f905e33929a641f083dad55c521e speedmap_segs_available " + "96 c499f905e33929a641f083dad55c521e speedmap_segs_available " ] }, - "execution_count": 6, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -156,63 +150,42 @@ }, { "cell_type": "code", - "execution_count": 7, - "id": "76edaa5c-039e-419a-ade6-15ebdc018b3c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/'" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "SEGMENT_GCS" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "28317d9e-9f9e-493c-889e-78b8099004e5", + "execution_count": 19, + "id": "1b9762c8-0235-4d8f-b7a4-20a3213eb45e", "metadata": {}, "outputs": [], "source": [ - "# speedmap_segs = gpd.read_parquet(f'{SEGMENT_GCS}segment_options/speedmap_segments_{analysis_date}.parquet')` # non-aggregated" + "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 21, "id": "9302c0ad-1201-4c5a-8267-ec52719cf777", "metadata": {}, "outputs": [], "source": [ - "speedmap_segs = gpd.read_parquet(f'{SEGMENT_GCS}rollup_singleday/speeds_shape_speedmap_segments_{analysis_date}.parquet') # aggregated" + "speedmap_segs = gpd.read_parquet(path) # aggregated" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 22, "id": "19dbeff0-faf6-43e3-9edf-6e68dfeceeac", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id',\n", - " 'route_short_name', 'route_id', 'stop_pair', 'stop_pair_name',\n", - " 'segment_id', 'time_period', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph',\n", - " 'name', 'caltrans_district', 'organization_source_record_id',\n", + "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", + " 'route_short_name', 'stop_pair', 'stop_pair_name', 'segment_id',\n", + " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", + " 'caltrans_district', 'organization_source_record_id',\n", " 'organization_name', 'base64_url', 'geometry'],\n", " dtype='object')" ] }, - "execution_count": 10, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } @@ -223,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 23, "id": "9f3c4c93-a5f5-40d7-9315-63e4fecbd738", "metadata": {}, "outputs": [], @@ -233,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 24, "id": "33038798-16a0-46b5-a50e-2609c5729534", "metadata": {}, "outputs": [ @@ -261,12 +234,12 @@ " schedule_gtfs_dataset_key\n", " shape_array_key\n", " shape_id\n", - " route_short_name\n", " route_id\n", + " route_short_name\n", " stop_pair\n", " stop_pair_name\n", " segment_id\n", - " time_period\n", + " time_of_day\n", " p50_mph\n", " n_trips\n", " p20_mph\n", @@ -281,70 +254,70 @@ " \n", " \n", " \n", - " 309219\n", + " 526507\n", " c499f905e33929a641f083dad55c521e\n", - " c2251ab196e84946d73773d8a60437cb\n", - " shp-217-53\n", - " 217\n", - " 217\n", - " 57211__53699\n", - " Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr\n", - " 57211-53699-1\n", - " offpeak\n", - " 21.17\n", - " 13\n", - " 17.13\n", - " 27.51\n", + " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", + " shp-7-53\n", + " 7\n", + " 7\n", + " 53019__53372\n", + " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", + " 53019-53372-1\n", + " AM Peak\n", + " 5.80\n", + " 1\n", + " 5.80\n", + " 5.80\n", " Bay Area 511 AC Transit Schedule\n", " 04 - Oakland\n", " recOZgevYf7Jimm9L\n", " Alameda-Contra Costa Transit District\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.97141 37.55901, -121.97125 37...\n", + " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", " \n", " \n", - " 309220\n", + " 526508\n", " c499f905e33929a641f083dad55c521e\n", - " c2251ab196e84946d73773d8a60437cb\n", - " shp-217-53\n", - " 217\n", - " 217\n", - " 57211__53699\n", - " Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr\n", - " 57211-53699-1\n", - " peak\n", - " 20.13\n", - " 12\n", - " 15.24\n", - " 25.49\n", + " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", + " shp-7-53\n", + " 7\n", + " 7\n", + " 53019__53372\n", + " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", + " 53019-53372-1\n", + " Early AM\n", + " 22.14\n", + " 1\n", + " 22.14\n", + " 22.14\n", " Bay Area 511 AC Transit Schedule\n", " 04 - Oakland\n", " recOZgevYf7Jimm9L\n", " Alameda-Contra Costa Transit District\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.97141 37.55901, -121.97125 37...\n", + " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", " \n", " \n", - " 309221\n", + " 526509\n", " c499f905e33929a641f083dad55c521e\n", - " c2251ab196e84946d73773d8a60437cb\n", - " shp-217-53\n", - " 217\n", - " 217\n", - " 57211__53699\n", - " Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr\n", - " 57211-53699-1\n", - " all_day\n", - " 20.13\n", - " 25\n", - " 16.44\n", - " 27.51\n", + " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", + " shp-7-53\n", + " 7\n", + " 7\n", + " 53019__53372\n", + " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", + " 53019-53372-1\n", + " Evening\n", + " 22.18\n", + " 4\n", + " 16.06\n", + " 23.19\n", " Bay Area 511 AC Transit Schedule\n", " 04 - Oakland\n", " recOZgevYf7Jimm9L\n", " Alameda-Contra Costa Transit District\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.97141 37.55901, -121.97125 37...\n", + " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", " \n", " \n", "\n", @@ -352,47 +325,47 @@ ], "text/plain": [ " schedule_gtfs_dataset_key shape_array_key \\\n", - "309219 c499f905e33929a641f083dad55c521e c2251ab196e84946d73773d8a60437cb \n", - "309220 c499f905e33929a641f083dad55c521e c2251ab196e84946d73773d8a60437cb \n", - "309221 c499f905e33929a641f083dad55c521e c2251ab196e84946d73773d8a60437cb \n", + "526507 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", + "526508 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", + "526509 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", "\n", - " shape_id route_short_name route_id stop_pair \\\n", - "309219 shp-217-53 217 217 57211__53699 \n", - "309220 shp-217-53 217 217 57211__53699 \n", - "309221 shp-217-53 217 217 57211__53699 \n", + " shape_id route_id route_short_name stop_pair \\\n", + "526507 shp-7-53 7 7 53019__53372 \n", + "526508 shp-7-53 7 7 53019__53372 \n", + "526509 shp-7-53 7 7 53019__53372 \n", "\n", - " stop_pair_name segment_id \\\n", - "309219 Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr 57211-53699-1 \n", - "309220 Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr 57211-53699-1 \n", - "309221 Walnut Av & Guardino Dr__Walnut Av & Gallaudet Dr 57211-53699-1 \n", + " stop_pair_name segment_id \\\n", + "526507 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", + "526508 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", + "526509 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", "\n", - " time_period p50_mph n_trips p20_mph p80_mph \\\n", - "309219 offpeak 21.17 13 17.13 27.51 \n", - "309220 peak 20.13 12 15.24 25.49 \n", - "309221 all_day 20.13 25 16.44 27.51 \n", + " time_of_day p50_mph n_trips p20_mph p80_mph \\\n", + "526507 AM Peak 5.80 1 5.80 5.80 \n", + "526508 Early AM 22.14 1 22.14 22.14 \n", + "526509 Evening 22.18 4 16.06 23.19 \n", "\n", " name caltrans_district \\\n", - "309219 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "309220 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "309221 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + "526507 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + "526508 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + "526509 Bay Area 511 AC Transit Schedule 04 - Oakland \n", "\n", " organization_source_record_id organization_name \\\n", - "309219 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "309220 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "309221 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + "526507 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + "526508 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + "526509 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", "\n", " base64_url \\\n", - "309219 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "309220 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "309221 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "526507 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "526508 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "526509 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", "\n", " geometry \n", - "309219 LINESTRING (-121.97141 37.55901, -121.97125 37... \n", - "309220 LINESTRING (-121.97141 37.55901, -121.97125 37... \n", - "309221 LINESTRING (-121.97141 37.55901, -121.97125 37... " + "526507 LINESTRING (-122.32022 37.92809, -122.32036 37... \n", + "526508 LINESTRING (-122.32022 37.92809, -122.32036 37... \n", + "526509 LINESTRING (-122.32022 37.92809, -122.32036 37... " ] }, - "execution_count": 12, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } @@ -403,23 +376,24 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "id": "8e89173e-a0ea-4823-bbce-0aa6cdb3f075", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array(['offpeak', 'peak', 'all_day'], dtype=object)" + "array(['AM Peak', 'Early AM', 'Evening', 'Midday', 'PM Peak', 'Owl'],\n", + " dtype=object)" ] }, - "execution_count": 13, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "speedmap_segs.time_period.unique()" + "speedmap_segs.time_of_day.unique()" ] }, { @@ -555,7 +529,7 @@ "metadata": {}, "outputs": [], "source": [ - "cmap = shared_utils.rt_utils.ZERO_THIRTY_COLORSCALE\n", + "cmap = shared_utils.rt_utils.ACCESS_ZERO_THIRTY_COLORSCALE\n", "url = shared_utils.rt_utils.SPEEDMAP_LEGEND_URL" ] }, diff --git a/ca_transit_speed_maps/build_speedmaps_index.py b/ca_transit_speed_maps/build_speedmaps_index.py index baa2b454e..38a42fbc0 100644 --- a/ca_transit_speed_maps/build_speedmaps_index.py +++ b/ca_transit_speed_maps/build_speedmaps_index.py @@ -16,7 +16,7 @@ SEGMENT_GCS, ) -ANALYSIS_DATE = dt.date.fromisoformat(rt_dates.DATES['aug2024']) +ANALYSIS_DATE = dt.date.fromisoformat(rt_dates.DATES['oct2024']) PROGRESS_PATH = f'./_rt_progress_{ANALYSIS_DATE}.parquet' def build_speedmaps_index(analysis_date: dt.date, how: str = 'new') -> pd.DataFrame: @@ -62,6 +62,6 @@ def build_speedmaps_index(analysis_date: dt.date, how: str = 'new') -> pd.DataFr if __name__ == "__main__": print(f'analysis date from shared_utils/rt_dates: {ANALYSIS_DATE}') - speedmaps_index = build_speedmaps_index(ANALYSIS_DATE, how = 'old') + speedmaps_index = build_speedmaps_index(ANALYSIS_DATE, how = 'new') # speedmaps_index = rt_utils.check_intermediate_data(speedmaps_index) speedmaps_index.to_parquet(PROGRESS_PATH) \ No newline at end of file diff --git a/rt_delay/rt_analysis/rt_filter_map_plot.py b/rt_delay/rt_analysis/rt_filter_map_plot.py index 35a5ecd0c..0dfed4e7b 100644 --- a/rt_delay/rt_analysis/rt_filter_map_plot.py +++ b/rt_delay/rt_analysis/rt_filter_map_plot.py @@ -310,7 +310,7 @@ def autocorridor(self, shape_id: str, stop_seq_range: list, manual_exclude = {}) return def segment_speed_map(self, segments: str='stops', how: str='low_speeds', - colorscale = ZERO_THIRTY_COLORSCALE, size: list=[900, 550], + colorscale = ACCESS_ZERO_THIRTY_COLORSCALE, size: list=[900, 550], no_title = False, corridor = False, shn = False, no_render = False): ''' Generate a map of segment speeds aggregated across all trips for each shape, either as medians diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 5a521a634..315dfff41 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -354,6 +354,27 @@ "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" ] }, + { + "cell_type": "code", + "execution_count": 16, + "id": "2743cbe7-b472-4ea2-af08-13d2003e93db", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/rollup_singleday/speeds_shape_speedmap_segments_detail_2024-10-16.parquet'" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "path" + ] + }, { "cell_type": "code", "execution_count": 14, diff --git a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py index d73c378bd..ceac5a228 100644 --- a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py +++ b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py @@ -122,6 +122,17 @@ def add_weekday_weekend_column(df: pd.DataFrame, category_dict: dict = time_help return df +def count_trips_by_group(df: pd.DataFrame, group_cols: list): + """ + Given a df with trip_instance_key and an arbitrary list of + group_cols, return trip counts by group. + """ + assert "trip_instance_key" in df.columns + df = (df.groupby(group_cols) + .agg({"trip_instance_key": "count"}) + .reset_index() + ) + return df def aggregate_time_of_day_to_peak_offpeak( df: pd.DataFrame, @@ -141,17 +152,8 @@ def aggregate_time_of_day_to_peak_offpeak( df = add_peak_offpeak_column(df) - all_day = (df.groupby(group_cols) - .agg({"trip_instance_key": "count"}) - .reset_index() - .assign(time_period = "all_day") - ) - - peak_offpeak = (df.groupby(group_cols + ["peak_offpeak"]) - .agg({"trip_instance_key": "count"}) - .reset_index() - .rename(columns = {"peak_offpeak": "time_period"}) - ) + all_day = count_trips_by_group(df, group_cols).assign(time_period = "all_day") + peak_offpeak = count_trips_by_group(df, group_cols + ["peak_offpeak"]).rename({"peak_offpeak":"time_period"}) df2 = pd.concat( [all_day, peak_offpeak], From 0c3250da01bca7a66668377079f5905d65f5413a Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 1 Nov 2024 17:32:15 +0000 Subject: [PATCH 04/13] test out schedule trip counts --- ca_transit_speed_maps/01_new_speedmaps.ipynb | 555 ++++++++++-- .../40_speedmap_scratchpad.ipynb | 810 ++++++------------ .../gtfs_schedule_wrangling.py | 6 +- 3 files changed, 749 insertions(+), 622 deletions(-) diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index 7223dd258..04285db9c 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -398,17 +398,17 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 26, "id": "f87584fb-f37d-4869-ba5d-af70a5a0e0e3", "metadata": {}, "outputs": [], "source": [ - "peak_test = speedmap_segs >> filter(_.time_period == 'peak')" + "peak_test = speedmap_segs >> filter(_.time_of_day == 'AM Peak')" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 27, "id": "c0080473-a119-45b2-8ebc-9f9913b97ecd", "metadata": {}, "outputs": [], @@ -418,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 28, "id": "1df01b6f-c29e-4ccc-9b1f-03cda0241bd9", "metadata": {}, "outputs": [ @@ -451,7 +451,7 @@ " (24, 'Evening')]" ] }, - "execution_count": 16, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } @@ -462,46 +462,46 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 31, "id": "590d0196-ab95-47e8-8ce0-e0b93b4da5d4", "metadata": {}, "outputs": [], "source": [ - "total_peak = len([x[1] for x in time_periods if 'Peak' in x[1]])" + "am_peak_hrs = len([x[1] for x in time_periods if 'AM Peak' in x[1]])" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 32, "id": "c5c469eb-df45-4925-8888-2cc2bfc04cc6", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "8" + "3" ] }, - "execution_count": 18, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "total_peak" + "am_peak_hrs" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 33, "id": "edc84eda-ce2b-481f-ac78-6b7209cb25f4", "metadata": {}, "outputs": [], "source": [ - "def prep_gdf(gdf):\n", + "def prep_gdf(gdf, hrs):\n", " \n", " gdf = gdf.to_crs(calitp_data_analysis.geography_utils.CA_NAD83Albers)\n", - " gdf['trips_per_hour'] = gdf.n_trips / total_peak\n", + " gdf['trips_per_hour'] = gdf.n_trips / hrs\n", "\n", " ## shift to right side of road to display direction\n", " gdf.geometry = gdf.geometry.apply(shared_utils.rt_utils.try_parallel)\n", @@ -514,23 +514,23 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 34, "id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67", "metadata": {}, "outputs": [], "source": [ - "peak_test = prep_gdf(peak_test)" + "peak_test = prep_gdf(peak_test, am_peak_hrs)" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 60, "id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23", "metadata": {}, "outputs": [], "source": [ "cmap = shared_utils.rt_utils.ACCESS_ZERO_THIRTY_COLORSCALE\n", - "url = shared_utils.rt_utils.SPEEDMAP_LEGEND_URL" + "url = shared_utils.rt_utils.ACCESS_SPEEDMAP_LEGEND_URL" ] }, { @@ -543,7 +543,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 36, "id": "87c7db4f-3da9-4ba4-915b-88432a841b39", "metadata": {}, "outputs": [ @@ -571,12 +571,12 @@ " schedule_gtfs_dataset_key\n", " shape_array_key\n", " shape_id\n", - " route_short_name\n", " route_id\n", + " route_short_name\n", " stop_pair\n", " stop_pair_name\n", " segment_id\n", - " time_period\n", + " time_of_day\n", " p50_mph\n", " n_trips\n", " p20_mph\n", @@ -592,50 +592,50 @@ " \n", " \n", " \n", - " 309570\n", + " 526507\n", " c499f905e33929a641f083dad55c521e\n", - " 27122984e995e1e7423bc2c2997df760\n", - " shp-88-10\n", - " 88\n", - " 88\n", - " 58888__52643\n", - " 11th St & Harrison St__11th St & Jackson St\n", - " 58888-52643-1\n", - " peak\n", - " 9.08\n", + " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", + " shp-7-53\n", + " 7\n", + " 7\n", + " 53019__53372\n", + " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", + " 53019-53372-1\n", + " AM Peak\n", + " 5.80\n", " 1\n", - " 9.08\n", - " 9.08\n", + " 5.80\n", + " 5.80\n", " Bay Area 511 AC Transit Schedule\n", " 04 - Oakland\n", " recOZgevYf7Jimm9L\n", " Alameda-Contra Costa Transit District\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " POLYGON ((-199459.554 -21648.451, -199437.653 ...\n", - " 0.125\n", + " POLYGON ((-203712.125 -7192.575, -203734.516 -...\n", + " 0.333333\n", " \n", " \n", - " 309861\n", + " 527527\n", " c499f905e33929a641f083dad55c521e\n", - " 1d260fbbf422c3bbecc4e4a3c30c8445\n", - " shp-12-01\n", - " 12\n", - " 12\n", - " 50414__56926\n", - " 2nd St & Oakland Amtrak__Jackson St & 3rd St\n", - " 50414-56926-1\n", - " peak\n", - " 9.28\n", + " 261a73dd824eab6a8fb3616a320d00e0\n", + " shp-62-01\n", + " 62\n", + " 62\n", + " 50553__57505\n", + " 23rd Av & Foothill Blvd (Garfield School)__23r...\n", + " 50553-57505-1\n", + " AM Peak\n", + " 13.48\n", " 1\n", - " 9.28\n", - " 9.28\n", + " 13.48\n", + " 13.48\n", " Bay Area 511 AC Transit Schedule\n", " 04 - Oakland\n", " recOZgevYf7Jimm9L\n", " Alameda-Contra Costa Transit District\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " POLYGON ((-199632.224 -22363.173, -199606.688 ...\n", - " 0.125\n", + " POLYGON ((-196613.695 -23524.639, -196614.785 ...\n", + " 0.333333\n", " \n", " \n", "\n", @@ -643,39 +643,39 @@ ], "text/plain": [ " schedule_gtfs_dataset_key shape_array_key \\\n", - "309570 c499f905e33929a641f083dad55c521e 27122984e995e1e7423bc2c2997df760 \n", - "309861 c499f905e33929a641f083dad55c521e 1d260fbbf422c3bbecc4e4a3c30c8445 \n", + "526507 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", + "527527 c499f905e33929a641f083dad55c521e 261a73dd824eab6a8fb3616a320d00e0 \n", "\n", - " shape_id route_short_name route_id stop_pair \\\n", - "309570 shp-88-10 88 88 58888__52643 \n", - "309861 shp-12-01 12 12 50414__56926 \n", + " shape_id route_id route_short_name stop_pair \\\n", + "526507 shp-7-53 7 7 53019__53372 \n", + "527527 shp-62-01 62 62 50553__57505 \n", "\n", - " stop_pair_name segment_id \\\n", - "309570 11th St & Harrison St__11th St & Jackson St 58888-52643-1 \n", - "309861 2nd St & Oakland Amtrak__Jackson St & 3rd St 50414-56926-1 \n", + " stop_pair_name segment_id \\\n", + "526507 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", + "527527 23rd Av & Foothill Blvd (Garfield School)__23r... 50553-57505-1 \n", "\n", - " time_period p50_mph n_trips p20_mph p80_mph \\\n", - "309570 peak 9.08 1 9.08 9.08 \n", - "309861 peak 9.28 1 9.28 9.28 \n", + " time_of_day p50_mph n_trips p20_mph p80_mph \\\n", + "526507 AM Peak 5.80 1 5.80 5.80 \n", + "527527 AM Peak 13.48 1 13.48 13.48 \n", "\n", " name caltrans_district \\\n", - "309570 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "309861 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + "526507 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + "527527 Bay Area 511 AC Transit Schedule 04 - Oakland \n", "\n", " organization_source_record_id organization_name \\\n", - "309570 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "309861 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + "526507 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + "527527 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", "\n", " base64_url \\\n", - "309570 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "309861 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "526507 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "527527 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", "\n", " geometry trips_per_hour \n", - "309570 POLYGON ((-199459.554 -21648.451, -199437.653 ... 0.125 \n", - "309861 POLYGON ((-199632.224 -22363.173, -199606.688 ... 0.125 " + "526507 POLYGON ((-203712.125 -7192.575, -203734.516 -... 0.333333 \n", + "527527 POLYGON ((-196613.695 -23524.639, -196614.785 ... 0.333333 " ] }, - "execution_count": 22, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } @@ -698,22 +698,22 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 37, "id": "e7c32718-4eb2-4c2b-aba0-cca397aaabf3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id',\n", - " 'route_short_name', 'route_id', 'stop_pair', 'stop_pair_name',\n", - " 'segment_id', 'time_period', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph',\n", - " 'name', 'caltrans_district', 'organization_source_record_id',\n", + "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", + " 'route_short_name', 'stop_pair', 'stop_pair_name', 'segment_id',\n", + " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", + " 'caltrans_district', 'organization_source_record_id',\n", " 'organization_name', 'base64_url', 'geometry', 'trips_per_hour'],\n", " dtype='object')" ] }, - "execution_count": 23, + "execution_count": 37, "metadata": {}, "output_type": "execute_result" } @@ -732,7 +732,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 38, "id": "10a3ff1d-04f8-40b8-ab91-5ef96fde9b6a", "metadata": {}, "outputs": [ @@ -753,7 +753,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 39, "id": "75f2695e-4b80-4d91-8dce-1fa8e347729b", "metadata": {}, "outputs": [ @@ -761,19 +761,412 @@ "data": { "text/plain": [ "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs 2024-08-14',\n", + " 'layers': [{'name': 'Speedmap Segs 2024-10-16',\n", " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_new.geojson.gz',\n", " 'properties': {'stroked': False,\n", " 'highlight_saturation_multiplier': 0.5,\n", " 'tooltip_speed_key': 'p20_mph'},\n", " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.770058496990686, -122.19994575258353),\n", + " 'lat_lon': (37.777276879932664, -122.20458759054884),\n", " 'zoom': 13,\n", " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIDIwMjQtMDgtMTQiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvNF9uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzcuNzcwMDU4NDk2OTkwNjg2LCAtMTIyLjE5OTk0NTc1MjU4MzUzXSwgInpvb20iOiAxMywgImxlZ2VuZF91cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvc3BlZWRzX2xlZ2VuZC5zdmcifQ=='}" + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvNF9uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzcuNzc3Mjc2ODc5OTMyNjY0LCAtMTIyLjIwNDU4NzU5MDU0ODg0XSwgInpvb20iOiAxMywgImxlZ2VuZF91cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvc3BlZWRzX2xlZ2VuZC5zdmcifQ=='}" ] }, - "execution_count": 25, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "speedmap_state" + ] + }, + { + "cell_type": "markdown", + "id": "6ff8e431-c4e5-4048-8c72-9ac5a5edeb79", + "metadata": {}, + "source": [ + "## other test" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "02ffc2b6-9b8f-456b-ae33-85e7eea79df5", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day = 'PM Peak'" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "2f44c03e-c7cc-4e49-8da4-be653d4c3546", + "metadata": {}, + "outputs": [], + "source": [ + "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "2cbffab5-c927-4a0f-a28f-eb07cf12800f", + "metadata": {}, + "outputs": [], + "source": [ + "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "7c0bb82e-3173-4a4f-a6e4-4bfa66a79044", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hrs" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "id": "53a9f9cc-38d8-44d3-b7a6-a33fca62d32b", + "metadata": {}, + "outputs": [], + "source": [ + "period_test = prep_gdf(period_speeds, hrs)" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day_lower = time_of_day.lower().replace(' ', '_')" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "writing to calitp-map-tiles/testing/4_pm_peak_new.geojson.gz\n" + ] + } + ], + "source": [ + "speedmap_state = shared_utils.rt_utils.set_state_export(\n", + " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", + " color_col='p20_mph', cmap=cmap, legend_url=url,\n", + " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "360aee2f-9076-4c7d-9843-0f7959489f5c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'state_dict': {'name': 'null',\n", + " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_pm_peak_new.geojson.gz',\n", + " 'properties': {'stroked': False,\n", + " 'highlight_saturation_multiplier': 0.5,\n", + " 'tooltip_speed_key': 'p20_mph'},\n", + " 'type': 'speedmap'}],\n", + " 'lat_lon': (37.771147425687175, -122.19794783624761),\n", + " 'zoom': 13,\n", + " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy80X3BtX3BlYWtfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM3Ljc3MTE0NzQyNTY4NzE3NSwgLTEyMi4xOTc5NDc4MzYyNDc2MV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "speedmap_state" + ] + }, + { + "cell_type": "markdown", + "id": "f29d95b7-3637-4ace-9315-0b1b09478a99", + "metadata": {}, + "source": [ + "## other test" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "id": "692413b4-6e8c-44c4-b9e2-11c37d5abfe9", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day = 'Evening'" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "45dcb7c0-e527-4741-81df-a110be42dae4", + "metadata": {}, + "outputs": [], + "source": [ + "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "id": "08a61b27-8974-4c80-9fe4-a6664e280118", + "metadata": {}, + "outputs": [], + "source": [ + "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "3d6e9695-1f1c-40f8-9fd7-6bf35e41d3d2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "5" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hrs" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "id": "a13b1253-f9ac-45d1-ba66-525822cafcc5", + "metadata": {}, + "outputs": [], + "source": [ + "period_test = prep_gdf(period_speeds, hrs)" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "id": "fa109ab2-3d3c-43a6-8c24-1d0397736128", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day_lower = time_of_day.lower().replace(' ', '_')" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "0908e5fb-cd6a-499e-9052-74238259d941", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "writing to calitp-map-tiles/testing/4_evening_new.geojson.gz\n" + ] + } + ], + "source": [ + "speedmap_state = shared_utils.rt_utils.set_state_export(\n", + " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", + " color_col='p20_mph', cmap=cmap, legend_url=url,\n", + " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "af6436d5-91ce-4ef9-a7e3-724799151816", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'state_dict': {'name': 'null',\n", + " 'layers': [{'name': 'Speedmap Segs Evening 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_evening_new.geojson.gz',\n", + " 'properties': {'stroked': False,\n", + " 'highlight_saturation_multiplier': 0.5,\n", + " 'tooltip_speed_key': 'p20_mph'},\n", + " 'type': 'speedmap'}],\n", + " 'lat_lon': (37.771823438071266, -122.20351640174141),\n", + " 'zoom': 13,\n", + " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEV2ZW5pbmcgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy80X2V2ZW5pbmdfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM3Ljc3MTgyMzQzODA3MTI2NiwgLTEyMi4yMDM1MTY0MDE3NDE0MV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "speedmap_state" + ] + }, + { + "cell_type": "markdown", + "id": "efbb48f8-699d-40a8-ae2c-592cf4b1b282", + "metadata": {}, + "source": [ + "## other test" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "id": "3141fcdf-3b66-4136-b67d-62b5813f37dc", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day = 'Owl'" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "id": "d31e588d-06f2-4d70-bfd1-4be43c3460da", + "metadata": {}, + "outputs": [], + "source": [ + "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "07c6e289-89c9-401e-b820-a9badbb36051", + "metadata": {}, + "outputs": [], + "source": [ + "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "e3055d92-61f0-47d5-b1ee-4ba7396ae46c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hrs" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "id": "d01b7893-1d7c-4e9a-bbff-f4714cdedcaa", + "metadata": {}, + "outputs": [], + "source": [ + "period_test = prep_gdf(period_speeds, hrs)" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "id": "e44263d0-0d2c-49d9-ba4a-bdccb4db1d10", + "metadata": {}, + "outputs": [], + "source": [ + "time_of_day_lower = time_of_day.lower().replace(' ', '_')" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "id": "e6512cbd-85e4-4c18-af49-bc2210c98b39", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "writing to calitp-map-tiles/testing/4_owl_new.geojson.gz\n" + ] + } + ], + "source": [ + "speedmap_state = shared_utils.rt_utils.set_state_export(\n", + " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", + " color_col='p20_mph', cmap=cmap, legend_url=url,\n", + " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "id": "6c0d1405-4db8-4d6e-afdb-aded31b21392", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'state_dict': {'name': 'null',\n", + " 'layers': [{'name': 'Speedmap Segs Owl 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_owl_new.geojson.gz',\n", + " 'properties': {'stroked': False,\n", + " 'highlight_saturation_multiplier': 0.5,\n", + " 'tooltip_speed_key': 'p20_mph'},\n", + " 'type': 'speedmap'}],\n", + " 'lat_lon': (37.7948400139263, -122.23030873967325),\n", + " 'zoom': 13,\n", + " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIE93bCAyMDI0LTEwLTE2IiwgInVybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy90ZXN0aW5nLzRfb3dsX25ldy5nZW9qc29uLmd6IiwgInByb3BlcnRpZXMiOiB7InN0cm9rZWQiOiBmYWxzZSwgImhpZ2hsaWdodF9zYXR1cmF0aW9uX211bHRpcGxpZXIiOiAwLjUsICJ0b29sdGlwX3NwZWVkX2tleSI6ICJwMjBfbXBoIn0sICJ0eXBlIjogInNwZWVkbWFwIn1dLCAibGF0X2xvbiI6IFszNy43OTQ4NDAwMTM5MjYzLCAtMTIyLjIzMDMwODczOTY3MzI1XSwgInpvb20iOiAxMywgImxlZ2VuZF91cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvc3BlZWRzX2xlZ2VuZF9jb2xvcl9hY2Nlc3Muc3ZnIn0='}" + ] + }, + "execution_count": 78, "metadata": {}, "output_type": "execute_result" } diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 315dfff41..b08371283 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 13, + "execution_count": 1, "id": "d528f399-cf33-459e-b5dc-92e0b4ae389a", "metadata": {}, "outputs": [], @@ -13,7 +13,7 @@ "import shared_utils\n", "\n", "from calitp_data_analysis import get_fs\n", - "from segment_speed_utils import helpers, time_series_utils\n", + "from segment_speed_utils import helpers, time_series_utils, gtfs_schedule_wrangling\n", "from segment_speed_utils.project_vars import SCHED_GCS, SEGMENT_GCS, GTFS_DATA_DICT, analysis_date" ] }, @@ -84,22 +84,32 @@ "metadata": {}, "outputs": [], "source": [ - "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.stage4}_{analysis_date}.parquet'" + "# path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.stage4}_{analysis_date}.parquet'" ] }, { "cell_type": "code", "execution_count": 6, - "id": "b59806c6-2b6e-449b-be04-2ac59771d122", + "id": "12b824f2-4326-4f5e-ae86-95a46703c948", + "metadata": {}, + "outputs": [], + "source": [ + "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "2743cbe7-b472-4ea2-af08-13d2003e93db", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/speedmap/speeds_2024-10-16.parquet'" + "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/rollup_singleday/speeds_shape_speedmap_segments_detail_2024-10-16.parquet'" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -108,48 +118,20 @@ "path" ] }, - { - "cell_type": "code", - "execution_count": 7, - "id": "6bd54bfc-cfad-487b-bf54-0cab10e72e36", - "metadata": {}, - "outputs": [], - "source": [ - "df = pd.read_parquet(path)" - ] - }, { "cell_type": "code", "execution_count": 8, - "id": "a4808944-fefa-486a-80f2-e75a1ae8b491", + "id": "7669d09d-c49e-448c-b57a-299112614bd0", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['trip_instance_key', 'stop_sequence', 'stop_sequence1',\n", - " 'shape_array_key', 'stop_meters', 'arrival_time', 'arrival_time_sec',\n", - " 'subseq_arrival_time_sec', 'subseq_stop_meters', 'meters_elapsed',\n", - " 'sec_elapsed', 'speed_mph', 'schedule_gtfs_dataset_key', 'route_id',\n", - " 'direction_id', 'route_short_name', 'scheduled_service_minutes',\n", - " 'sched_rt_category', 'time_of_day', 'shape_id', 'segment_id',\n", - " 'stop_pair_name', 'stop_pair'],\n", - " dtype='object')" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "df.columns" + "detail = gpd.read_parquet(path)" ] }, { "cell_type": "code", "execution_count": 9, - "id": "9d0c6313-930a-4285-9f4a-0e5ac64cfde6", + "id": "ddf376af-9781-4943-b0d7-5f5418e07735", "metadata": {}, "outputs": [ { @@ -173,144 +155,143 @@ " \n", " \n", " \n", - " trip_instance_key\n", - " stop_sequence\n", - " stop_sequence1\n", + " schedule_gtfs_dataset_key\n", " shape_array_key\n", - " stop_meters\n", - " arrival_time\n", - " arrival_time_sec\n", - " subseq_arrival_time_sec\n", - " subseq_stop_meters\n", - " meters_elapsed\n", - " ...\n", + " shape_id\n", " route_id\n", - " direction_id\n", " route_short_name\n", - " scheduled_service_minutes\n", - " sched_rt_category\n", - " time_of_day\n", - " shape_id\n", - " segment_id\n", - " stop_pair_name\n", " stop_pair\n", + " stop_pair_name\n", + " segment_id\n", + " time_of_day\n", + " p50_mph\n", + " n_trips\n", + " p20_mph\n", + " p80_mph\n", + " name\n", + " caltrans_district\n", + " organization_source_record_id\n", + " organization_name\n", + " base64_url\n", + " geometry\n", " \n", " \n", " \n", " \n", " 0\n", - " 00000ec4ec4f4cee317f06c981d4965f\n", - " 2\n", - " 2.0\n", - " d0a9e8989ac39227513e69a468f002b5\n", - " 258.571\n", - " 2024-10-16 12:43:01\n", - " 45781\n", - " 45836.0\n", - " 442.814\n", - " 184.243\n", - " ...\n", - " 3\n", - " 0.0\n", - " 3\n", - " 61.0\n", - " schedule_and_vp\n", - " Midday\n", - " 3_0_97\n", - " 12166-91043-1\n", - " Euclid Av & Unity Place Drwy__Euclid Av & Eucl...\n", - " 12166__91043\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " AM Peak\n", + " 17.27\n", + " 4\n", + " 15.20\n", + " 20.96\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 1\n", - " 00000ec4ec4f4cee317f06c981d4965f\n", - " 3\n", - " 3.0\n", - " d0a9e8989ac39227513e69a468f002b5\n", - " 442.814\n", - " 2024-10-16 12:43:56\n", - " 45836\n", - " 45894.0\n", - " 816.841\n", - " 374.027\n", - " ...\n", - " 3\n", - " 0.0\n", - " 3\n", - " 61.0\n", - " schedule_and_vp\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", " Midday\n", - " 3_0_97\n", - " 91043-12165-1\n", - " Euclid Av & Euclid Health Center__Euclid Av & ...\n", - " 91043__12165\n", + " 20.38\n", + " 6\n", + " 18.46\n", + " 23.02\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 2\n", - " 00000ec4ec4f4cee317f06c981d4965f\n", - " 4\n", - " 4.0\n", - " d0a9e8989ac39227513e69a468f002b5\n", - " 816.841\n", - " 2024-10-16 12:44:54\n", - " 45894\n", - " 45921.0\n", - " 1248.511\n", - " 431.670\n", - " ...\n", - " 3\n", - " 0.0\n", - " 3\n", - " 61.0\n", - " schedule_and_vp\n", - " Midday\n", - " 3_0_97\n", - " 12165-12164-1\n", - " Euclid Av & Brooks Huffman Plaza__Euclid Av & ...\n", - " 12165__12164\n", + " 0139b1253130b33adcd4b3a4490530d2\n", + " 51530f7b5ba4cdde7c644c14f262005c\n", + " b0c096a2-4c32-4675-b005-43b58b3781e6\n", + " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", + " C30 WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", + " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", + " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " PM Peak\n", + " 23.90\n", + " 5\n", + " 22.49\n", + " 25.11\n", + " TCRTA TripShot Schedule\n", + " 06 - Fresno\n", + " rec4YWVqVwJ9XqDbq\n", + " Tulare County Regional Transit Agency\n", + " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", + " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", "\n", - "

3 rows × 23 columns

\n", "" ], "text/plain": [ - " trip_instance_key stop_sequence stop_sequence1 \\\n", - "0 00000ec4ec4f4cee317f06c981d4965f 2 2.0 \n", - "1 00000ec4ec4f4cee317f06c981d4965f 3 3.0 \n", - "2 00000ec4ec4f4cee317f06c981d4965f 4 4.0 \n", + " schedule_gtfs_dataset_key shape_array_key \\\n", + "0 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "1 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "2 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "\n", + " shape_id route_id \\\n", + "0 b0c096a2-4c32-4675-b005-43b58b3781e6 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 \n", + "1 b0c096a2-4c32-4675-b005-43b58b3781e6 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 \n", + "2 b0c096a2-4c32-4675-b005-43b58b3781e6 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 \n", "\n", - " shape_array_key stop_meters arrival_time \\\n", - "0 d0a9e8989ac39227513e69a468f002b5 258.571 2024-10-16 12:43:01 \n", - "1 d0a9e8989ac39227513e69a468f002b5 442.814 2024-10-16 12:43:56 \n", - "2 d0a9e8989ac39227513e69a468f002b5 816.841 2024-10-16 12:44:54 \n", + " route_short_name stop_pair \\\n", + "0 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "1 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "2 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", "\n", - " arrival_time_sec subseq_arrival_time_sec subseq_stop_meters \\\n", - "0 45781 45836.0 442.814 \n", - "1 45836 45894.0 816.841 \n", - "2 45894 45921.0 1248.511 \n", + " stop_pair_name \\\n", + "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", "\n", - " meters_elapsed ... route_id direction_id route_short_name \\\n", - "0 184.243 ... 3 0.0 3 \n", - "1 374.027 ... 3 0.0 3 \n", - "2 431.670 ... 3 0.0 3 \n", + " segment_id time_of_day p50_mph \\\n", + "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak 17.27 \n", + "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday 20.38 \n", + "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak 23.90 \n", "\n", - " scheduled_service_minutes sched_rt_category time_of_day shape_id \\\n", - "0 61.0 schedule_and_vp Midday 3_0_97 \n", - "1 61.0 schedule_and_vp Midday 3_0_97 \n", - "2 61.0 schedule_and_vp Midday 3_0_97 \n", + " n_trips p20_mph p80_mph name caltrans_district \\\n", + "0 4 15.20 20.96 TCRTA TripShot Schedule 06 - Fresno \n", + "1 6 18.46 23.02 TCRTA TripShot Schedule 06 - Fresno \n", + "2 5 22.49 25.11 TCRTA TripShot Schedule 06 - Fresno \n", "\n", - " segment_id stop_pair_name \\\n", - "0 12166-91043-1 Euclid Av & Unity Place Drwy__Euclid Av & Eucl... \n", - "1 91043-12165-1 Euclid Av & Euclid Health Center__Euclid Av & ... \n", - "2 12165-12164-1 Euclid Av & Brooks Huffman Plaza__Euclid Av & ... \n", + " organization_source_record_id organization_name \\\n", + "0 rec4YWVqVwJ9XqDbq Tulare County Regional Transit Agency \n", + "1 rec4YWVqVwJ9XqDbq Tulare County Regional Transit Agency \n", + "2 rec4YWVqVwJ9XqDbq Tulare County Regional Transit Agency \n", "\n", - " stop_pair \n", - "0 12166__91043 \n", - "1 91043__12165 \n", - "2 12165__12164 \n", + " base64_url \\\n", + "0 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", "\n", - "[3 rows x 23 columns]" + " geometry \n", + "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "2 LINESTRING (-119.09762 36.41481, -119.09762 36... " ] }, "execution_count": 9, @@ -319,20 +300,19 @@ } ], "source": [ - "df >> head(3)" + "detail >> head(3)" ] }, { "cell_type": "code", "execution_count": 10, - "id": "5e047f33-bd0a-47dd-abec-884518618715", + "id": "64d2f707-77c7-4d4d-be06-156728ae0e2b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array(['Midday', 'Early AM', 'PM Peak', 'Evening', 'AM Peak', 'Owl'],\n", - " dtype=object)" + "{'dir': '${gcs_paths.COMPILED_CACHED_VIEWS}', 'trips': 'trips', 'shapes': 'routelines', 'stops': 'stops', 'stop_times': 'st'}" ] }, "execution_count": 10, @@ -341,32 +321,32 @@ } ], "source": [ - "df.time_of_day.unique()" + "catalog.schedule_downloads" ] }, { "cell_type": "code", "execution_count": 11, - "id": "12b824f2-4326-4f5e-ae86-95a46703c948", + "id": "294b8f67-1486-48e9-8fe9-015b009d8e53", "metadata": {}, "outputs": [], "source": [ - "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" + "path = f'{catalog.schedule_downloads.dir}{catalog.schedule_downloads.trips}_{analysis_date}.parquet'" ] }, { "cell_type": "code", - "execution_count": 16, - "id": "2743cbe7-b472-4ea2-af08-13d2003e93db", + "execution_count": 12, + "id": "508d38d4-086c-43e6-8044-6ded0882e105", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "'gs://calitp-analytics-data/data-analyses/rt_segment_speeds/rollup_singleday/speeds_shape_speedmap_segments_detail_2024-10-16.parquet'" + "'gs://calitp-analytics-data/data-analyses/rt_delay/compiled_cached_views/trips_2024-10-16.parquet'" ] }, - "execution_count": 16, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -375,20 +355,51 @@ "path" ] }, + { + "cell_type": "code", + "execution_count": 13, + "id": "dc3543ea-2544-4917-887e-9de4441fb460", + "metadata": {}, + "outputs": [], + "source": [ + "trips = pd.read_parquet(path)" + ] + }, { "cell_type": "code", "execution_count": 14, - "id": "7669d09d-c49e-448c-b57a-299112614bd0", + "id": "2153ab94-b927-40b4-8496-6bf82b4dd591", "metadata": {}, "outputs": [], "source": [ - "detail = gpd.read_parquet(path)" + "trips = trips >> select(_.trip_instance_key, _.schedule_gtfs_dataset_key == _.gtfs_dataset_key,\n", + " _.route_id, _.direction_id, _.shape_id)" ] }, { "cell_type": "code", "execution_count": 15, - "id": "ddf376af-9781-4943-b0d7-5f5418e07735", + "id": "8ea7c1f6-7b14-4651-8263-c2a76fa9d38c", + "metadata": {}, + "outputs": [], + "source": [ + "time_buckets = gtfs_schedule_wrangling.get_trip_time_buckets(analysis_date)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "75ce3325-f97a-4848-bee2-e034264221a1", + "metadata": {}, + "outputs": [], + "source": [ + "trips = trips >> inner_join(_, time_buckets, on='trip_instance_key')" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "2ad85cd8-59eb-43d2-ac4b-7b4473d6047b", "metadata": {}, "outputs": [ { @@ -412,137 +423,59 @@ " \n", " \n", " \n", - " schedule_gtfs_dataset_key\n", - " shape_array_key\n", - " shape_id\n", " route_id\n", - " route_short_name\n", - " stop_pair\n", - " stop_pair_name\n", - " segment_id\n", + " direction_id\n", + " shape_id\n", " time_of_day\n", - " p50_mph\n", + " schedule_gtfs_dataset_key\n", " n_trips\n", - " p20_mph\n", - " p80_mph\n", - " name\n", - " caltrans_district\n", - " organization_source_record_id\n", - " organization_name\n", - " base64_url\n", - " geometry\n", " \n", " \n", " \n", " \n", " 0\n", - " 0139b1253130b33adcd4b3a4490530d2\n", - " 51530f7b5ba4cdde7c644c14f262005c\n", - " b0c096a2-4c32-4675-b005-43b58b3781e6\n", - " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", - " C30 WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", - " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", + " 001\n", + " 0.0\n", + " 0010111\n", " AM Peak\n", - " 17.27\n", - " 4\n", - " 15.20\n", - " 20.96\n", - " TCRTA TripShot Schedule\n", - " 06 - Fresno\n", - " rec4YWVqVwJ9XqDbq\n", - " Tulare County Regional Transit Agency\n", - " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 3\n", " \n", " \n", " 1\n", - " 0139b1253130b33adcd4b3a4490530d2\n", - " 51530f7b5ba4cdde7c644c14f262005c\n", - " b0c096a2-4c32-4675-b005-43b58b3781e6\n", - " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", - " C30 WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", - " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", - " Midday\n", - " 20.38\n", - " 6\n", - " 18.46\n", - " 23.02\n", - " TCRTA TripShot Schedule\n", - " 06 - Fresno\n", - " rec4YWVqVwJ9XqDbq\n", - " Tulare County Regional Transit Agency\n", - " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", + " 001\n", + " 0.0\n", + " 0010111\n", + " Early AM\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 1\n", " \n", " \n", " 2\n", - " 0139b1253130b33adcd4b3a4490530d2\n", - " 51530f7b5ba4cdde7c644c14f262005c\n", - " b0c096a2-4c32-4675-b005-43b58b3781e6\n", - " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", - " C30 WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", - " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", - " PM Peak\n", - " 23.90\n", + " 001\n", + " 0.0\n", + " 0010111\n", + " Midday\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", " 5\n", - " 22.49\n", - " 25.11\n", - " TCRTA TripShot Schedule\n", - " 06 - Fresno\n", - " rec4YWVqVwJ9XqDbq\n", - " Tulare County Regional Transit Agency\n", - " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", " \n", " \n", " 3\n", - " 0139b1253130b33adcd4b3a4490530d2\n", - " 51530f7b5ba4cdde7c644c14f262005c\n", - " b0c096a2-4c32-4675-b005-43b58b3781e6\n", - " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", - " C30 WB\n", - " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", - " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", - " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", - " AM Peak\n", - " 49.50\n", - " 8\n", - " 43.85\n", - " 51.81\n", - " TCRTA TripShot Schedule\n", - " 06 - Fresno\n", - " rec4YWVqVwJ9XqDbq\n", - " Tulare County Regional Transit Agency\n", - " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.10550 36.41377, -119.10562 36...\n", + " 001\n", + " 0.0\n", + " 0010111\n", + " PM Peak\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 3\n", " \n", " \n", " 4\n", - " 0139b1253130b33adcd4b3a4490530d2\n", - " 51530f7b5ba4cdde7c644c14f262005c\n", - " b0c096a2-4c32-4675-b005-43b58b3781e6\n", - " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", - " C30 WB\n", - " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", - " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", - " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", - " Midday\n", - " 47.58\n", + " 001\n", + " 0.0\n", + " 47840\n", + " AM Peak\n", + " 70c8a8b71c815224299523bf2115924a\n", " 12\n", - " 44.74\n", - " 49.68\n", - " TCRTA TripShot Schedule\n", - " 06 - Fresno\n", - " rec4YWVqVwJ9XqDbq\n", - " Tulare County Regional Transit Agency\n", - " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.10550 36.41377, -119.10562 36...\n", " \n", " \n", " ...\n", @@ -552,303 +485,104 @@ " ...\n", " ...\n", " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", " \n", " \n", - " 693202\n", - " fb467982dcc77a7f9199bebe709bb700\n", - " 8d34a33f017ea0d1498b0cebf26fc5f9\n", - " 114150\n", - " 21\n", - " 21\n", - " 61591__61592\n", - " California & Showers__California & Ortega\n", - " 61591-61592-1\n", - " Evening\n", - " 24.71\n", + " 18369\n", + " shrdserv\n", + " 0.0\n", + " shrdserv_loop_3\n", + " PM Peak\n", + " a8d5f90bfd689badb7e1deb041408e96\n", " 1\n", - " 24.71\n", - " 24.71\n", - " Bay Area 511 Santa Clara Transit Schedule\n", - " 04 - Oakland\n", - " recC5CT95EufmQCXr\n", - " Santa Clara Valley Transportation Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.10605 37.40280, -122.10581 37...\n", " \n", " \n", - " 693203\n", - " fb467982dcc77a7f9199bebe709bb700\n", - " 8d34a33f017ea0d1498b0cebf26fc5f9\n", - " 114150\n", - " 21\n", - " 21\n", - " 61592__61593\n", - " California & Ortega__California & Rengstorff\n", - " 61592-61593-1\n", - " Evening\n", - " 24.68\n", - " 1\n", - " 24.68\n", - " 24.68\n", - " Bay Area 511 Santa Clara Transit Schedule\n", - " 04 - Oakland\n", - " recC5CT95EufmQCXr\n", - " Santa Clara Valley Transportation Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.10339 37.40108, -122.10266 37...\n", + " 18370\n", + " valleywide\n", + " 1.0\n", + " valleywide\n", + " AM Peak\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 12\n", " \n", " \n", - " 693204\n", - " fb467982dcc77a7f9199bebe709bb700\n", - " 8d34a33f017ea0d1498b0cebf26fc5f9\n", - " 114150\n", - " 21\n", - " 21\n", - " 61593__61422\n", - " California & Rengstorff__California & Escuela\n", - " 61593-61422-1\n", + " 18371\n", + " valleywide\n", + " 1.0\n", + " valleywide\n", " Evening\n", - " 24.44\n", - " 1\n", - " 24.44\n", - " 24.44\n", - " Bay Area 511 Santa Clara Transit Schedule\n", - " 04 - Oakland\n", - " recC5CT95EufmQCXr\n", - " Santa Clara Valley Transportation Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.09992 37.39895, -122.09902 37...\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 9\n", " \n", " \n", - " 693205\n", - " fb467982dcc77a7f9199bebe709bb700\n", - " 8d34a33f017ea0d1498b0cebf26fc5f9\n", - " 114150\n", - " 21\n", - " 21\n", - " 61422__61423\n", - " California & Escuela__California & Mariposa\n", - " 61422-61423-1\n", - " Evening\n", - " 15.27\n", - " 1\n", - " 15.27\n", - " 15.27\n", - " Bay Area 511 Santa Clara Transit Schedule\n", - " 04 - Oakland\n", - " recC5CT95EufmQCXr\n", - " Santa Clara Valley Transportation Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.09415 37.39670, -122.09225 37...\n", + " 18372\n", + " valleywide\n", + " 1.0\n", + " valleywide\n", + " Midday\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 20\n", " \n", " \n", - " 693206\n", - " fb467982dcc77a7f9199bebe709bb700\n", - " 8d34a33f017ea0d1498b0cebf26fc5f9\n", - " 114150\n", - " 21\n", - " 21\n", - " 61423__61424\n", - " California & Mariposa__California & Palo Alto\n", - " 61423-61424-1\n", - " Evening\n", - " 14.83\n", - " 1\n", - " 14.83\n", - " 14.83\n", - " Bay Area 511 Santa Clara Transit Schedule\n", - " 04 - Oakland\n", - " recC5CT95EufmQCXr\n", - " Santa Clara Valley Transportation Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.08948 37.39486, -122.08939 37...\n", + " 18373\n", + " valleywide\n", + " 1.0\n", + " valleywide\n", + " PM Peak\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 20\n", " \n", " \n", "\n", - "

693207 rows × 19 columns

\n", + "

18374 rows × 6 columns

\n", "" ], "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "0 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "1 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "2 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "3 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "4 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "... ... ... \n", - "693202 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693203 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693204 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693205 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693206 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "\n", - " shape_id \\\n", - "0 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "1 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "2 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "3 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "4 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "... ... \n", - "693202 114150 \n", - "693203 114150 \n", - "693204 114150 \n", - "693205 114150 \n", - "693206 114150 \n", - "\n", - " route_id route_short_name \\\n", - "0 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "1 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "2 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "3 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "4 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "... ... ... \n", - "693202 21 21 \n", - "693203 21 21 \n", - "693204 21 21 \n", - "693205 21 21 \n", - "693206 21 21 \n", - "\n", - " stop_pair \\\n", - "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "3 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", - "4 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", - "... ... \n", - "693202 61591__61592 \n", - "693203 61592__61593 \n", - "693204 61593__61422 \n", - "693205 61422__61423 \n", - "693206 61423__61424 \n", - "\n", - " stop_pair_name \\\n", - "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "3 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", - "4 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", - "... ... \n", - "693202 California & Showers__California & Ortega \n", - "693203 California & Ortega__California & Rengstorff \n", - "693204 California & Rengstorff__California & Escuela \n", - "693205 California & Escuela__California & Mariposa \n", - "693206 California & Mariposa__California & Palo Alto \n", - "\n", - " segment_id time_of_day \\\n", - "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak \n", - "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday \n", - "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak \n", - "3 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak \n", - "4 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... Midday \n", - "... ... ... \n", - "693202 61591-61592-1 Evening \n", - "693203 61592-61593-1 Evening \n", - "693204 61593-61422-1 Evening \n", - "693205 61422-61423-1 Evening \n", - "693206 61423-61424-1 Evening \n", - "\n", - " p50_mph n_trips p20_mph p80_mph \\\n", - "0 17.27 4 15.20 20.96 \n", - "1 20.38 6 18.46 23.02 \n", - "2 23.90 5 22.49 25.11 \n", - "3 49.50 8 43.85 51.81 \n", - "4 47.58 12 44.74 49.68 \n", - "... ... ... ... ... \n", - "693202 24.71 1 24.71 24.71 \n", - "693203 24.68 1 24.68 24.68 \n", - "693204 24.44 1 24.44 24.44 \n", - "693205 15.27 1 15.27 15.27 \n", - "693206 14.83 1 14.83 14.83 \n", + " route_id direction_id shape_id time_of_day \\\n", + "0 001 0.0 0010111 AM Peak \n", + "1 001 0.0 0010111 Early AM \n", + "2 001 0.0 0010111 Midday \n", + "3 001 0.0 0010111 PM Peak \n", + "4 001 0.0 47840 AM Peak \n", + "... ... ... ... ... \n", + "18369 shrdserv 0.0 shrdserv_loop_3 PM Peak \n", + "18370 valleywide 1.0 valleywide AM Peak \n", + "18371 valleywide 1.0 valleywide Evening \n", + "18372 valleywide 1.0 valleywide Midday \n", + "18373 valleywide 1.0 valleywide PM Peak \n", "\n", - " name caltrans_district \\\n", - "0 TCRTA TripShot Schedule 06 - Fresno \n", - "1 TCRTA TripShot Schedule 06 - Fresno \n", - "2 TCRTA TripShot Schedule 06 - Fresno \n", - "3 TCRTA TripShot Schedule 06 - Fresno \n", - "4 TCRTA TripShot Schedule 06 - Fresno \n", - "... ... ... \n", - "693202 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693203 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693204 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693205 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693206 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + " schedule_gtfs_dataset_key n_trips \n", + "0 9809d3f8121513057bc5cb8de7b54ce2 3 \n", + "1 9809d3f8121513057bc5cb8de7b54ce2 1 \n", + "2 9809d3f8121513057bc5cb8de7b54ce2 5 \n", + "3 9809d3f8121513057bc5cb8de7b54ce2 3 \n", + "4 70c8a8b71c815224299523bf2115924a 12 \n", + "... ... ... \n", + "18369 a8d5f90bfd689badb7e1deb041408e96 1 \n", + "18370 31152914d10e2d0977b8b2fabb167922 12 \n", + "18371 31152914d10e2d0977b8b2fabb167922 9 \n", + "18372 31152914d10e2d0977b8b2fabb167922 20 \n", + "18373 31152914d10e2d0977b8b2fabb167922 20 \n", "\n", - " organization_source_record_id \\\n", - "0 rec4YWVqVwJ9XqDbq \n", - "1 rec4YWVqVwJ9XqDbq \n", - "2 rec4YWVqVwJ9XqDbq \n", - "3 rec4YWVqVwJ9XqDbq \n", - "4 rec4YWVqVwJ9XqDbq \n", - "... ... \n", - "693202 recC5CT95EufmQCXr \n", - "693203 recC5CT95EufmQCXr \n", - "693204 recC5CT95EufmQCXr \n", - "693205 recC5CT95EufmQCXr \n", - "693206 recC5CT95EufmQCXr \n", - "\n", - " organization_name \\\n", - "0 Tulare County Regional Transit Agency \n", - "1 Tulare County Regional Transit Agency \n", - "2 Tulare County Regional Transit Agency \n", - "3 Tulare County Regional Transit Agency \n", - "4 Tulare County Regional Transit Agency \n", - "... ... \n", - "693202 Santa Clara Valley Transportation Authority \n", - "693203 Santa Clara Valley Transportation Authority \n", - "693204 Santa Clara Valley Transportation Authority \n", - "693205 Santa Clara Valley Transportation Authority \n", - "693206 Santa Clara Valley Transportation Authority \n", - "\n", - " base64_url \\\n", - "0 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "3 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "4 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "... ... \n", - "693202 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693203 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693204 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693205 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693206 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "\n", - " geometry \n", - "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "2 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "3 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", - "4 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", - "... ... \n", - "693202 LINESTRING (-122.10605 37.40280, -122.10581 37... \n", - "693203 LINESTRING (-122.10339 37.40108, -122.10266 37... \n", - "693204 LINESTRING (-122.09992 37.39895, -122.09902 37... \n", - "693205 LINESTRING (-122.09415 37.39670, -122.09225 37... \n", - "693206 LINESTRING (-122.08948 37.39486, -122.08939 37... \n", - "\n", - "[693207 rows x 19 columns]" + "[18374 rows x 6 columns]" ] }, - "execution_count": 15, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "detail" + "gtfs_schedule_wrangling.count_trips_by_group(trips, ['route_id', 'direction_id', 'shape_id',\n", + " 'time_of_day', 'schedule_gtfs_dataset_key'])" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a34abeb3-e433-4731-962e-3394af7b6f61", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py index ceac5a228..c11ae220a 100644 --- a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py +++ b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py @@ -131,7 +131,8 @@ def count_trips_by_group(df: pd.DataFrame, group_cols: list): df = (df.groupby(group_cols) .agg({"trip_instance_key": "count"}) .reset_index() - ) + ) + df = df.rename(columns = {"trip_instance_key": "n_trips"}) return df def aggregate_time_of_day_to_peak_offpeak( @@ -158,8 +159,7 @@ def aggregate_time_of_day_to_peak_offpeak( df2 = pd.concat( [all_day, peak_offpeak], axis=0, ignore_index = True - ).rename(columns = {"trip_instance_key": "n_trips"}) - + ) # Add service frequency (trips per hour) # there are different number of hours in peak and offpeak periods From ed23ebaf32f1618de75b218b1bcb2f5692e4350e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 16:24:29 +0000 Subject: [PATCH 05/13] test schedule trips/hr func in nb --- _shared_utils/shared_utils/rt_utils.py | 5 + ca_transit_speed_maps/01_new_speedmaps.ipynb | 976 +++++++++++------- .../40_speedmap_scratchpad.ipynb | 722 ++++++++++++- 3 files changed, 1297 insertions(+), 406 deletions(-) diff --git a/_shared_utils/shared_utils/rt_utils.py b/_shared_utils/shared_utils/rt_utils.py index d490fe3af..a22374cc5 100644 --- a/_shared_utils/shared_utils/rt_utils.py +++ b/_shared_utils/shared_utils/rt_utils.py @@ -561,6 +561,11 @@ def categorize_time_of_day(value: Union[int, dt.datetime]) -> str: else: return "Evening" +def time_of_day_durations(): + """ + Get duration in hours of each time of day classification. + """ + return pd.Series([categorize_time_of_day(x) for x in range(25)]).value_counts() @jit(nopython=True) # numba gives huge speedup here (~60x) def time_at_position_numba(desired_position, shape_array, dt_float_array): diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index 04285db9c..d990d379e 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 20, + "execution_count": 1, "id": "46898b5c-b5cc-4096-ab68-8c3e42fab870", "metadata": {}, "outputs": [], @@ -46,12 +46,12 @@ "outputs": [], "source": [ "## parameters cell\n", - "itp_id = 4" + "itp_id = 167" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 4, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], @@ -64,7 +64,426 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 5, + "id": "1f9f9a1e-7435-45e3-8555-dc1d29a6af00", + "metadata": {}, + "outputs": [], + "source": [ + "speedmap_index = pd.read_parquet(f'_rt_progress_{analysis_date}.parquet') >> filter(_.caltrans_district == '04 - Oakland')" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "a2975449-8fc0-4970-95d8-3429e15b11af", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
organization_nameorganization_itp_idorganization_source_record_idcaltrans_district_is_currentanalysis_dateschedule_gtfs_dataset_keystatus
2City of Union City350recmB4uxrVLRXYF3L04 - OaklandTrue2024-10-16b82a23bef8a501e980c086ef269ffec7speedmap_segs_available
4Capitol Corridor Joint Powers Authority56recvEBkSBc7UxlarC04 - OaklandTrue2024-10-16f5a749dd65924e025b1293c58f95f8d6speedmap_segs_available
5Golden Gate Bridge, Highway and Transportation...127recoX7qMhlPrgfuz304 - OaklandTrue2024-10-16aea4108997c66a74fbdae27b34b69fdespeedmap_segs_available
6Sonoma-Marin Area Rail Transit District315recUmm4gcNXaqrwpn04 - OaklandTrue2024-10-160881af3822466784992a49f1cc57d38fspeedmap_segs_available
7Central Contra Costa Transit Authority61recjnaKVDEgulsko304 - OaklandTrue2024-10-16587e730fac4db21d54037e0f12b0dd5dspeedmap_segs_available
8University of California, Berkeley33recD9x7GHPrN46v6m04 - OaklandTrue2024-10-16a8d5f90bfd689badb7e1deb041408e96speedmap_segs_available
9Solano County Transit310reclLbvvKE1V4zsZg04 - OaklandTrue2024-10-161ebafaca8716652559b2017b6eedc4efspeedmap_segs_available
10Solano Transportation Authority381rec7ShjfgRPLU0yjY04 - OaklandTrue2024-10-161ebafaca8716652559b2017b6eedc4efspeedmap_segs_available
17San Mateo County Transit District290recw3mRsmKDTNnVlT04 - OaklandTrue2024-10-165456c80d420043e15c8eb7368a8a4d89speedmap_segs_available
22Peninsula Corridor Joint Powers Board246rec2ErIfztLMJ4rgG04 - OaklandTrue2024-10-169b4c9cf681dfcc10dffe9523b43598bfspeedmap_segs_available
27City of Santa Rosa301recsNvWvLQwGsoxlE04 - OaklandTrue2024-10-168fa3380c9291d3694494c34b014642d0speedmap_segs_available
32Western Contra Costa Transit Authority368recIKnsnTdKQ0vsiv04 - OaklandTrue2024-10-1678b44303c1714f6c6a4801637c2a5c9dspeedmap_segs_available
39Livermore-Amador Valley Transit Authority167recANs4M9yDhvDyob04 - OaklandFalse2024-10-16dcb6fb26f2d08393f9b0b1c14dc8775cspeedmap_segs_available
41City of Fairfield110recot6qBamlOoLcrM04 - OaklandTrue2024-10-160f5e1b251db53223200c5bfc365d33f2speedmap_segs_available
46Eastern Contra Costa Transit Authority336recEEJVeGrHGoTwgj04 - OaklandTrue2024-10-1655a01ef72af21906934ae8ffb4786e86speedmap_segs_available
50Cloverdale Transit70recRM3c9Zfaft4V2B04 - OaklandTrue2024-10-1609e16227fc42c4fe90204a9d11581034speedmap_segs_available
51Sonoma County314recDupUxInMUgxeiz04 - OaklandTrue2024-10-1609e16227fc42c4fe90204a9d11581034speedmap_segs_available
73Napa Valley Transportation Authority218rec9RGrya9SjWYp2p04 - OaklandTrue2024-10-161dc8ca4d6e9e915c60172b9ff57baefcspeedmap_segs_available
75Santa Clara Valley Transportation Authority294recC5CT95EufmQCXr04 - OaklandTrue2024-10-16fb467982dcc77a7f9199bebe709bb700speedmap_segs_available
85City of Petaluma247recUbGDXhPdx3494b04 - OaklandTrue2024-10-165ecac12d61709ec34b5f30a34fdbab64speedmap_segs_available
89City and County of San Francisco282rechaapWbeffO33OX04 - OaklandTrue2024-10-167cc0cb1871dfd558f11a2885c145d144speedmap_segs_available
96Alameda-Contra Costa Transit District4recOZgevYf7Jimm9L04 - OaklandTrue2024-10-16c499f905e33929a641f083dad55c521espeedmap_segs_available
106San Francisco Bay Area Water Emergency Transit...280recmatCuQAUrNcs8j04 - OaklandTrue2024-10-16de10a800dfec0f380e0abc7204c7dc91speedmap_segs_available
114Marin County Transit District194recNOb7pqBRlQVG5e04 - OaklandTrue2024-10-16015d67d5b75b5cf2b710bbadadfb75f5speedmap_segs_available
117Presidio Trust257recsBfXgev9ICDCY104 - OaklandFalse2024-10-164be4d02062a1a82dae5c039092ee8541speedmap_segs_available
\n", + "
" + ], + "text/plain": [ + " organization_name organization_itp_id \\\n", + "2 City of Union City 350 \n", + "4 Capitol Corridor Joint Powers Authority 56 \n", + "5 Golden Gate Bridge, Highway and Transportation... 127 \n", + "6 Sonoma-Marin Area Rail Transit District 315 \n", + "7 Central Contra Costa Transit Authority 61 \n", + "8 University of California, Berkeley 33 \n", + "9 Solano County Transit 310 \n", + "10 Solano Transportation Authority 381 \n", + "17 San Mateo County Transit District 290 \n", + "22 Peninsula Corridor Joint Powers Board 246 \n", + "27 City of Santa Rosa 301 \n", + "32 Western Contra Costa Transit Authority 368 \n", + "39 Livermore-Amador Valley Transit Authority 167 \n", + "41 City of Fairfield 110 \n", + "46 Eastern Contra Costa Transit Authority 336 \n", + "50 Cloverdale Transit 70 \n", + "51 Sonoma County 314 \n", + "73 Napa Valley Transportation Authority 218 \n", + "75 Santa Clara Valley Transportation Authority 294 \n", + "85 City of Petaluma 247 \n", + "89 City and County of San Francisco 282 \n", + "96 Alameda-Contra Costa Transit District 4 \n", + "106 San Francisco Bay Area Water Emergency Transit... 280 \n", + "114 Marin County Transit District 194 \n", + "117 Presidio Trust 257 \n", + "\n", + " organization_source_record_id caltrans_district _is_current \\\n", + "2 recmB4uxrVLRXYF3L 04 - Oakland True \n", + "4 recvEBkSBc7UxlarC 04 - Oakland True \n", + "5 recoX7qMhlPrgfuz3 04 - Oakland True \n", + "6 recUmm4gcNXaqrwpn 04 - Oakland True \n", + "7 recjnaKVDEgulsko3 04 - Oakland True \n", + "8 recD9x7GHPrN46v6m 04 - Oakland True \n", + "9 reclLbvvKE1V4zsZg 04 - Oakland True \n", + "10 rec7ShjfgRPLU0yjY 04 - Oakland True \n", + "17 recw3mRsmKDTNnVlT 04 - Oakland True \n", + "22 rec2ErIfztLMJ4rgG 04 - Oakland True \n", + "27 recsNvWvLQwGsoxlE 04 - Oakland True \n", + "32 recIKnsnTdKQ0vsiv 04 - Oakland True \n", + "39 recANs4M9yDhvDyob 04 - Oakland False \n", + "41 recot6qBamlOoLcrM 04 - Oakland True \n", + "46 recEEJVeGrHGoTwgj 04 - Oakland True \n", + "50 recRM3c9Zfaft4V2B 04 - Oakland True \n", + "51 recDupUxInMUgxeiz 04 - Oakland True \n", + "73 rec9RGrya9SjWYp2p 04 - Oakland True \n", + "75 recC5CT95EufmQCXr 04 - Oakland True \n", + "85 recUbGDXhPdx3494b 04 - Oakland True \n", + "89 rechaapWbeffO33OX 04 - Oakland True \n", + "96 recOZgevYf7Jimm9L 04 - Oakland True \n", + "106 recmatCuQAUrNcs8j 04 - Oakland True \n", + "114 recNOb7pqBRlQVG5e 04 - Oakland True \n", + "117 recsBfXgev9ICDCY1 04 - Oakland False \n", + "\n", + " analysis_date schedule_gtfs_dataset_key status \n", + "2 2024-10-16 b82a23bef8a501e980c086ef269ffec7 speedmap_segs_available \n", + "4 2024-10-16 f5a749dd65924e025b1293c58f95f8d6 speedmap_segs_available \n", + "5 2024-10-16 aea4108997c66a74fbdae27b34b69fde speedmap_segs_available \n", + "6 2024-10-16 0881af3822466784992a49f1cc57d38f speedmap_segs_available \n", + "7 2024-10-16 587e730fac4db21d54037e0f12b0dd5d speedmap_segs_available \n", + "8 2024-10-16 a8d5f90bfd689badb7e1deb041408e96 speedmap_segs_available \n", + "9 2024-10-16 1ebafaca8716652559b2017b6eedc4ef speedmap_segs_available \n", + "10 2024-10-16 1ebafaca8716652559b2017b6eedc4ef speedmap_segs_available \n", + "17 2024-10-16 5456c80d420043e15c8eb7368a8a4d89 speedmap_segs_available \n", + "22 2024-10-16 9b4c9cf681dfcc10dffe9523b43598bf speedmap_segs_available \n", + "27 2024-10-16 8fa3380c9291d3694494c34b014642d0 speedmap_segs_available \n", + "32 2024-10-16 78b44303c1714f6c6a4801637c2a5c9d speedmap_segs_available \n", + "39 2024-10-16 dcb6fb26f2d08393f9b0b1c14dc8775c speedmap_segs_available \n", + "41 2024-10-16 0f5e1b251db53223200c5bfc365d33f2 speedmap_segs_available \n", + "46 2024-10-16 55a01ef72af21906934ae8ffb4786e86 speedmap_segs_available \n", + "50 2024-10-16 09e16227fc42c4fe90204a9d11581034 speedmap_segs_available \n", + "51 2024-10-16 09e16227fc42c4fe90204a9d11581034 speedmap_segs_available \n", + "73 2024-10-16 1dc8ca4d6e9e915c60172b9ff57baefc speedmap_segs_available \n", + "75 2024-10-16 fb467982dcc77a7f9199bebe709bb700 speedmap_segs_available \n", + "85 2024-10-16 5ecac12d61709ec34b5f30a34fdbab64 speedmap_segs_available \n", + "89 2024-10-16 7cc0cb1871dfd558f11a2885c145d144 speedmap_segs_available \n", + "96 2024-10-16 c499f905e33929a641f083dad55c521e speedmap_segs_available \n", + "106 2024-10-16 de10a800dfec0f380e0abc7204c7dc91 speedmap_segs_available \n", + "114 2024-10-16 015d67d5b75b5cf2b710bbadadfb75f5 speedmap_segs_available \n", + "117 2024-10-16 4be4d02062a1a82dae5c039092ee8541 speedmap_segs_available " + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "speedmap_index" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "id": "eea40f4b-c378-4b70-a80b-bbe79f8441bf", "metadata": { "tags": [] @@ -77,7 +496,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 8, "id": "c54b78fd-de92-45d9-b54d-49c5b88945c7", "metadata": {}, "outputs": [ @@ -114,14 +533,14 @@ " \n", " \n", " \n", - " 96\n", - " Alameda-Contra Costa Transit District\n", - " 4\n", - " recOZgevYf7Jimm9L\n", + " 39\n", + " Livermore-Amador Valley Transit Authority\n", + " 167\n", + " recANs4M9yDhvDyob\n", " 04 - Oakland\n", - " True\n", + " False\n", " 2024-10-16\n", - " c499f905e33929a641f083dad55c521e\n", + " dcb6fb26f2d08393f9b0b1c14dc8775c\n", " speedmap_segs_available\n", " \n", " \n", @@ -129,17 +548,17 @@ "" ], "text/plain": [ - " organization_name organization_itp_id \\\n", - "96 Alameda-Contra Costa Transit District 4 \n", + " organization_name organization_itp_id \\\n", + "39 Livermore-Amador Valley Transit Authority 167 \n", "\n", " organization_source_record_id caltrans_district _is_current analysis_date \\\n", - "96 recOZgevYf7Jimm9L 04 - Oakland True 2024-10-16 \n", + "39 recANs4M9yDhvDyob 04 - Oakland False 2024-10-16 \n", "\n", " schedule_gtfs_dataset_key status \n", - "96 c499f905e33929a641f083dad55c521e speedmap_segs_available " + "39 dcb6fb26f2d08393f9b0b1c14dc8775c speedmap_segs_available " ] }, - "execution_count": 17, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -150,7 +569,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 9, "id": "1b9762c8-0235-4d8f-b7a4-20a3213eb45e", "metadata": {}, "outputs": [], @@ -160,7 +579,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 10, "id": "9302c0ad-1201-4c5a-8267-ec52719cf777", "metadata": {}, "outputs": [], @@ -170,7 +589,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 11, "id": "19dbeff0-faf6-43e3-9edf-6e68dfeceeac", "metadata": {}, "outputs": [ @@ -185,7 +604,7 @@ " dtype='object')" ] }, - "execution_count": 22, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -196,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 12, "id": "9f3c4c93-a5f5-40d7-9315-63e4fecbd738", "metadata": {}, "outputs": [], @@ -206,7 +625,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 13, "id": "33038798-16a0-46b5-a50e-2609c5729534", "metadata": {}, "outputs": [ @@ -254,70 +673,70 @@ " \n", " \n", " \n", - " 526507\n", - " c499f905e33929a641f083dad55c521e\n", - " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", - " shp-7-53\n", - " 7\n", - " 7\n", - " 53019__53372\n", - " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", - " 53019-53372-1\n", - " AM Peak\n", - " 5.80\n", - " 1\n", - " 5.80\n", - " 5.80\n", - " Bay Area 511 AC Transit Schedule\n", + " 599754\n", + " dcb6fb26f2d08393f9b0b1c14dc8775c\n", + " 71cf8d5071087c7a5ac5a4192f73a881\n", + " 44232\n", + " 603\n", + " 603\n", + " 881869__881870\n", + " Las Positas Blvd & Willow Rd__Las Positas Blvd...\n", + " 881869-881870-1\n", + " PM Peak\n", + " 22.71\n", + " 2\n", + " 13.62\n", + " 31.79\n", + " Bay Area 511 Tri-Valley Wheels Schedule\n", " 04 - Oakland\n", - " recOZgevYf7Jimm9L\n", - " Alameda-Contra Costa Transit District\n", + " recANs4M9yDhvDyob\n", + " Livermore-Amador Valley Transit Authority\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", + " LINESTRING (-121.89922 37.68350, -121.89953 37...\n", " \n", " \n", - " 526508\n", - " c499f905e33929a641f083dad55c521e\n", - " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", - " shp-7-53\n", - " 7\n", - " 7\n", - " 53019__53372\n", - " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", - " 53019-53372-1\n", - " Early AM\n", - " 22.14\n", - " 1\n", - " 22.14\n", - " 22.14\n", - " Bay Area 511 AC Transit Schedule\n", + " 599755\n", + " dcb6fb26f2d08393f9b0b1c14dc8775c\n", + " 71cf8d5071087c7a5ac5a4192f73a881\n", + " 44232\n", + " 603\n", + " 603\n", + " 881870__882311\n", + " Las Positas Blvd & Hopyard Rd__Las Positas Blv...\n", + " 881870-882311-1\n", + " PM Peak\n", + " 9.12\n", + " 2\n", + " 7.97\n", + " 10.26\n", + " Bay Area 511 Tri-Valley Wheels Schedule\n", " 04 - Oakland\n", - " recOZgevYf7Jimm9L\n", - " Alameda-Contra Costa Transit District\n", + " recANs4M9yDhvDyob\n", + " Livermore-Amador Valley Transit Authority\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", + " LINESTRING (-121.90267 37.68194, -121.90291 37...\n", " \n", " \n", - " 526509\n", - " c499f905e33929a641f083dad55c521e\n", - " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", - " shp-7-53\n", - " 7\n", - " 7\n", - " 53019__53372\n", - " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", - " 53019-53372-1\n", - " Evening\n", - " 22.18\n", + " 599756\n", + " dcb6fb26f2d08393f9b0b1c14dc8775c\n", + " 71cf8d5071087c7a5ac5a4192f73a881\n", + " 44232\n", + " 603\n", + " 603\n", + " 882311__882707\n", + " Las Positas Blvd & Dorman Rd__Muirwood Dr & La...\n", + " 882311-882707-1\n", + " PM Peak\n", + " 18.23\n", " 4\n", - " 16.06\n", - " 23.19\n", - " Bay Area 511 AC Transit Schedule\n", + " 17.26\n", + " 19.30\n", + " Bay Area 511 Tri-Valley Wheels Schedule\n", " 04 - Oakland\n", - " recOZgevYf7Jimm9L\n", - " Alameda-Contra Costa Transit District\n", + " recANs4M9yDhvDyob\n", + " Livermore-Amador Valley Transit Authority\n", " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-122.32022 37.92809, -122.32036 37...\n", + " LINESTRING (-121.90600 37.68078, -121.90618 37...\n", " \n", " \n", "\n", @@ -325,47 +744,52 @@ ], "text/plain": [ " schedule_gtfs_dataset_key shape_array_key \\\n", - "526507 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", - "526508 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", - "526509 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", + "599754 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", + "599755 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", + "599756 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", "\n", - " shape_id route_id route_short_name stop_pair \\\n", - "526507 shp-7-53 7 7 53019__53372 \n", - "526508 shp-7-53 7 7 53019__53372 \n", - "526509 shp-7-53 7 7 53019__53372 \n", + " shape_id route_id route_short_name stop_pair \\\n", + "599754 44232 603 603 881869__881870 \n", + "599755 44232 603 603 881870__882311 \n", + "599756 44232 603 603 882311__882707 \n", "\n", - " stop_pair_name segment_id \\\n", - "526507 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", - "526508 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", - "526509 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", + " stop_pair_name segment_id \\\n", + "599754 Las Positas Blvd & Willow Rd__Las Positas Blvd... 881869-881870-1 \n", + "599755 Las Positas Blvd & Hopyard Rd__Las Positas Blv... 881870-882311-1 \n", + "599756 Las Positas Blvd & Dorman Rd__Muirwood Dr & La... 882311-882707-1 \n", "\n", " time_of_day p50_mph n_trips p20_mph p80_mph \\\n", - "526507 AM Peak 5.80 1 5.80 5.80 \n", - "526508 Early AM 22.14 1 22.14 22.14 \n", - "526509 Evening 22.18 4 16.06 23.19 \n", + "599754 PM Peak 22.71 2 13.62 31.79 \n", + "599755 PM Peak 9.12 2 7.97 10.26 \n", + "599756 PM Peak 18.23 4 17.26 19.30 \n", "\n", - " name caltrans_district \\\n", - "526507 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "526508 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "526509 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + " name caltrans_district \\\n", + "599754 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", + "599755 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", + "599756 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", "\n", - " organization_source_record_id organization_name \\\n", - "526507 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "526508 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "526509 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + " organization_source_record_id \\\n", + "599754 recANs4M9yDhvDyob \n", + "599755 recANs4M9yDhvDyob \n", + "599756 recANs4M9yDhvDyob \n", + "\n", + " organization_name \\\n", + "599754 Livermore-Amador Valley Transit Authority \n", + "599755 Livermore-Amador Valley Transit Authority \n", + "599756 Livermore-Amador Valley Transit Authority \n", "\n", " base64_url \\\n", - "526507 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "526508 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "526509 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "599754 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "599755 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "599756 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", "\n", " geometry \n", - "526507 LINESTRING (-122.32022 37.92809, -122.32036 37... \n", - "526508 LINESTRING (-122.32022 37.92809, -122.32036 37... \n", - "526509 LINESTRING (-122.32022 37.92809, -122.32036 37... " + "599754 LINESTRING (-121.89922 37.68350, -121.89953 37... \n", + "599755 LINESTRING (-121.90267 37.68194, -121.90291 37... \n", + "599756 LINESTRING (-121.90600 37.68078, -121.90618 37... " ] }, - "execution_count": 24, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -376,18 +800,18 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 14, "id": "8e89173e-a0ea-4823-bbce-0aa6cdb3f075", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array(['AM Peak', 'Early AM', 'Evening', 'Midday', 'PM Peak', 'Owl'],\n", + "array(['PM Peak', 'AM Peak', 'Early AM', 'Midday', 'Evening'],\n", " dtype=object)" ] }, - "execution_count": 25, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -398,7 +822,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 15, "id": "f87584fb-f37d-4869-ba5d-af70a5a0e0e3", "metadata": {}, "outputs": [], @@ -408,24 +832,52 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 16, "id": "c0080473-a119-45b2-8ebc-9f9913b97ecd", "metadata": {}, "outputs": [], "source": [ - "time_periods = [(x, shared_utils.rt_utils.categorize_time_of_day(x)) for x in range(1, 25)]" + "time_periods = [(x, shared_utils.rt_utils.categorize_time_of_day(x)) for x in range(25)]" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 20, + "id": "7b72ddbb-4b1b-4169-bfcd-f64eb499ac85", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Midday 5\n", + "PM Peak 5\n", + "Evening 5\n", + "Owl 4\n", + "Early AM 3\n", + "AM Peak 3\n", + "dtype: int64" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pd.Series([shared_utils.rt_utils.categorize_time_of_day(x) for x in range(25)]).value_counts()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, "id": "1df01b6f-c29e-4ccc-9b1f-03cda0241bd9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[(1, 'Owl'),\n", + "[(0, 'Owl'),\n", + " (1, 'Owl'),\n", " (2, 'Owl'),\n", " (3, 'Owl'),\n", " (4, 'Early AM'),\n", @@ -451,7 +903,7 @@ " (24, 'Evening')]" ] }, - "execution_count": 28, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -462,7 +914,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 18, "id": "590d0196-ab95-47e8-8ce0-e0b93b4da5d4", "metadata": {}, "outputs": [], @@ -792,17 +1244,17 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 95, "id": "02ffc2b6-9b8f-456b-ae33-85e7eea79df5", "metadata": {}, "outputs": [], "source": [ - "time_of_day = 'PM Peak'" + "time_of_day = 'Early AM'" ] }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 96, "id": "2f44c03e-c7cc-4e49-8da4-be653d4c3546", "metadata": {}, "outputs": [], @@ -812,7 +1264,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 97, "id": "2cbffab5-c927-4a0f-a28f-eb07cf12800f", "metadata": {}, "outputs": [], @@ -822,17 +1274,17 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 98, "id": "7c0bb82e-3173-4a4f-a6e4-4bfa66a79044", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "5" + "3" ] }, - "execution_count": 49, + "execution_count": 98, "metadata": {}, "output_type": "execute_result" } @@ -843,7 +1295,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 99, "id": "53a9f9cc-38d8-44d3-b7a6-a33fca62d32b", "metadata": {}, "outputs": [], @@ -853,7 +1305,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 100, "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", "metadata": {}, "outputs": [], @@ -863,7 +1315,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 101, "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", "metadata": {}, "outputs": [ @@ -871,7 +1323,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "writing to calitp-map-tiles/testing/4_pm_peak_new.geojson.gz\n" + "writing to calitp-map-tiles/testing/4_early_am_new.geojson.gz\n" ] } ], @@ -884,7 +1336,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 102, "id": "360aee2f-9076-4c7d-9843-0f7959489f5c", "metadata": {}, "outputs": [ @@ -892,281 +1344,19 @@ "data": { "text/plain": [ "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_pm_peak_new.geojson.gz',\n", - " 'properties': {'stroked': False,\n", - " 'highlight_saturation_multiplier': 0.5,\n", - " 'tooltip_speed_key': 'p20_mph'},\n", - " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.771147425687175, -122.19794783624761),\n", - " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy80X3BtX3BlYWtfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM3Ljc3MTE0NzQyNTY4NzE3NSwgLTEyMi4xOTc5NDc4MzYyNDc2MV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" - ] - }, - "execution_count": 62, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_state" - ] - }, - { - "cell_type": "markdown", - "id": "f29d95b7-3637-4ace-9315-0b1b09478a99", - "metadata": {}, - "source": [ - "## other test" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "id": "692413b4-6e8c-44c4-b9e2-11c37d5abfe9", - "metadata": {}, - "outputs": [], - "source": [ - "time_of_day = 'Evening'" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "id": "45dcb7c0-e527-4741-81df-a110be42dae4", - "metadata": {}, - "outputs": [], - "source": [ - "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" - ] - }, - { - "cell_type": "code", - "execution_count": 65, - "id": "08a61b27-8974-4c80-9fe4-a6664e280118", - "metadata": {}, - "outputs": [], - "source": [ - "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "id": "3d6e9695-1f1c-40f8-9fd7-6bf35e41d3d2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "5" - ] - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "hrs" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "id": "a13b1253-f9ac-45d1-ba66-525822cafcc5", - "metadata": {}, - "outputs": [], - "source": [ - "period_test = prep_gdf(period_speeds, hrs)" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "id": "fa109ab2-3d3c-43a6-8c24-1d0397736128", - "metadata": {}, - "outputs": [], - "source": [ - "time_of_day_lower = time_of_day.lower().replace(' ', '_')" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "id": "0908e5fb-cd6a-499e-9052-74238259d941", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "writing to calitp-map-tiles/testing/4_evening_new.geojson.gz\n" - ] - } - ], - "source": [ - "speedmap_state = shared_utils.rt_utils.set_state_export(\n", - " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", - " color_col='p20_mph', cmap=cmap, legend_url=url,\n", - " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "id": "af6436d5-91ce-4ef9-a7e3-724799151816", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs Evening 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_evening_new.geojson.gz',\n", - " 'properties': {'stroked': False,\n", - " 'highlight_saturation_multiplier': 0.5,\n", - " 'tooltip_speed_key': 'p20_mph'},\n", - " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.771823438071266, -122.20351640174141),\n", - " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEV2ZW5pbmcgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy80X2V2ZW5pbmdfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM3Ljc3MTgyMzQzODA3MTI2NiwgLTEyMi4yMDM1MTY0MDE3NDE0MV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" - ] - }, - "execution_count": 70, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_state" - ] - }, - { - "cell_type": "markdown", - "id": "efbb48f8-699d-40a8-ae2c-592cf4b1b282", - "metadata": {}, - "source": [ - "## other test" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "id": "3141fcdf-3b66-4136-b67d-62b5813f37dc", - "metadata": {}, - "outputs": [], - "source": [ - "time_of_day = 'Owl'" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "id": "d31e588d-06f2-4d70-bfd1-4be43c3460da", - "metadata": {}, - "outputs": [], - "source": [ - "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "id": "07c6e289-89c9-401e-b820-a9badbb36051", - "metadata": {}, - "outputs": [], - "source": [ - "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "id": "e3055d92-61f0-47d5-b1ee-4ba7396ae46c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "execution_count": 74, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "hrs" - ] - }, - { - "cell_type": "code", - "execution_count": 75, - "id": "d01b7893-1d7c-4e9a-bbff-f4714cdedcaa", - "metadata": {}, - "outputs": [], - "source": [ - "period_test = prep_gdf(period_speeds, hrs)" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "id": "e44263d0-0d2c-49d9-ba4a-bdccb4db1d10", - "metadata": {}, - "outputs": [], - "source": [ - "time_of_day_lower = time_of_day.lower().replace(' ', '_')" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "id": "e6512cbd-85e4-4c18-af49-bc2210c98b39", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "writing to calitp-map-tiles/testing/4_owl_new.geojson.gz\n" - ] - } - ], - "source": [ - "speedmap_state = shared_utils.rt_utils.set_state_export(\n", - " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", - " color_col='p20_mph', cmap=cmap, legend_url=url,\n", - " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "id": "6c0d1405-4db8-4d6e-afdb-aded31b21392", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs Owl 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_owl_new.geojson.gz',\n", + " 'layers': [{'name': 'Speedmap Segs Early AM 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_early_am_new.geojson.gz',\n", " 'properties': {'stroked': False,\n", " 'highlight_saturation_multiplier': 0.5,\n", " 'tooltip_speed_key': 'p20_mph'},\n", " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.7948400139263, -122.23030873967325),\n", + " 'lat_lon': (37.77940573965417, -122.21209975403526),\n", " 'zoom': 13,\n", " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIE93bCAyMDI0LTEwLTE2IiwgInVybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy90ZXN0aW5nLzRfb3dsX25ldy5nZW9qc29uLmd6IiwgInByb3BlcnRpZXMiOiB7InN0cm9rZWQiOiBmYWxzZSwgImhpZ2hsaWdodF9zYXR1cmF0aW9uX211bHRpcGxpZXIiOiAwLjUsICJ0b29sdGlwX3NwZWVkX2tleSI6ICJwMjBfbXBoIn0sICJ0eXBlIjogInNwZWVkbWFwIn1dLCAibGF0X2xvbiI6IFszNy43OTQ4NDAwMTM5MjYzLCAtMTIyLjIzMDMwODczOTY3MzI1XSwgInpvb20iOiAxMywgImxlZ2VuZF91cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvc3BlZWRzX2xlZ2VuZF9jb2xvcl9hY2Nlc3Muc3ZnIn0='}" + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEVhcmx5IEFNIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvNF9lYXJseV9hbV9uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzcuNzc5NDA1NzM5NjU0MTcsIC0xMjIuMjEyMDk5NzU0MDM1MjZdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" ] }, - "execution_count": 78, + "execution_count": 102, "metadata": {}, "output_type": "execute_result" } diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index b08371283..29757e05d 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -306,6 +306,471 @@ { "cell_type": "code", "execution_count": 10, + "id": "f8201973-a5cf-4349-88c2-bfb171cc3484", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_idroute_short_namestop_pairstop_pair_namesegment_idtime_of_dayp50_mphn_tripsp20_mphp80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometry
00139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...AM Peak17.27415.2020.96TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
10139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...Midday20.38618.4623.02TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
20139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...PM Peak23.90522.4925.11TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
30139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...Cypress St & Naranjo Blvd WB__Millwood and Roa...5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...AM Peak49.50843.8551.81TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.10550 36.41377, -119.10562 36...
40139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...Cypress St & Naranjo Blvd WB__Millwood and Roa...5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...Midday47.581244.7449.68TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.10550 36.41377, -119.10562 36...
............................................................
693202fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161591__61592California & Showers__California & Ortega61591-61592-1Evening24.71124.7124.71Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.10605 37.40280, -122.10581 37...
693203fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161592__61593California & Ortega__California & Rengstorff61592-61593-1Evening24.68124.6824.68Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.10339 37.40108, -122.10266 37...
693204fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161593__61422California & Rengstorff__California & Escuela61593-61422-1Evening24.44124.4424.44Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.09992 37.39895, -122.09902 37...
693205fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161422__61423California & Escuela__California & Mariposa61422-61423-1Evening15.27115.2715.27Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.09415 37.39670, -122.09225 37...
693206fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161423__61424California & Mariposa__California & Palo Alto61423-61424-1Evening14.83114.8314.83Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.08948 37.39486, -122.08939 37...
\n", + "

693207 rows × 19 columns

\n", + "
" + ], + "text/plain": [ + " schedule_gtfs_dataset_key shape_array_key \\\n", + "0 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "1 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "2 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "3 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "4 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", + "... ... ... \n", + "693202 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693203 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693204 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693205 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "693206 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", + "\n", + " shape_id \\\n", + "0 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "1 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "2 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "3 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "4 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", + "... ... \n", + "693202 114150 \n", + "693203 114150 \n", + "693204 114150 \n", + "693205 114150 \n", + "693206 114150 \n", + "\n", + " route_id route_short_name \\\n", + "0 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "1 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "2 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "3 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "4 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", + "... ... ... \n", + "693202 21 21 \n", + "693203 21 21 \n", + "693204 21 21 \n", + "693205 21 21 \n", + "693206 21 21 \n", + "\n", + " stop_pair \\\n", + "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "3 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", + "4 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", + "... ... \n", + "693202 61591__61592 \n", + "693203 61592__61593 \n", + "693204 61593__61422 \n", + "693205 61422__61423 \n", + "693206 61423__61424 \n", + "\n", + " stop_pair_name \\\n", + "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "3 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", + "4 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", + "... ... \n", + "693202 California & Showers__California & Ortega \n", + "693203 California & Ortega__California & Rengstorff \n", + "693204 California & Rengstorff__California & Escuela \n", + "693205 California & Escuela__California & Mariposa \n", + "693206 California & Mariposa__California & Palo Alto \n", + "\n", + " segment_id time_of_day \\\n", + "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak \n", + "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday \n", + "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak \n", + "3 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak \n", + "4 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... Midday \n", + "... ... ... \n", + "693202 61591-61592-1 Evening \n", + "693203 61592-61593-1 Evening \n", + "693204 61593-61422-1 Evening \n", + "693205 61422-61423-1 Evening \n", + "693206 61423-61424-1 Evening \n", + "\n", + " p50_mph n_trips p20_mph p80_mph \\\n", + "0 17.27 4 15.20 20.96 \n", + "1 20.38 6 18.46 23.02 \n", + "2 23.90 5 22.49 25.11 \n", + "3 49.50 8 43.85 51.81 \n", + "4 47.58 12 44.74 49.68 \n", + "... ... ... ... ... \n", + "693202 24.71 1 24.71 24.71 \n", + "693203 24.68 1 24.68 24.68 \n", + "693204 24.44 1 24.44 24.44 \n", + "693205 15.27 1 15.27 15.27 \n", + "693206 14.83 1 14.83 14.83 \n", + "\n", + " name caltrans_district \\\n", + "0 TCRTA TripShot Schedule 06 - Fresno \n", + "1 TCRTA TripShot Schedule 06 - Fresno \n", + "2 TCRTA TripShot Schedule 06 - Fresno \n", + "3 TCRTA TripShot Schedule 06 - Fresno \n", + "4 TCRTA TripShot Schedule 06 - Fresno \n", + "... ... ... \n", + "693202 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693203 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693204 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693205 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "693206 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", + "\n", + " organization_source_record_id \\\n", + "0 rec4YWVqVwJ9XqDbq \n", + "1 rec4YWVqVwJ9XqDbq \n", + "2 rec4YWVqVwJ9XqDbq \n", + "3 rec4YWVqVwJ9XqDbq \n", + "4 rec4YWVqVwJ9XqDbq \n", + "... ... \n", + "693202 recC5CT95EufmQCXr \n", + "693203 recC5CT95EufmQCXr \n", + "693204 recC5CT95EufmQCXr \n", + "693205 recC5CT95EufmQCXr \n", + "693206 recC5CT95EufmQCXr \n", + "\n", + " organization_name \\\n", + "0 Tulare County Regional Transit Agency \n", + "1 Tulare County Regional Transit Agency \n", + "2 Tulare County Regional Transit Agency \n", + "3 Tulare County Regional Transit Agency \n", + "4 Tulare County Regional Transit Agency \n", + "... ... \n", + "693202 Santa Clara Valley Transportation Authority \n", + "693203 Santa Clara Valley Transportation Authority \n", + "693204 Santa Clara Valley Transportation Authority \n", + "693205 Santa Clara Valley Transportation Authority \n", + "693206 Santa Clara Valley Transportation Authority \n", + "\n", + " base64_url \\\n", + "0 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "3 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "4 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", + "... ... \n", + "693202 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693203 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693204 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693205 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "693206 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + "\n", + " geometry \n", + "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "2 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", + "3 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", + "4 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", + "... ... \n", + "693202 LINESTRING (-122.10605 37.40280, -122.10581 37... \n", + "693203 LINESTRING (-122.10339 37.40108, -122.10266 37... \n", + "693204 LINESTRING (-122.09992 37.39895, -122.09902 37... \n", + "693205 LINESTRING (-122.09415 37.39670, -122.09225 37... \n", + "693206 LINESTRING (-122.08948 37.39486, -122.08939 37... \n", + "\n", + "[693207 rows x 19 columns]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "detail" + ] + }, + { + "cell_type": "code", + "execution_count": 11, "id": "64d2f707-77c7-4d4d-be06-156728ae0e2b", "metadata": {}, "outputs": [ @@ -315,7 +780,7 @@ "{'dir': '${gcs_paths.COMPILED_CACHED_VIEWS}', 'trips': 'trips', 'shapes': 'routelines', 'stops': 'stops', 'stop_times': 'st'}" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -326,7 +791,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "id": "294b8f67-1486-48e9-8fe9-015b009d8e53", "metadata": {}, "outputs": [], @@ -336,7 +801,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "id": "508d38d4-086c-43e6-8044-6ded0882e105", "metadata": {}, "outputs": [ @@ -346,7 +811,7 @@ "'gs://calitp-analytics-data/data-analyses/rt_delay/compiled_cached_views/trips_2024-10-16.parquet'" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -357,7 +822,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "id": "dc3543ea-2544-4917-887e-9de4441fb460", "metadata": {}, "outputs": [], @@ -367,7 +832,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "id": "2153ab94-b927-40b4-8496-6bf82b4dd591", "metadata": {}, "outputs": [], @@ -378,7 +843,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "id": "8ea7c1f6-7b14-4651-8263-c2a76fa9d38c", "metadata": {}, "outputs": [], @@ -388,7 +853,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "id": "75ce3325-f97a-4848-bee2-e034264221a1", "metadata": {}, "outputs": [], @@ -398,7 +863,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "id": "2ad85cd8-59eb-43d2-ac4b-7b4473d6047b", "metadata": {}, "outputs": [ @@ -566,21 +1031,252 @@ "[18374 rows x 6 columns]" ] }, - "execution_count": 18, + "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "gtfs_schedule_wrangling.count_trips_by_group(trips, ['route_id', 'direction_id', 'shape_id',\n", - " 'time_of_day', 'schedule_gtfs_dataset_key'])" + "schedule_trip_counts = gtfs_schedule_wrangling.count_trips_by_group(trips, ['route_id', 'direction_id', 'shape_id',\n", + " 'time_of_day', 'schedule_gtfs_dataset_key'])\n", + "schedule_trip_counts" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "a34abeb3-e433-4731-962e-3394af7b6f61", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Midday 5\n", + "PM Peak 5\n", + "Evening 5\n", + "Owl 4\n", + "Early AM 3\n", + "AM Peak 3\n", + "dtype: int64" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "durations = shared_utils.rt_utils.time_of_day_durations()\n", + "durations" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "f1b1c9f1-166f-4f64-81d7-51c8eb4b23ff", + "metadata": {}, + "outputs": [], + "source": [ + "schedule_trip_counts['trips_hr'] = schedule_trip_counts.apply(\n", + " lambda x: x.n_trips / durations[x.time_of_day], axis=1)" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "be6afedb-9009-4374-9cd8-dba841487615", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
route_iddirection_idshape_idtime_of_dayschedule_gtfs_dataset_keyn_tripstrips_hr
00010.00010111AM Peak9809d3f8121513057bc5cb8de7b54ce231.000000
10010.00010111Early AM9809d3f8121513057bc5cb8de7b54ce210.333333
20010.00010111Midday9809d3f8121513057bc5cb8de7b54ce251.000000
30010.00010111PM Peak9809d3f8121513057bc5cb8de7b54ce230.600000
40010.047840AM Peak70c8a8b71c815224299523bf2115924a124.000000
........................
18369shrdserv0.0shrdserv_loop_3PM Peaka8d5f90bfd689badb7e1deb041408e9610.200000
18370valleywide1.0valleywideAM Peak31152914d10e2d0977b8b2fabb167922124.000000
18371valleywide1.0valleywideEvening31152914d10e2d0977b8b2fabb16792291.800000
18372valleywide1.0valleywideMidday31152914d10e2d0977b8b2fabb167922204.000000
18373valleywide1.0valleywidePM Peak31152914d10e2d0977b8b2fabb167922204.000000
\n", + "

18374 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " route_id direction_id shape_id time_of_day \\\n", + "0 001 0.0 0010111 AM Peak \n", + "1 001 0.0 0010111 Early AM \n", + "2 001 0.0 0010111 Midday \n", + "3 001 0.0 0010111 PM Peak \n", + "4 001 0.0 47840 AM Peak \n", + "... ... ... ... ... \n", + "18369 shrdserv 0.0 shrdserv_loop_3 PM Peak \n", + "18370 valleywide 1.0 valleywide AM Peak \n", + "18371 valleywide 1.0 valleywide Evening \n", + "18372 valleywide 1.0 valleywide Midday \n", + "18373 valleywide 1.0 valleywide PM Peak \n", + "\n", + " schedule_gtfs_dataset_key n_trips trips_hr \n", + "0 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 \n", + "1 9809d3f8121513057bc5cb8de7b54ce2 1 0.333333 \n", + "2 9809d3f8121513057bc5cb8de7b54ce2 5 1.000000 \n", + "3 9809d3f8121513057bc5cb8de7b54ce2 3 0.600000 \n", + "4 70c8a8b71c815224299523bf2115924a 12 4.000000 \n", + "... ... ... ... \n", + "18369 a8d5f90bfd689badb7e1deb041408e96 1 0.200000 \n", + "18370 31152914d10e2d0977b8b2fabb167922 12 4.000000 \n", + "18371 31152914d10e2d0977b8b2fabb167922 9 1.800000 \n", + "18372 31152914d10e2d0977b8b2fabb167922 20 4.000000 \n", + "18373 31152914d10e2d0977b8b2fabb167922 20 4.000000 \n", + "\n", + "[18374 rows x 7 columns]" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "schedule_trip_counts" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "de097b6e-9b83-4d3a-b3e6-3646c7c7be86", + "metadata": {}, "outputs": [], "source": [] } From ac4c40976f1aee89b907c2ef69fb6804dcfce796 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 21:22:58 +0000 Subject: [PATCH 06/13] tweak functions, test --- _shared_utils/shared_utils/rt_utils.py | 2 +- ca_transit_speed_maps/01_new_speedmaps.ipynb | 1089 ++++------------ .../40_speedmap_scratchpad.ipynb | 1104 ++++++----------- rt_segment_speeds/logs/avg_speeds.log | 3 + .../scripts/average_segment_speeds.py | 6 + .../gtfs_schedule_wrangling.py | 21 + 6 files changed, 628 insertions(+), 1597 deletions(-) diff --git a/_shared_utils/shared_utils/rt_utils.py b/_shared_utils/shared_utils/rt_utils.py index a22374cc5..5b987b404 100644 --- a/_shared_utils/shared_utils/rt_utils.py +++ b/_shared_utils/shared_utils/rt_utils.py @@ -561,7 +561,7 @@ def categorize_time_of_day(value: Union[int, dt.datetime]) -> str: else: return "Evening" -def time_of_day_durations(): +def time_of_day_durations() -> pd.Series: """ Get duration in hours of each time of day classification. """ diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index d990d379e..dd18c87f5 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -21,7 +21,8 @@ "import geopandas as gpd\n", "from siuba import *\n", "\n", - "import shared_utils" + "import shared_utils\n", + "import segment_speed_utils" ] }, { @@ -36,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 36, "id": "9f15ed6a-5ab7-4f57-9695-3f762781b74c", "metadata": { "tags": [ @@ -46,12 +47,12 @@ "outputs": [], "source": [ "## parameters cell\n", - "itp_id = 167" + "itp_id = 182" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 37, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], @@ -64,426 +65,7 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "1f9f9a1e-7435-45e3-8555-dc1d29a6af00", - "metadata": {}, - "outputs": [], - "source": [ - "speedmap_index = pd.read_parquet(f'_rt_progress_{analysis_date}.parquet') >> filter(_.caltrans_district == '04 - Oakland')" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "a2975449-8fc0-4970-95d8-3429e15b11af", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
organization_nameorganization_itp_idorganization_source_record_idcaltrans_district_is_currentanalysis_dateschedule_gtfs_dataset_keystatus
2City of Union City350recmB4uxrVLRXYF3L04 - OaklandTrue2024-10-16b82a23bef8a501e980c086ef269ffec7speedmap_segs_available
4Capitol Corridor Joint Powers Authority56recvEBkSBc7UxlarC04 - OaklandTrue2024-10-16f5a749dd65924e025b1293c58f95f8d6speedmap_segs_available
5Golden Gate Bridge, Highway and Transportation...127recoX7qMhlPrgfuz304 - OaklandTrue2024-10-16aea4108997c66a74fbdae27b34b69fdespeedmap_segs_available
6Sonoma-Marin Area Rail Transit District315recUmm4gcNXaqrwpn04 - OaklandTrue2024-10-160881af3822466784992a49f1cc57d38fspeedmap_segs_available
7Central Contra Costa Transit Authority61recjnaKVDEgulsko304 - OaklandTrue2024-10-16587e730fac4db21d54037e0f12b0dd5dspeedmap_segs_available
8University of California, Berkeley33recD9x7GHPrN46v6m04 - OaklandTrue2024-10-16a8d5f90bfd689badb7e1deb041408e96speedmap_segs_available
9Solano County Transit310reclLbvvKE1V4zsZg04 - OaklandTrue2024-10-161ebafaca8716652559b2017b6eedc4efspeedmap_segs_available
10Solano Transportation Authority381rec7ShjfgRPLU0yjY04 - OaklandTrue2024-10-161ebafaca8716652559b2017b6eedc4efspeedmap_segs_available
17San Mateo County Transit District290recw3mRsmKDTNnVlT04 - OaklandTrue2024-10-165456c80d420043e15c8eb7368a8a4d89speedmap_segs_available
22Peninsula Corridor Joint Powers Board246rec2ErIfztLMJ4rgG04 - OaklandTrue2024-10-169b4c9cf681dfcc10dffe9523b43598bfspeedmap_segs_available
27City of Santa Rosa301recsNvWvLQwGsoxlE04 - OaklandTrue2024-10-168fa3380c9291d3694494c34b014642d0speedmap_segs_available
32Western Contra Costa Transit Authority368recIKnsnTdKQ0vsiv04 - OaklandTrue2024-10-1678b44303c1714f6c6a4801637c2a5c9dspeedmap_segs_available
39Livermore-Amador Valley Transit Authority167recANs4M9yDhvDyob04 - OaklandFalse2024-10-16dcb6fb26f2d08393f9b0b1c14dc8775cspeedmap_segs_available
41City of Fairfield110recot6qBamlOoLcrM04 - OaklandTrue2024-10-160f5e1b251db53223200c5bfc365d33f2speedmap_segs_available
46Eastern Contra Costa Transit Authority336recEEJVeGrHGoTwgj04 - OaklandTrue2024-10-1655a01ef72af21906934ae8ffb4786e86speedmap_segs_available
50Cloverdale Transit70recRM3c9Zfaft4V2B04 - OaklandTrue2024-10-1609e16227fc42c4fe90204a9d11581034speedmap_segs_available
51Sonoma County314recDupUxInMUgxeiz04 - OaklandTrue2024-10-1609e16227fc42c4fe90204a9d11581034speedmap_segs_available
73Napa Valley Transportation Authority218rec9RGrya9SjWYp2p04 - OaklandTrue2024-10-161dc8ca4d6e9e915c60172b9ff57baefcspeedmap_segs_available
75Santa Clara Valley Transportation Authority294recC5CT95EufmQCXr04 - OaklandTrue2024-10-16fb467982dcc77a7f9199bebe709bb700speedmap_segs_available
85City of Petaluma247recUbGDXhPdx3494b04 - OaklandTrue2024-10-165ecac12d61709ec34b5f30a34fdbab64speedmap_segs_available
89City and County of San Francisco282rechaapWbeffO33OX04 - OaklandTrue2024-10-167cc0cb1871dfd558f11a2885c145d144speedmap_segs_available
96Alameda-Contra Costa Transit District4recOZgevYf7Jimm9L04 - OaklandTrue2024-10-16c499f905e33929a641f083dad55c521espeedmap_segs_available
106San Francisco Bay Area Water Emergency Transit...280recmatCuQAUrNcs8j04 - OaklandTrue2024-10-16de10a800dfec0f380e0abc7204c7dc91speedmap_segs_available
114Marin County Transit District194recNOb7pqBRlQVG5e04 - OaklandTrue2024-10-16015d67d5b75b5cf2b710bbadadfb75f5speedmap_segs_available
117Presidio Trust257recsBfXgev9ICDCY104 - OaklandFalse2024-10-164be4d02062a1a82dae5c039092ee8541speedmap_segs_available
\n", - "
" - ], - "text/plain": [ - " organization_name organization_itp_id \\\n", - "2 City of Union City 350 \n", - "4 Capitol Corridor Joint Powers Authority 56 \n", - "5 Golden Gate Bridge, Highway and Transportation... 127 \n", - "6 Sonoma-Marin Area Rail Transit District 315 \n", - "7 Central Contra Costa Transit Authority 61 \n", - "8 University of California, Berkeley 33 \n", - "9 Solano County Transit 310 \n", - "10 Solano Transportation Authority 381 \n", - "17 San Mateo County Transit District 290 \n", - "22 Peninsula Corridor Joint Powers Board 246 \n", - "27 City of Santa Rosa 301 \n", - "32 Western Contra Costa Transit Authority 368 \n", - "39 Livermore-Amador Valley Transit Authority 167 \n", - "41 City of Fairfield 110 \n", - "46 Eastern Contra Costa Transit Authority 336 \n", - "50 Cloverdale Transit 70 \n", - "51 Sonoma County 314 \n", - "73 Napa Valley Transportation Authority 218 \n", - "75 Santa Clara Valley Transportation Authority 294 \n", - "85 City of Petaluma 247 \n", - "89 City and County of San Francisco 282 \n", - "96 Alameda-Contra Costa Transit District 4 \n", - "106 San Francisco Bay Area Water Emergency Transit... 280 \n", - "114 Marin County Transit District 194 \n", - "117 Presidio Trust 257 \n", - "\n", - " organization_source_record_id caltrans_district _is_current \\\n", - "2 recmB4uxrVLRXYF3L 04 - Oakland True \n", - "4 recvEBkSBc7UxlarC 04 - Oakland True \n", - "5 recoX7qMhlPrgfuz3 04 - Oakland True \n", - "6 recUmm4gcNXaqrwpn 04 - Oakland True \n", - "7 recjnaKVDEgulsko3 04 - Oakland True \n", - "8 recD9x7GHPrN46v6m 04 - Oakland True \n", - "9 reclLbvvKE1V4zsZg 04 - Oakland True \n", - "10 rec7ShjfgRPLU0yjY 04 - Oakland True \n", - "17 recw3mRsmKDTNnVlT 04 - Oakland True \n", - "22 rec2ErIfztLMJ4rgG 04 - Oakland True \n", - "27 recsNvWvLQwGsoxlE 04 - Oakland True \n", - "32 recIKnsnTdKQ0vsiv 04 - Oakland True \n", - "39 recANs4M9yDhvDyob 04 - Oakland False \n", - "41 recot6qBamlOoLcrM 04 - Oakland True \n", - "46 recEEJVeGrHGoTwgj 04 - Oakland True \n", - "50 recRM3c9Zfaft4V2B 04 - Oakland True \n", - "51 recDupUxInMUgxeiz 04 - Oakland True \n", - "73 rec9RGrya9SjWYp2p 04 - Oakland True \n", - "75 recC5CT95EufmQCXr 04 - Oakland True \n", - "85 recUbGDXhPdx3494b 04 - Oakland True \n", - "89 rechaapWbeffO33OX 04 - Oakland True \n", - "96 recOZgevYf7Jimm9L 04 - Oakland True \n", - "106 recmatCuQAUrNcs8j 04 - Oakland True \n", - "114 recNOb7pqBRlQVG5e 04 - Oakland True \n", - "117 recsBfXgev9ICDCY1 04 - Oakland False \n", - "\n", - " analysis_date schedule_gtfs_dataset_key status \n", - "2 2024-10-16 b82a23bef8a501e980c086ef269ffec7 speedmap_segs_available \n", - "4 2024-10-16 f5a749dd65924e025b1293c58f95f8d6 speedmap_segs_available \n", - "5 2024-10-16 aea4108997c66a74fbdae27b34b69fde speedmap_segs_available \n", - "6 2024-10-16 0881af3822466784992a49f1cc57d38f speedmap_segs_available \n", - "7 2024-10-16 587e730fac4db21d54037e0f12b0dd5d speedmap_segs_available \n", - "8 2024-10-16 a8d5f90bfd689badb7e1deb041408e96 speedmap_segs_available \n", - "9 2024-10-16 1ebafaca8716652559b2017b6eedc4ef speedmap_segs_available \n", - "10 2024-10-16 1ebafaca8716652559b2017b6eedc4ef speedmap_segs_available \n", - "17 2024-10-16 5456c80d420043e15c8eb7368a8a4d89 speedmap_segs_available \n", - "22 2024-10-16 9b4c9cf681dfcc10dffe9523b43598bf speedmap_segs_available \n", - "27 2024-10-16 8fa3380c9291d3694494c34b014642d0 speedmap_segs_available \n", - "32 2024-10-16 78b44303c1714f6c6a4801637c2a5c9d speedmap_segs_available \n", - "39 2024-10-16 dcb6fb26f2d08393f9b0b1c14dc8775c speedmap_segs_available \n", - "41 2024-10-16 0f5e1b251db53223200c5bfc365d33f2 speedmap_segs_available \n", - "46 2024-10-16 55a01ef72af21906934ae8ffb4786e86 speedmap_segs_available \n", - "50 2024-10-16 09e16227fc42c4fe90204a9d11581034 speedmap_segs_available \n", - "51 2024-10-16 09e16227fc42c4fe90204a9d11581034 speedmap_segs_available \n", - "73 2024-10-16 1dc8ca4d6e9e915c60172b9ff57baefc speedmap_segs_available \n", - "75 2024-10-16 fb467982dcc77a7f9199bebe709bb700 speedmap_segs_available \n", - "85 2024-10-16 5ecac12d61709ec34b5f30a34fdbab64 speedmap_segs_available \n", - "89 2024-10-16 7cc0cb1871dfd558f11a2885c145d144 speedmap_segs_available \n", - "96 2024-10-16 c499f905e33929a641f083dad55c521e speedmap_segs_available \n", - "106 2024-10-16 de10a800dfec0f380e0abc7204c7dc91 speedmap_segs_available \n", - "114 2024-10-16 015d67d5b75b5cf2b710bbadadfb75f5 speedmap_segs_available \n", - "117 2024-10-16 4be4d02062a1a82dae5c039092ee8541 speedmap_segs_available " - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_index" - ] - }, - { - "cell_type": "code", - "execution_count": 7, + "execution_count": 38, "id": "eea40f4b-c378-4b70-a80b-bbe79f8441bf", "metadata": { "tags": [] @@ -496,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 39, "id": "c54b78fd-de92-45d9-b54d-49c5b88945c7", "metadata": {}, "outputs": [ @@ -533,14 +115,14 @@ " \n", " \n", " \n", - " 39\n", - " Livermore-Amador Valley Transit Authority\n", - " 167\n", - " recANs4M9yDhvDyob\n", - " 04 - Oakland\n", - " False\n", + " 42\n", + " Los Angeles County Metropolitan Transportation...\n", + " 182\n", + " recPnGkwdpnr8jmHB\n", + " 07 - Los Angeles\n", + " True\n", " 2024-10-16\n", - " dcb6fb26f2d08393f9b0b1c14dc8775c\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", " speedmap_segs_available\n", " \n", " \n", @@ -548,17 +130,17 @@ "" ], "text/plain": [ - " organization_name organization_itp_id \\\n", - "39 Livermore-Amador Valley Transit Authority 167 \n", + " organization_name organization_itp_id \\\n", + "42 Los Angeles County Metropolitan Transportation... 182 \n", "\n", " organization_source_record_id caltrans_district _is_current analysis_date \\\n", - "39 recANs4M9yDhvDyob 04 - Oakland False 2024-10-16 \n", + "42 recPnGkwdpnr8jmHB 07 - Los Angeles True 2024-10-16 \n", "\n", " schedule_gtfs_dataset_key status \n", - "39 dcb6fb26f2d08393f9b0b1c14dc8775c speedmap_segs_available " + "42 0666caf3ec1ecc96b74f4477ee4bc939 speedmap_segs_available " ] }, - "execution_count": 8, + "execution_count": 39, "metadata": {}, "output_type": "execute_result" } @@ -569,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 40, "id": "1b9762c8-0235-4d8f-b7a4-20a3213eb45e", "metadata": {}, "outputs": [], @@ -579,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 41, "id": "9302c0ad-1201-4c5a-8267-ec52719cf777", "metadata": {}, "outputs": [], @@ -589,33 +171,17 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 42, "id": "19dbeff0-faf6-43e3-9edf-6e68dfeceeac", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", - " 'route_short_name', 'stop_pair', 'stop_pair_name', 'segment_id',\n", - " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", - " 'caltrans_district', 'organization_source_record_id',\n", - " 'organization_name', 'base64_url', 'geometry'],\n", - " dtype='object')" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "speedmap_segs.columns" + "# speedmap_segs.columns" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 43, "id": "9f3c4c93-a5f5-40d7-9315-63e4fecbd738", "metadata": {}, "outputs": [], @@ -625,8 +191,8 @@ }, { "cell_type": "code", - "execution_count": 13, - "id": "33038798-16a0-46b5-a50e-2609c5729534", + "execution_count": 69, + "id": "e35e835e-9041-4735-917b-2517532e6166", "metadata": {}, "outputs": [ { @@ -660,7 +226,7 @@ " segment_id\n", " time_of_day\n", " p50_mph\n", - " n_trips\n", + " ...\n", " p20_mph\n", " p80_mph\n", " name\n", @@ -669,127 +235,138 @@ " organization_name\n", " base64_url\n", " geometry\n", + " n_trips_sch\n", + " trips_hr_sch\n", " \n", " \n", " \n", " \n", - " 599754\n", - " dcb6fb26f2d08393f9b0b1c14dc8775c\n", - " 71cf8d5071087c7a5ac5a4192f73a881\n", - " 44232\n", - " 603\n", - " 603\n", - " 881869__881870\n", - " Las Positas Blvd & Willow Rd__Las Positas Blvd...\n", - " 881869-881870-1\n", - " PM Peak\n", - " 22.71\n", - " 2\n", - " 13.62\n", - " 31.79\n", - " Bay Area 511 Tri-Valley Wheels Schedule\n", - " 04 - Oakland\n", - " recANs4M9yDhvDyob\n", - " Livermore-Amador Valley Transit Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.89922 37.68350, -121.89953 37...\n", + " 9729\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 1d801329ec1c7b1da3460ede3c0fe8bc\n", + " 1200106_JUNE24\n", + " 120-13183\n", + " 120\n", + " 16644__14345\n", + " Whittwood Center__Santa Gertrudes / Starbuck\n", + " 16644-14345-1\n", + " AM Peak\n", + " 14.49\n", + " ...\n", + " 13.00\n", + " 16.38\n", + " LA Metro Bus Schedule\n", + " 07 - Los Angeles\n", + " recPnGkwdpnr8jmHB\n", + " Los Angeles County Metropolitan Transportation...\n", + " aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...\n", + " LINESTRING (-117.99579 33.94440, -117.99579 33...\n", + " 4\n", + " 1.333333\n", " \n", " \n", - " 599755\n", - " dcb6fb26f2d08393f9b0b1c14dc8775c\n", - " 71cf8d5071087c7a5ac5a4192f73a881\n", - " 44232\n", - " 603\n", - " 603\n", - " 881870__882311\n", - " Las Positas Blvd & Hopyard Rd__Las Positas Blv...\n", - " 881870-882311-1\n", - " PM Peak\n", - " 9.12\n", - " 2\n", - " 7.97\n", - " 10.26\n", - " Bay Area 511 Tri-Valley Wheels Schedule\n", - " 04 - Oakland\n", - " recANs4M9yDhvDyob\n", - " Livermore-Amador Valley Transit Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.90267 37.68194, -121.90291 37...\n", + " 9730\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 1d801329ec1c7b1da3460ede3c0fe8bc\n", + " 1200106_JUNE24\n", + " 120-13183\n", + " 120\n", + " 14345__14346\n", + " Santa Gertrudes / Starbuck__Santa Gertrudes / ...\n", + " 14345-14346-1\n", + " AM Peak\n", + " 26.67\n", + " ...\n", + " 22.58\n", + " 28.96\n", + " LA Metro Bus Schedule\n", + " 07 - Los Angeles\n", + " recPnGkwdpnr8jmHB\n", + " Los Angeles County Metropolitan Transportation...\n", + " aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...\n", + " LINESTRING (-117.99307 33.93974, -117.99307 33...\n", + " 4\n", + " 1.333333\n", " \n", " \n", - " 599756\n", - " dcb6fb26f2d08393f9b0b1c14dc8775c\n", - " 71cf8d5071087c7a5ac5a4192f73a881\n", - " 44232\n", - " 603\n", - " 603\n", - " 882311__882707\n", - " Las Positas Blvd & Dorman Rd__Muirwood Dr & La...\n", - " 882311-882707-1\n", - " PM Peak\n", - " 18.23\n", + " 9731\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 1d801329ec1c7b1da3460ede3c0fe8bc\n", + " 1200106_JUNE24\n", + " 120-13183\n", + " 120\n", + " 14346__14344\n", + " Santa Gertrudes / Yermo__Santa Gertrudes / Lef...\n", + " 14346-14344-1\n", + " AM Peak\n", + " 11.10\n", + " ...\n", + " 7.31\n", + " 16.04\n", + " LA Metro Bus Schedule\n", + " 07 - Los Angeles\n", + " recPnGkwdpnr8jmHB\n", + " Los Angeles County Metropolitan Transportation...\n", + " aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...\n", + " LINESTRING (-117.99308 33.93630, -117.99308 33...\n", " 4\n", - " 17.26\n", - " 19.30\n", - " Bay Area 511 Tri-Valley Wheels Schedule\n", - " 04 - Oakland\n", - " recANs4M9yDhvDyob\n", - " Livermore-Amador Valley Transit Authority\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " LINESTRING (-121.90600 37.68078, -121.90618 37...\n", + " 1.333333\n", " \n", " \n", "\n", + "

3 rows × 21 columns

\n", "" ], "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "599754 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", - "599755 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", - "599756 dcb6fb26f2d08393f9b0b1c14dc8775c 71cf8d5071087c7a5ac5a4192f73a881 \n", + " schedule_gtfs_dataset_key shape_array_key \\\n", + "9729 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", + "9730 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", + "9731 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", "\n", - " shape_id route_id route_short_name stop_pair \\\n", - "599754 44232 603 603 881869__881870 \n", - "599755 44232 603 603 881870__882311 \n", - "599756 44232 603 603 882311__882707 \n", + " shape_id route_id route_short_name stop_pair \\\n", + "9729 1200106_JUNE24 120-13183 120 16644__14345 \n", + "9730 1200106_JUNE24 120-13183 120 14345__14346 \n", + "9731 1200106_JUNE24 120-13183 120 14346__14344 \n", "\n", - " stop_pair_name segment_id \\\n", - "599754 Las Positas Blvd & Willow Rd__Las Positas Blvd... 881869-881870-1 \n", - "599755 Las Positas Blvd & Hopyard Rd__Las Positas Blv... 881870-882311-1 \n", - "599756 Las Positas Blvd & Dorman Rd__Muirwood Dr & La... 882311-882707-1 \n", + " stop_pair_name segment_id \\\n", + "9729 Whittwood Center__Santa Gertrudes / Starbuck 16644-14345-1 \n", + "9730 Santa Gertrudes / Starbuck__Santa Gertrudes / ... 14345-14346-1 \n", + "9731 Santa Gertrudes / Yermo__Santa Gertrudes / Lef... 14346-14344-1 \n", "\n", - " time_of_day p50_mph n_trips p20_mph p80_mph \\\n", - "599754 PM Peak 22.71 2 13.62 31.79 \n", - "599755 PM Peak 9.12 2 7.97 10.26 \n", - "599756 PM Peak 18.23 4 17.26 19.30 \n", + " time_of_day p50_mph ... p20_mph p80_mph name \\\n", + "9729 AM Peak 14.49 ... 13.00 16.38 LA Metro Bus Schedule \n", + "9730 AM Peak 26.67 ... 22.58 28.96 LA Metro Bus Schedule \n", + "9731 AM Peak 11.10 ... 7.31 16.04 LA Metro Bus Schedule \n", "\n", - " name caltrans_district \\\n", - "599754 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", - "599755 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", - "599756 Bay Area 511 Tri-Valley Wheels Schedule 04 - Oakland \n", + " caltrans_district organization_source_record_id \\\n", + "9729 07 - Los Angeles recPnGkwdpnr8jmHB \n", + "9730 07 - Los Angeles recPnGkwdpnr8jmHB \n", + "9731 07 - Los Angeles recPnGkwdpnr8jmHB \n", "\n", - " organization_source_record_id \\\n", - "599754 recANs4M9yDhvDyob \n", - "599755 recANs4M9yDhvDyob \n", - "599756 recANs4M9yDhvDyob \n", + " organization_name \\\n", + "9729 Los Angeles County Metropolitan Transportation... \n", + "9730 Los Angeles County Metropolitan Transportation... \n", + "9731 Los Angeles County Metropolitan Transportation... \n", "\n", - " organization_name \\\n", - "599754 Livermore-Amador Valley Transit Authority \n", - "599755 Livermore-Amador Valley Transit Authority \n", - "599756 Livermore-Amador Valley Transit Authority \n", + " base64_url \\\n", + "9729 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "9730 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "9731 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", "\n", - " base64_url \\\n", - "599754 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "599755 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "599756 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + " geometry n_trips_sch \\\n", + "9729 LINESTRING (-117.99579 33.94440, -117.99579 33... 4 \n", + "9730 LINESTRING (-117.99307 33.93974, -117.99307 33... 4 \n", + "9731 LINESTRING (-117.99308 33.93630, -117.99308 33... 4 \n", "\n", - " geometry \n", - "599754 LINESTRING (-121.89922 37.68350, -121.89953 37... \n", - "599755 LINESTRING (-121.90267 37.68194, -121.90291 37... \n", - "599756 LINESTRING (-121.90600 37.68078, -121.90618 37... " + " trips_hr_sch \n", + "9729 1.333333 \n", + "9730 1.333333 \n", + "9731 1.333333 \n", + "\n", + "[3 rows x 21 columns]" ] }, - "execution_count": 13, + "execution_count": 69, "metadata": {}, "output_type": "execute_result" } @@ -800,29 +377,7 @@ }, { "cell_type": "code", - "execution_count": 14, - "id": "8e89173e-a0ea-4823-bbce-0aa6cdb3f075", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "array(['PM Peak', 'AM Peak', 'Early AM', 'Midday', 'Evening'],\n", - " dtype=object)" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_segs.time_of_day.unique()" - ] - }, - { - "cell_type": "code", - "execution_count": 15, + "execution_count": 45, "id": "f87584fb-f37d-4869-ba5d-af70a5a0e0e3", "metadata": {}, "outputs": [], @@ -832,151 +387,37 @@ }, { "cell_type": "code", - "execution_count": 16, - "id": "c0080473-a119-45b2-8ebc-9f9913b97ecd", - "metadata": {}, - "outputs": [], - "source": [ - "time_periods = [(x, shared_utils.rt_utils.categorize_time_of_day(x)) for x in range(25)]" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "7b72ddbb-4b1b-4169-bfcd-f64eb499ac85", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Midday 5\n", - "PM Peak 5\n", - "Evening 5\n", - "Owl 4\n", - "Early AM 3\n", - "AM Peak 3\n", - "dtype: int64" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pd.Series([shared_utils.rt_utils.categorize_time_of_day(x) for x in range(25)]).value_counts()" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "1df01b6f-c29e-4ccc-9b1f-03cda0241bd9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[(0, 'Owl'),\n", - " (1, 'Owl'),\n", - " (2, 'Owl'),\n", - " (3, 'Owl'),\n", - " (4, 'Early AM'),\n", - " (5, 'Early AM'),\n", - " (6, 'Early AM'),\n", - " (7, 'AM Peak'),\n", - " (8, 'AM Peak'),\n", - " (9, 'AM Peak'),\n", - " (10, 'Midday'),\n", - " (11, 'Midday'),\n", - " (12, 'Midday'),\n", - " (13, 'Midday'),\n", - " (14, 'Midday'),\n", - " (15, 'PM Peak'),\n", - " (16, 'PM Peak'),\n", - " (17, 'PM Peak'),\n", - " (18, 'PM Peak'),\n", - " (19, 'PM Peak'),\n", - " (20, 'Evening'),\n", - " (21, 'Evening'),\n", - " (22, 'Evening'),\n", - " (23, 'Evening'),\n", - " (24, 'Evening')]" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "time_periods" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "590d0196-ab95-47e8-8ce0-e0b93b4da5d4", - "metadata": {}, - "outputs": [], - "source": [ - "am_peak_hrs = len([x[1] for x in time_periods if 'AM Peak' in x[1]])" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "c5c469eb-df45-4925-8888-2cc2bfc04cc6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "am_peak_hrs" - ] - }, - { - "cell_type": "code", - "execution_count": 33, + "execution_count": 46, "id": "edc84eda-ce2b-481f-ac78-6b7209cb25f4", "metadata": {}, "outputs": [], "source": [ - "def prep_gdf(gdf, hrs):\n", + "def prep_gdf(gdf):\n", " \n", " gdf = gdf.to_crs(calitp_data_analysis.geography_utils.CA_NAD83Albers)\n", - " gdf['trips_per_hour'] = gdf.n_trips / hrs\n", "\n", " ## shift to right side of road to display direction\n", " gdf.geometry = gdf.geometry.apply(shared_utils.rt_utils.try_parallel)\n", - " gdf = gdf.apply(shared_utils.rt_utils.arrowize_by_frequency, axis=1)\n", + " gdf = gdf.apply(shared_utils.rt_utils.arrowize_by_frequency, axis=1, frequency_col='trips_hr_sch')\n", "\n", - " gdf = gdf >> arrange(_.trips_per_hour)\n", + " gdf = gdf >> arrange(_.trips_hr_sch)\n", "\n", " return gdf" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 47, "id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67", "metadata": {}, "outputs": [], "source": [ - "peak_test = prep_gdf(peak_test, am_peak_hrs)" + "peak_test = prep_gdf(peak_test)" ] }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 48, "id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23", "metadata": {}, "outputs": [], @@ -985,17 +426,9 @@ "url = shared_utils.rt_utils.ACCESS_SPEEDMAP_LEGEND_URL" ] }, - { - "cell_type": "markdown", - "id": "2e9ae65e-0ed4-4f00-ac8e-27ac85790804", - "metadata": {}, - "source": [ - "## adding identifiers for map display" - ] - }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 49, "id": "87c7db4f-3da9-4ba4-915b-88432a841b39", "metadata": {}, "outputs": [ @@ -1030,7 +463,7 @@ " segment_id\n", " time_of_day\n", " p50_mph\n", - " n_trips\n", + " ...\n", " p20_mph\n", " p80_mph\n", " name\n", @@ -1039,95 +472,105 @@ " organization_name\n", " base64_url\n", " geometry\n", - " trips_per_hour\n", + " n_trips_sch\n", + " trips_hr_sch\n", " \n", " \n", " \n", " \n", - " 526507\n", - " c499f905e33929a641f083dad55c521e\n", - " f59dce41f6c4e6cf0b9dbfc1a29095f1\n", - " shp-7-53\n", - " 7\n", - " 7\n", - " 53019__53372\n", - " San Pablo Av & Wall Av__San Pablo Av & Conlon Av\n", - " 53019-53372-1\n", + " 34253\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 4901c1a3b0efda4363bafac83036f8af\n", + " 1110423_JUNE24\n", + " 111-13183\n", + " 111\n", + " 12569__14726\n", + " Studebaker / Borson__Studebaker / Imperial\n", + " 12569-14726-1\n", " AM Peak\n", - " 5.80\n", + " 8.59\n", + " ...\n", + " 8.59\n", + " 8.59\n", + " LA Metro Bus Schedule\n", + " 07 - Los Angeles\n", + " recPnGkwdpnr8jmHB\n", + " Los Angeles County Metropolitan Transportation...\n", + " aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...\n", + " POLYGON ((175823.879 -453844.437, 175808.618 -...\n", " 1\n", - " 5.80\n", - " 5.80\n", - " Bay Area 511 AC Transit Schedule\n", - " 04 - Oakland\n", - " recOZgevYf7Jimm9L\n", - " Alameda-Contra Costa Transit District\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " POLYGON ((-203712.125 -7192.575, -203734.516 -...\n", " 0.333333\n", " \n", " \n", - " 527527\n", - " c499f905e33929a641f083dad55c521e\n", - " 261a73dd824eab6a8fb3616a320d00e0\n", - " shp-62-01\n", - " 62\n", - " 62\n", - " 50553__57505\n", - " 23rd Av & Foothill Blvd (Garfield School)__23r...\n", - " 50553-57505-1\n", + " 34254\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 4901c1a3b0efda4363bafac83036f8af\n", + " 1110423_JUNE24\n", + " 111-13183\n", + " 111\n", + " 14726__14724\n", + " Studebaker / Imperial__Studebaker / Firestone\n", + " 14726-14724-1\n", " AM Peak\n", - " 13.48\n", + " 7.14\n", + " ...\n", + " 7.14\n", + " 7.14\n", + " LA Metro Bus Schedule\n", + " 07 - Los Angeles\n", + " recPnGkwdpnr8jmHB\n", + " Los Angeles County Metropolitan Transportation...\n", + " aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...\n", + " POLYGON ((175820.029 -453597.893, 175804.674 -...\n", " 1\n", - " 13.48\n", - " 13.48\n", - " Bay Area 511 AC Transit Schedule\n", - " 04 - Oakland\n", - " recOZgevYf7Jimm9L\n", - " Alameda-Contra Costa Transit District\n", - " aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...\n", - " POLYGON ((-196613.695 -23524.639, -196614.785 ...\n", " 0.333333\n", " \n", " \n", "\n", + "

2 rows × 21 columns

\n", "" ], "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "526507 c499f905e33929a641f083dad55c521e f59dce41f6c4e6cf0b9dbfc1a29095f1 \n", - "527527 c499f905e33929a641f083dad55c521e 261a73dd824eab6a8fb3616a320d00e0 \n", + " schedule_gtfs_dataset_key shape_array_key \\\n", + "34253 0666caf3ec1ecc96b74f4477ee4bc939 4901c1a3b0efda4363bafac83036f8af \n", + "34254 0666caf3ec1ecc96b74f4477ee4bc939 4901c1a3b0efda4363bafac83036f8af \n", + "\n", + " shape_id route_id route_short_name stop_pair \\\n", + "34253 1110423_JUNE24 111-13183 111 12569__14726 \n", + "34254 1110423_JUNE24 111-13183 111 14726__14724 \n", + "\n", + " stop_pair_name segment_id \\\n", + "34253 Studebaker / Borson__Studebaker / Imperial 12569-14726-1 \n", + "34254 Studebaker / Imperial__Studebaker / Firestone 14726-14724-1 \n", "\n", - " shape_id route_id route_short_name stop_pair \\\n", - "526507 shp-7-53 7 7 53019__53372 \n", - "527527 shp-62-01 62 62 50553__57505 \n", + " time_of_day p50_mph ... p20_mph p80_mph name \\\n", + "34253 AM Peak 8.59 ... 8.59 8.59 LA Metro Bus Schedule \n", + "34254 AM Peak 7.14 ... 7.14 7.14 LA Metro Bus Schedule \n", "\n", - " stop_pair_name segment_id \\\n", - "526507 San Pablo Av & Wall Av__San Pablo Av & Conlon Av 53019-53372-1 \n", - "527527 23rd Av & Foothill Blvd (Garfield School)__23r... 50553-57505-1 \n", + " caltrans_district organization_source_record_id \\\n", + "34253 07 - Los Angeles recPnGkwdpnr8jmHB \n", + "34254 07 - Los Angeles recPnGkwdpnr8jmHB \n", "\n", - " time_of_day p50_mph n_trips p20_mph p80_mph \\\n", - "526507 AM Peak 5.80 1 5.80 5.80 \n", - "527527 AM Peak 13.48 1 13.48 13.48 \n", + " organization_name \\\n", + "34253 Los Angeles County Metropolitan Transportation... \n", + "34254 Los Angeles County Metropolitan Transportation... \n", "\n", - " name caltrans_district \\\n", - "526507 Bay Area 511 AC Transit Schedule 04 - Oakland \n", - "527527 Bay Area 511 AC Transit Schedule 04 - Oakland \n", + " base64_url \\\n", + "34253 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "34254 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", "\n", - " organization_source_record_id organization_name \\\n", - "526507 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", - "527527 recOZgevYf7Jimm9L Alameda-Contra Costa Transit District \n", + " geometry n_trips_sch \\\n", + "34253 POLYGON ((175823.879 -453844.437, 175808.618 -... 1 \n", + "34254 POLYGON ((175820.029 -453597.893, 175804.674 -... 1 \n", "\n", - " base64_url \\\n", - "526507 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "527527 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", + " trips_hr_sch \n", + "34253 0.333333 \n", + "34254 0.333333 \n", "\n", - " geometry trips_per_hour \n", - "526507 POLYGON ((-203712.125 -7192.575, -203734.516 -... 0.333333 \n", - "527527 POLYGON ((-196613.695 -23524.639, -196614.785 ... 0.333333 " + "[2 rows x 21 columns]" ] }, - "execution_count": 36, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } @@ -1136,21 +579,9 @@ "peak_test >> head(2)" ] }, - { - "cell_type": "markdown", - "id": "21725c98-e8cf-47bb-a880-09e67d25f0fe", - "metadata": {}, - "source": [ - "## to-do\n", - "\n", - "* where does new n_trips come from? should be schedule-based for speedmaps applications...\n", - "* split am/pm peak\n", - "* https://github.com/cal-itp/data-analyses/issues/1218 upstream add route identifiers" - ] - }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 50, "id": "e7c32718-4eb2-4c2b-aba0-cca397aaabf3", "metadata": {}, "outputs": [ @@ -1161,11 +592,12 @@ " 'route_short_name', 'stop_pair', 'stop_pair_name', 'segment_id',\n", " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", " 'caltrans_district', 'organization_source_record_id',\n", - " 'organization_name', 'base64_url', 'geometry', 'trips_per_hour'],\n", + " 'organization_name', 'base64_url', 'geometry', 'n_trips_sch',\n", + " 'trips_hr_sch'],\n", " dtype='object')" ] }, - "execution_count": 37, + "execution_count": 50, "metadata": {}, "output_type": "execute_result" } @@ -1184,7 +616,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 58, "id": "10a3ff1d-04f8-40b8-ab91-5ef96fde9b6a", "metadata": {}, "outputs": [ @@ -1192,7 +624,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "writing to calitp-map-tiles/testing/4_new.geojson.gz\n" + "writing to calitp-map-tiles/testing/182_new.geojson.gz\n" ] } ], @@ -1200,12 +632,12 @@ "speedmap_state = shared_utils.rt_utils.set_state_export(\n", " peak_test, filename=f'{itp_id}_new', map_type='speedmap',\n", " color_col='p20_mph', cmap=cmap, legend_url=url,\n", - " cache_seconds=0, map_title=f'Speedmap Segs {analysis_date}')" + " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" ] }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 59, "id": "75f2695e-4b80-4d91-8dce-1fa8e347729b", "metadata": {}, "outputs": [ @@ -1213,19 +645,19 @@ "data": { "text/plain": [ "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_new.geojson.gz',\n", + " 'layers': [{'name': 'Speedmap Segs Early AM 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_new.geojson.gz',\n", " 'properties': {'stroked': False,\n", " 'highlight_saturation_multiplier': 0.5,\n", " 'tooltip_speed_key': 'p20_mph'},\n", " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.777276879932664, -122.20458759054884),\n", + " 'lat_lon': (34.05429096594501, -118.29944262320139),\n", " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvNF9uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzcuNzc3Mjc2ODc5OTMyNjY0LCAtMTIyLjIwNDU4NzU5MDU0ODg0XSwgInpvb20iOiAxMywgImxlZ2VuZF91cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvc3BlZWRzX2xlZ2VuZC5zdmcifQ=='}" + " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEVhcmx5IEFNIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvMTgyX25ldy5nZW9qc29uLmd6IiwgInByb3BlcnRpZXMiOiB7InN0cm9rZWQiOiBmYWxzZSwgImhpZ2hsaWdodF9zYXR1cmF0aW9uX211bHRpcGxpZXIiOiAwLjUsICJ0b29sdGlwX3NwZWVkX2tleSI6ICJwMjBfbXBoIn0sICJ0eXBlIjogInNwZWVkbWFwIn1dLCAibGF0X2xvbiI6IFszNC4wNTQyOTA5NjU5NDUwMSwgLTExOC4yOTk0NDI2MjMyMDEzOV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" ] }, - "execution_count": 39, + "execution_count": 59, "metadata": {}, "output_type": "execute_result" } @@ -1244,17 +676,17 @@ }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 60, "id": "02ffc2b6-9b8f-456b-ae33-85e7eea79df5", "metadata": {}, "outputs": [], "source": [ - "time_of_day = 'Early AM'" + "time_of_day = 'PM Peak'" ] }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 61, "id": "2f44c03e-c7cc-4e49-8da4-be653d4c3546", "metadata": {}, "outputs": [], @@ -1264,48 +696,17 @@ }, { "cell_type": "code", - "execution_count": 97, - "id": "2cbffab5-c927-4a0f-a28f-eb07cf12800f", - "metadata": {}, - "outputs": [], - "source": [ - "hrs = len([x[1] for x in time_periods if x[1] == time_of_day])" - ] - }, - { - "cell_type": "code", - "execution_count": 98, - "id": "7c0bb82e-3173-4a4f-a6e4-4bfa66a79044", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "execution_count": 98, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "hrs" - ] - }, - { - "cell_type": "code", - "execution_count": 99, + "execution_count": 62, "id": "53a9f9cc-38d8-44d3-b7a6-a33fca62d32b", "metadata": {}, "outputs": [], "source": [ - "period_test = prep_gdf(period_speeds, hrs)" + "period_test = prep_gdf(period_speeds)" ] }, { "cell_type": "code", - "execution_count": 100, + "execution_count": 63, "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", "metadata": {}, "outputs": [], @@ -1315,7 +716,7 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 65, "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", "metadata": {}, "outputs": [ @@ -1323,7 +724,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "writing to calitp-map-tiles/testing/4_early_am_new.geojson.gz\n" + "writing to calitp-map-tiles/testing/182_pm_peak_new.geojson.gz\n" ] } ], @@ -1336,7 +737,7 @@ }, { "cell_type": "code", - "execution_count": 102, + "execution_count": 66, "id": "360aee2f-9076-4c7d-9843-0f7959489f5c", "metadata": {}, "outputs": [ @@ -1344,19 +745,19 @@ "data": { "text/plain": [ "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs Early AM 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/4_early_am_new.geojson.gz',\n", + " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_pm_peak_new.geojson.gz',\n", " 'properties': {'stroked': False,\n", " 'highlight_saturation_multiplier': 0.5,\n", " 'tooltip_speed_key': 'p20_mph'},\n", " 'type': 'speedmap'}],\n", - " 'lat_lon': (37.77940573965417, -122.21209975403526),\n", + " 'lat_lon': (34.04804074656423, -118.29635317134563),\n", " 'zoom': 13,\n", " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEVhcmx5IEFNIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvNF9lYXJseV9hbV9uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzcuNzc5NDA1NzM5NjU0MTcsIC0xMjIuMjEyMDk5NzU0MDM1MjZdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy8xODJfcG1fcGVha19uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzQuMDQ4MDQwNzQ2NTY0MjMsIC0xMTguMjk2MzUzMTcxMzQ1NjNdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" ] }, - "execution_count": 102, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 29757e05d..2ceb1a11b 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -305,493 +305,7 @@ }, { "cell_type": "code", - "execution_count": 10, - "id": "f8201973-a5cf-4349-88c2-bfb171cc3484", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_idroute_short_namestop_pairstop_pair_namesegment_idtime_of_dayp50_mphn_tripsp20_mphp80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometry
00139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...AM Peak17.27415.2020.96TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
10139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...Midday20.38618.4623.02TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
20139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...Woodlake Park EB__Cypress St & Naranjo Blvd WB0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...PM Peak23.90522.4925.11TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.09762 36.41481, -119.09762 36...
30139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...Cypress St & Naranjo Blvd WB__Millwood and Roa...5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...AM Peak49.50843.8551.81TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.10550 36.41377, -119.10562 36...
40139b1253130b33adcd4b3a4490530d251530f7b5ba4cdde7c644c14f262005cb0c096a2-4c32-4675-b005-43b58b3781e6874b0dfa-ab3d-47da-ac75-5fd7b9bdea42C30 WB5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...Cypress St & Naranjo Blvd WB__Millwood and Roa...5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...Midday47.581244.7449.68TCRTA TripShot Schedule06 - Fresnorec4YWVqVwJ9XqDbqTulare County Regional Transit AgencyaHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...LINESTRING (-119.10550 36.41377, -119.10562 36...
............................................................
693202fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161591__61592California & Showers__California & Ortega61591-61592-1Evening24.71124.7124.71Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.10605 37.40280, -122.10581 37...
693203fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161592__61593California & Ortega__California & Rengstorff61592-61593-1Evening24.68124.6824.68Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.10339 37.40108, -122.10266 37...
693204fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161593__61422California & Rengstorff__California & Escuela61593-61422-1Evening24.44124.4424.44Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.09992 37.39895, -122.09902 37...
693205fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161422__61423California & Escuela__California & Mariposa61422-61423-1Evening15.27115.2715.27Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.09415 37.39670, -122.09225 37...
693206fb467982dcc77a7f9199bebe709bb7008d34a33f017ea0d1498b0cebf26fc5f9114150212161423__61424California & Mariposa__California & Palo Alto61423-61424-1Evening14.83114.8314.83Bay Area 511 Santa Clara Transit Schedule04 - OaklandrecC5CT95EufmQCXrSanta Clara Valley Transportation AuthorityaHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW...LINESTRING (-122.08948 37.39486, -122.08939 37...
\n", - "

693207 rows × 19 columns

\n", - "
" - ], - "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "0 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "1 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "2 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "3 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "4 0139b1253130b33adcd4b3a4490530d2 51530f7b5ba4cdde7c644c14f262005c \n", - "... ... ... \n", - "693202 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693203 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693204 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693205 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "693206 fb467982dcc77a7f9199bebe709bb700 8d34a33f017ea0d1498b0cebf26fc5f9 \n", - "\n", - " shape_id \\\n", - "0 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "1 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "2 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "3 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "4 b0c096a2-4c32-4675-b005-43b58b3781e6 \n", - "... ... \n", - "693202 114150 \n", - "693203 114150 \n", - "693204 114150 \n", - "693205 114150 \n", - "693206 114150 \n", - "\n", - " route_id route_short_name \\\n", - "0 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "1 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "2 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "3 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "4 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42 C30 WB \n", - "... ... ... \n", - "693202 21 21 \n", - "693203 21 21 \n", - "693204 21 21 \n", - "693205 21 21 \n", - "693206 21 21 \n", - "\n", - " stop_pair \\\n", - "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "3 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", - "4 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", - "... ... \n", - "693202 61591__61592 \n", - "693203 61592__61593 \n", - "693204 61593__61422 \n", - "693205 61422__61423 \n", - "693206 61423__61424 \n", - "\n", - " stop_pair_name \\\n", - "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "3 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", - "4 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", - "... ... \n", - "693202 California & Showers__California & Ortega \n", - "693203 California & Ortega__California & Rengstorff \n", - "693204 California & Rengstorff__California & Escuela \n", - "693205 California & Escuela__California & Mariposa \n", - "693206 California & Mariposa__California & Palo Alto \n", - "\n", - " segment_id time_of_day \\\n", - "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak \n", - "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday \n", - "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak \n", - "3 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak \n", - "4 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... Midday \n", - "... ... ... \n", - "693202 61591-61592-1 Evening \n", - "693203 61592-61593-1 Evening \n", - "693204 61593-61422-1 Evening \n", - "693205 61422-61423-1 Evening \n", - "693206 61423-61424-1 Evening \n", - "\n", - " p50_mph n_trips p20_mph p80_mph \\\n", - "0 17.27 4 15.20 20.96 \n", - "1 20.38 6 18.46 23.02 \n", - "2 23.90 5 22.49 25.11 \n", - "3 49.50 8 43.85 51.81 \n", - "4 47.58 12 44.74 49.68 \n", - "... ... ... ... ... \n", - "693202 24.71 1 24.71 24.71 \n", - "693203 24.68 1 24.68 24.68 \n", - "693204 24.44 1 24.44 24.44 \n", - "693205 15.27 1 15.27 15.27 \n", - "693206 14.83 1 14.83 14.83 \n", - "\n", - " name caltrans_district \\\n", - "0 TCRTA TripShot Schedule 06 - Fresno \n", - "1 TCRTA TripShot Schedule 06 - Fresno \n", - "2 TCRTA TripShot Schedule 06 - Fresno \n", - "3 TCRTA TripShot Schedule 06 - Fresno \n", - "4 TCRTA TripShot Schedule 06 - Fresno \n", - "... ... ... \n", - "693202 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693203 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693204 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693205 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "693206 Bay Area 511 Santa Clara Transit Schedule 04 - Oakland \n", - "\n", - " organization_source_record_id \\\n", - "0 rec4YWVqVwJ9XqDbq \n", - "1 rec4YWVqVwJ9XqDbq \n", - "2 rec4YWVqVwJ9XqDbq \n", - "3 rec4YWVqVwJ9XqDbq \n", - "4 rec4YWVqVwJ9XqDbq \n", - "... ... \n", - "693202 recC5CT95EufmQCXr \n", - "693203 recC5CT95EufmQCXr \n", - "693204 recC5CT95EufmQCXr \n", - "693205 recC5CT95EufmQCXr \n", - "693206 recC5CT95EufmQCXr \n", - "\n", - " organization_name \\\n", - "0 Tulare County Regional Transit Agency \n", - "1 Tulare County Regional Transit Agency \n", - "2 Tulare County Regional Transit Agency \n", - "3 Tulare County Regional Transit Agency \n", - "4 Tulare County Regional Transit Agency \n", - "... ... \n", - "693202 Santa Clara Valley Transportation Authority \n", - "693203 Santa Clara Valley Transportation Authority \n", - "693204 Santa Clara Valley Transportation Authority \n", - "693205 Santa Clara Valley Transportation Authority \n", - "693206 Santa Clara Valley Transportation Authority \n", - "\n", - " base64_url \\\n", - "0 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "3 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "4 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", - "... ... \n", - "693202 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693203 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693204 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693205 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "693206 aHR0cHM6Ly9hcGkuNTExLm9yZy90cmFuc2l0L2RhdGFmZW... \n", - "\n", - " geometry \n", - "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "2 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "3 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", - "4 LINESTRING (-119.10550 36.41377, -119.10562 36... \n", - "... ... \n", - "693202 LINESTRING (-122.10605 37.40280, -122.10581 37... \n", - "693203 LINESTRING (-122.10339 37.40108, -122.10266 37... \n", - "693204 LINESTRING (-122.09992 37.39895, -122.09902 37... \n", - "693205 LINESTRING (-122.09415 37.39670, -122.09225 37... \n", - "693206 LINESTRING (-122.08948 37.39486, -122.08939 37... \n", - "\n", - "[693207 rows x 19 columns]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "detail" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "64d2f707-77c7-4d4d-be06-156728ae0e2b", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'dir': '${gcs_paths.COMPILED_CACHED_VIEWS}', 'trips': 'trips', 'shapes': 'routelines', 'stops': 'stops', 'stop_times': 'st'}" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "catalog.schedule_downloads" - ] - }, - { - "cell_type": "code", - "execution_count": 12, + "execution_count": 25, "id": "294b8f67-1486-48e9-8fe9-015b009d8e53", "metadata": {}, "outputs": [], @@ -801,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 26, "id": "508d38d4-086c-43e6-8044-6ded0882e105", "metadata": {}, "outputs": [ @@ -811,7 +325,7 @@ "'gs://calitp-analytics-data/data-analyses/rt_delay/compiled_cached_views/trips_2024-10-16.parquet'" ] }, - "execution_count": 13, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -822,7 +336,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 27, "id": "dc3543ea-2544-4917-887e-9de4441fb460", "metadata": {}, "outputs": [], @@ -832,39 +346,18 @@ }, { "cell_type": "code", - "execution_count": 15, - "id": "2153ab94-b927-40b4-8496-6bf82b4dd591", - "metadata": {}, - "outputs": [], - "source": [ - "trips = trips >> select(_.trip_instance_key, _.schedule_gtfs_dataset_key == _.gtfs_dataset_key,\n", - " _.route_id, _.direction_id, _.shape_id)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "8ea7c1f6-7b14-4651-8263-c2a76fa9d38c", - "metadata": {}, - "outputs": [], - "source": [ - "time_buckets = gtfs_schedule_wrangling.get_trip_time_buckets(analysis_date)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "75ce3325-f97a-4848-bee2-e034264221a1", + "execution_count": 28, + "id": "de097b6e-9b83-4d3a-b3e6-3646c7c7be86", "metadata": {}, "outputs": [], "source": [ - "trips = trips >> inner_join(_, time_buckets, on='trip_instance_key')" + "df = gtfs_schedule_wrangling.get_sched_trips_hr(analysis_date)" ] }, { "cell_type": "code", - "execution_count": 22, - "id": "2ad85cd8-59eb-43d2-ac4b-7b4473d6047b", + "execution_count": 29, + "id": "55d704c5-1a87-4bbf-bcde-e867b53c3988", "metadata": {}, "outputs": [ { @@ -894,6 +387,7 @@ " time_of_day\n", " schedule_gtfs_dataset_key\n", " n_trips\n", + " trips_hr\n", " \n", " \n", " \n", @@ -905,6 +399,7 @@ " AM Peak\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", " 3\n", + " 1.000000\n", " \n", " \n", " 1\n", @@ -914,6 +409,7 @@ " Early AM\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", " 1\n", + " 0.333333\n", " \n", " \n", " 2\n", @@ -923,168 +419,45 @@ " Midday\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", " 5\n", - " \n", - " \n", - " 3\n", - " 001\n", - " 0.0\n", - " 0010111\n", - " PM Peak\n", - " 9809d3f8121513057bc5cb8de7b54ce2\n", - " 3\n", - " \n", - " \n", - " 4\n", - " 001\n", - " 0.0\n", - " 47840\n", - " AM Peak\n", - " 70c8a8b71c815224299523bf2115924a\n", - " 12\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 18369\n", - " shrdserv\n", - " 0.0\n", - " shrdserv_loop_3\n", - " PM Peak\n", - " a8d5f90bfd689badb7e1deb041408e96\n", - " 1\n", - " \n", - " \n", - " 18370\n", - " valleywide\n", - " 1.0\n", - " valleywide\n", - " AM Peak\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 12\n", - " \n", - " \n", - " 18371\n", - " valleywide\n", - " 1.0\n", - " valleywide\n", - " Evening\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 9\n", - " \n", - " \n", - " 18372\n", - " valleywide\n", - " 1.0\n", - " valleywide\n", - " Midday\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 20\n", - " \n", - " \n", - " 18373\n", - " valleywide\n", - " 1.0\n", - " valleywide\n", - " PM Peak\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 20\n", + " 1.000000\n", " \n", " \n", "\n", - "

18374 rows × 6 columns

\n", "" ], "text/plain": [ - " route_id direction_id shape_id time_of_day \\\n", - "0 001 0.0 0010111 AM Peak \n", - "1 001 0.0 0010111 Early AM \n", - "2 001 0.0 0010111 Midday \n", - "3 001 0.0 0010111 PM Peak \n", - "4 001 0.0 47840 AM Peak \n", - "... ... ... ... ... \n", - "18369 shrdserv 0.0 shrdserv_loop_3 PM Peak \n", - "18370 valleywide 1.0 valleywide AM Peak \n", - "18371 valleywide 1.0 valleywide Evening \n", - "18372 valleywide 1.0 valleywide Midday \n", - "18373 valleywide 1.0 valleywide PM Peak \n", - "\n", - " schedule_gtfs_dataset_key n_trips \n", - "0 9809d3f8121513057bc5cb8de7b54ce2 3 \n", - "1 9809d3f8121513057bc5cb8de7b54ce2 1 \n", - "2 9809d3f8121513057bc5cb8de7b54ce2 5 \n", - "3 9809d3f8121513057bc5cb8de7b54ce2 3 \n", - "4 70c8a8b71c815224299523bf2115924a 12 \n", - "... ... ... \n", - "18369 a8d5f90bfd689badb7e1deb041408e96 1 \n", - "18370 31152914d10e2d0977b8b2fabb167922 12 \n", - "18371 31152914d10e2d0977b8b2fabb167922 9 \n", - "18372 31152914d10e2d0977b8b2fabb167922 20 \n", - "18373 31152914d10e2d0977b8b2fabb167922 20 \n", - "\n", - "[18374 rows x 6 columns]" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "schedule_trip_counts = gtfs_schedule_wrangling.count_trips_by_group(trips, ['route_id', 'direction_id', 'shape_id',\n", - " 'time_of_day', 'schedule_gtfs_dataset_key'])\n", - "schedule_trip_counts" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "a34abeb3-e433-4731-962e-3394af7b6f61", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Midday 5\n", - "PM Peak 5\n", - "Evening 5\n", - "Owl 4\n", - "Early AM 3\n", - "AM Peak 3\n", - "dtype: int64" + " route_id direction_id shape_id time_of_day \\\n", + "0 001 0.0 0010111 AM Peak \n", + "1 001 0.0 0010111 Early AM \n", + "2 001 0.0 0010111 Midday \n", + "\n", + " schedule_gtfs_dataset_key n_trips trips_hr \n", + "0 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 \n", + "1 9809d3f8121513057bc5cb8de7b54ce2 1 0.333333 \n", + "2 9809d3f8121513057bc5cb8de7b54ce2 5 1.000000 " ] }, - "execution_count": 23, + "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "durations = shared_utils.rt_utils.time_of_day_durations()\n", - "durations" + "df >> head(3)" ] }, { - "cell_type": "code", - "execution_count": 28, - "id": "f1b1c9f1-166f-4f64-81d7-51c8eb4b23ff", + "cell_type": "markdown", + "id": "6a062796-ae2f-4081-b73b-8923c7bd85b2", "metadata": {}, - "outputs": [], "source": [ - "schedule_trip_counts['trips_hr'] = schedule_trip_counts.apply(\n", - " lambda x: x.n_trips / durations[x.time_of_day], axis=1)" + "## Where'd the J line go??" ] }, { "cell_type": "code", - "execution_count": 29, - "id": "be6afedb-9009-4374-9cd8-dba841487615", + "execution_count": 30, + "id": "1ded1f93-6458-4365-b30b-744417bbf19f", "metadata": {}, "outputs": [ { @@ -1119,166 +492,393 @@ " \n", " \n", " \n", - " 0\n", - " 001\n", + " 15680\n", + " 910-13183\n", " 0.0\n", - " 0010111\n", + " 9100214_JUNE24\n", " AM Peak\n", - " 9809d3f8121513057bc5cb8de7b54ce2\n", - " 3\n", - " 1.000000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 19\n", + " 6.333333\n", " \n", " \n", - " 1\n", - " 001\n", + " 15681\n", + " 910-13183\n", " 0.0\n", - " 0010111\n", + " 9100214_JUNE24\n", " Early AM\n", - " 9809d3f8121513057bc5cb8de7b54ce2\n", - " 1\n", - " 0.333333\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 15\n", + " 5.000000\n", " \n", " \n", - " 2\n", - " 001\n", + " 15682\n", + " 910-13183\n", " 0.0\n", - " 0010111\n", + " 9100214_JUNE24\n", + " Evening\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 9\n", + " 1.800000\n", + " \n", + " \n", + " 15683\n", + " 910-13183\n", + " 0.0\n", + " 9100214_JUNE24\n", " Midday\n", - " 9809d3f8121513057bc5cb8de7b54ce2\n", - " 5\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 22\n", + " 4.400000\n", + " \n", + " \n", + " 15684\n", + " 910-13183\n", + " 0.0\n", + " 9100214_JUNE24\n", + " Owl\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 4\n", " 1.000000\n", " \n", " \n", - " 3\n", - " 001\n", + " 15685\n", + " 910-13183\n", " 0.0\n", - " 0010111\n", + " 9100214_JUNE24\n", " PM Peak\n", - " 9809d3f8121513057bc5cb8de7b54ce2\n", - " 3\n", - " 0.600000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 32\n", + " 6.400000\n", " \n", " \n", - " 4\n", - " 001\n", + " 15686\n", + " 910-13183\n", " 0.0\n", - " 47840\n", + " 9100215_JUNE24\n", " AM Peak\n", - " 70c8a8b71c815224299523bf2115924a\n", - " 12\n", - " 4.000000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 7\n", + " 2.333333\n", " \n", " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", + " 15687\n", + " 910-13183\n", + " 0.0\n", + " 9100215_JUNE24\n", + " Early AM\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 8\n", + " 2.666667\n", " \n", " \n", - " 18369\n", - " shrdserv\n", + " 15688\n", + " 910-13183\n", " 0.0\n", - " shrdserv_loop_3\n", - " PM Peak\n", - " a8d5f90bfd689badb7e1deb041408e96\n", + " 9100215_JUNE24\n", + " Evening\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", " 1\n", " 0.200000\n", " \n", " \n", - " 18370\n", - " valleywide\n", + " 15689\n", + " 910-13183\n", + " 0.0\n", + " 9100215_JUNE24\n", + " Midday\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 11\n", + " 2.200000\n", + " \n", + " \n", + " 15690\n", + " 910-13183\n", + " 0.0\n", + " 9100215_JUNE24\n", + " PM Peak\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 11\n", + " 2.200000\n", + " \n", + " \n", + " 15691\n", + " 910-13183\n", " 1.0\n", - " valleywide\n", + " 9100209_JUNE24\n", " AM Peak\n", - " 31152914d10e2d0977b8b2fabb167922\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 7\n", + " 2.333333\n", + " \n", + " \n", + " 15692\n", + " 910-13183\n", + " 1.0\n", + " 9100209_JUNE24\n", + " Early AM\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 8\n", + " 2.666667\n", + " \n", + " \n", + " 15693\n", + " 910-13183\n", + " 1.0\n", + " 9100209_JUNE24\n", + " Midday\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", " 12\n", - " 4.000000\n", + " 2.400000\n", " \n", " \n", - " 18371\n", - " valleywide\n", + " 15694\n", + " 910-13183\n", " 1.0\n", - " valleywide\n", + " 9100209_JUNE24\n", + " Owl\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 1\n", + " 0.250000\n", + " \n", + " \n", + " 15695\n", + " 910-13183\n", + " 1.0\n", + " 9100209_JUNE24\n", + " PM Peak\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 15\n", + " 3.000000\n", + " \n", + " \n", + " 15696\n", + " 910-13183\n", + " 1.0\n", + " 9100210_JUNE24\n", + " AM Peak\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 19\n", + " 6.333333\n", + " \n", + " \n", + " 15697\n", + " 910-13183\n", + " 1.0\n", + " 9100210_JUNE24\n", + " Early AM\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 18\n", + " 6.000000\n", + " \n", + " \n", + " 15698\n", + " 910-13183\n", + " 1.0\n", + " 9100210_JUNE24\n", " Evening\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 9\n", - " 1.800000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 11\n", + " 2.200000\n", " \n", " \n", - " 18372\n", - " valleywide\n", + " 15699\n", + " 910-13183\n", " 1.0\n", - " valleywide\n", + " 9100210_JUNE24\n", " Midday\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 20\n", - " 4.000000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 21\n", + " 4.200000\n", " \n", " \n", - " 18373\n", - " valleywide\n", + " 15700\n", + " 910-13183\n", " 1.0\n", - " valleywide\n", + " 9100210_JUNE24\n", + " Owl\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 4\n", + " 1.000000\n", + " \n", + " \n", + " 15701\n", + " 910-13183\n", + " 1.0\n", + " 9100210_JUNE24\n", " PM Peak\n", - " 31152914d10e2d0977b8b2fabb167922\n", - " 20\n", - " 4.000000\n", + " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 30\n", + " 6.000000\n", " \n", " \n", "\n", - "

18374 rows × 7 columns

\n", "" ], "text/plain": [ - " route_id direction_id shape_id time_of_day \\\n", - "0 001 0.0 0010111 AM Peak \n", - "1 001 0.0 0010111 Early AM \n", - "2 001 0.0 0010111 Midday \n", - "3 001 0.0 0010111 PM Peak \n", - "4 001 0.0 47840 AM Peak \n", - "... ... ... ... ... \n", - "18369 shrdserv 0.0 shrdserv_loop_3 PM Peak \n", - "18370 valleywide 1.0 valleywide AM Peak \n", - "18371 valleywide 1.0 valleywide Evening \n", - "18372 valleywide 1.0 valleywide Midday \n", - "18373 valleywide 1.0 valleywide PM Peak \n", + " route_id direction_id shape_id time_of_day \\\n", + "15680 910-13183 0.0 9100214_JUNE24 AM Peak \n", + "15681 910-13183 0.0 9100214_JUNE24 Early AM \n", + "15682 910-13183 0.0 9100214_JUNE24 Evening \n", + "15683 910-13183 0.0 9100214_JUNE24 Midday \n", + "15684 910-13183 0.0 9100214_JUNE24 Owl \n", + "15685 910-13183 0.0 9100214_JUNE24 PM Peak \n", + "15686 910-13183 0.0 9100215_JUNE24 AM Peak \n", + "15687 910-13183 0.0 9100215_JUNE24 Early AM \n", + "15688 910-13183 0.0 9100215_JUNE24 Evening \n", + "15689 910-13183 0.0 9100215_JUNE24 Midday \n", + "15690 910-13183 0.0 9100215_JUNE24 PM Peak \n", + "15691 910-13183 1.0 9100209_JUNE24 AM Peak \n", + "15692 910-13183 1.0 9100209_JUNE24 Early AM \n", + "15693 910-13183 1.0 9100209_JUNE24 Midday \n", + "15694 910-13183 1.0 9100209_JUNE24 Owl \n", + "15695 910-13183 1.0 9100209_JUNE24 PM Peak \n", + "15696 910-13183 1.0 9100210_JUNE24 AM Peak \n", + "15697 910-13183 1.0 9100210_JUNE24 Early AM \n", + "15698 910-13183 1.0 9100210_JUNE24 Evening \n", + "15699 910-13183 1.0 9100210_JUNE24 Midday \n", + "15700 910-13183 1.0 9100210_JUNE24 Owl \n", + "15701 910-13183 1.0 9100210_JUNE24 PM Peak \n", "\n", " schedule_gtfs_dataset_key n_trips trips_hr \n", - "0 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 \n", - "1 9809d3f8121513057bc5cb8de7b54ce2 1 0.333333 \n", - "2 9809d3f8121513057bc5cb8de7b54ce2 5 1.000000 \n", - "3 9809d3f8121513057bc5cb8de7b54ce2 3 0.600000 \n", - "4 70c8a8b71c815224299523bf2115924a 12 4.000000 \n", - "... ... ... ... \n", - "18369 a8d5f90bfd689badb7e1deb041408e96 1 0.200000 \n", - "18370 31152914d10e2d0977b8b2fabb167922 12 4.000000 \n", - "18371 31152914d10e2d0977b8b2fabb167922 9 1.800000 \n", - "18372 31152914d10e2d0977b8b2fabb167922 20 4.000000 \n", - "18373 31152914d10e2d0977b8b2fabb167922 20 4.000000 \n", - "\n", - "[18374 rows x 7 columns]" + "15680 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", + "15681 0666caf3ec1ecc96b74f4477ee4bc939 15 5.000000 \n", + "15682 0666caf3ec1ecc96b74f4477ee4bc939 9 1.800000 \n", + "15683 0666caf3ec1ecc96b74f4477ee4bc939 22 4.400000 \n", + "15684 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", + "15685 0666caf3ec1ecc96b74f4477ee4bc939 32 6.400000 \n", + "15686 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", + "15687 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", + "15688 0666caf3ec1ecc96b74f4477ee4bc939 1 0.200000 \n", + "15689 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", + "15690 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", + "15691 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", + "15692 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", + "15693 0666caf3ec1ecc96b74f4477ee4bc939 12 2.400000 \n", + "15694 0666caf3ec1ecc96b74f4477ee4bc939 1 0.250000 \n", + "15695 0666caf3ec1ecc96b74f4477ee4bc939 15 3.000000 \n", + "15696 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", + "15697 0666caf3ec1ecc96b74f4477ee4bc939 18 6.000000 \n", + "15698 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", + "15699 0666caf3ec1ecc96b74f4477ee4bc939 21 4.200000 \n", + "15700 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", + "15701 0666caf3ec1ecc96b74f4477ee4bc939 30 6.000000 " ] }, - "execution_count": 29, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "schedule_trip_counts" + "df >> filter(_.route_id.str.contains('910'))" ] }, { "cell_type": "code", - "execution_count": null, - "id": "de097b6e-9b83-4d3a-b3e6-3646c7c7be86", + "execution_count": 37, + "id": "32cf4f45-bf10-4edf-a525-7804ea7ada47", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "ef401846-f54c-4805-a7aa-53ed1b630837", + "metadata": {}, + "outputs": [], + "source": [ + "speedmap_segs = gpd.read_parquet(path) # aggregated" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "ffcec5ce-dcc2-402b-bef0-60f6bd25dd77", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_idroute_short_namestop_pairstop_pair_namesegment_idtime_of_dayp50_mph...p20_mphp80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometryn_trips_schtrips_hr_sch
\n", + "

0 rows × 21 columns

\n", + "
" + ], + "text/plain": [ + "Empty GeoDataFrame\n", + "Columns: [schedule_gtfs_dataset_key, shape_array_key, shape_id, route_id, route_short_name, stop_pair, stop_pair_name, segment_id, time_of_day, p50_mph, n_trips, p20_mph, p80_mph, name, caltrans_district, organization_source_record_id, organization_name, base64_url, geometry, n_trips_sch, trips_hr_sch]\n", + "Index: []\n", + "\n", + "[0 rows x 21 columns]" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "speedmap_segs >> filter(_.route_id.str.contains('910'))" + ] + }, + { + "cell_type": "markdown", + "id": "f919f640-261f-427f-be55-e8b2e4349f12", + "metadata": {}, + "source": [ + "it has no route_short_name...\n", + "```\n", + "857-13183,857,Metro Local Line,C & K LINE LINK,3,,,\n", + "901-13183,,Metro G Line 901,METRO G LINE,3,FC4C02,FFFFFF,https://www.metro.net/g-line/\n", + "910-13183,,Metro J Line 910/950,METRO J LINE,3,ADB8BF,000000,https://www.metro.net/j-line/\n", + "```" + ] } ], "metadata": { diff --git a/rt_segment_speeds/logs/avg_speeds.log b/rt_segment_speeds/logs/avg_speeds.log index c91452ed7..d46d0d878 100644 --- a/rt_segment_speeds/logs/avg_speeds.log +++ b/rt_segment_speeds/logs/avg_speeds.log @@ -537,3 +537,6 @@ 2024-11-01 09:18:04.863 | INFO | average_segment_speeds:segment_averages_detail:239 - speedmap_segments detailed segment averaging for ['2024-10-16'] execution time: 0:06:29.243269 2024-11-01 09:23:55.409 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:05:50.230382 2024-11-01 09:28:10.012 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:04:14.446376 +2024-11-04 12:49:57.565 | INFO | average_segment_speeds:segment_averages_detail:245 - speedmap_segments detailed segment averaging for ['2024-10-16'] execution time: 0:06:25.396982 +2024-11-04 12:55:52.804 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:05:55.031920 +2024-11-04 13:00:43.796 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:04:50.815376 diff --git a/rt_segment_speeds/scripts/average_segment_speeds.py b/rt_segment_speeds/scripts/average_segment_speeds.py index d795407af..de1dcd32e 100644 --- a/rt_segment_speeds/scripts/average_segment_speeds.py +++ b/rt_segment_speeds/scripts/average_segment_speeds.py @@ -228,6 +228,12 @@ def segment_averages_detail( ) avg_speeds_with_geom = compute(avg_speeds_with_geom)[0] + # is this the best spot to add scheduled frequency? + sched_trips_hr = gtfs_schedule_wrangling.get_sched_trips_hr(analysis_date) + sched_trips_hr = sched_trips_hr.rename(columns={'n_trips': 'n_trips_sch', 'trips_hr': 'trips_hr_sch'}) + sched_trips_hr_cols = ['route_id', 'shape_id', + 'time_of_day', 'schedule_gtfs_dataset_key'] + avg_speeds_with_geom = pd.merge(avg_speeds_with_geom, sched_trips_hr, on=sched_trips_hr_cols) utils.geoparquet_gcs_export( avg_speeds_with_geom, diff --git a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py index c11ae220a..3ddef7107 100644 --- a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py +++ b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py @@ -515,6 +515,27 @@ def merge_operator_identifiers( return df +def get_sched_trips_hr(analysis_date: str) -> pd.DataFrame: + """ + For speedmaps (and other analyses), it's helpful to have scheduled + frequency available. Currently only supports detailed time of day. + """ + keep_trip_cols = ['trip_instance_key', 'gtfs_dataset_key', 'route_id', + 'shape_id'] + trips = helpers.import_scheduled_trips(analysis_date, columns=keep_trip_cols) + trips = trips.rename( + columns={'gtfs_dataset_key': 'schedule_gtfs_dataset_key'}) + time_buckets = get_trip_time_buckets(analysis_date) + trips = pd.merge(trips, time_buckets, on='trip_instance_key', how='inner') + schedule_trip_counts = count_trips_by_group(trips, + ['route_id', 'shape_id', + 'time_of_day', 'schedule_gtfs_dataset_key'] + ) + durations = rt_utils.time_of_day_durations() + schedule_trip_counts['trips_hr'] = schedule_trip_counts.apply( + lambda x: x.n_trips / durations[x.time_of_day], axis=1) + return schedule_trip_counts + def fill_missing_stop_sequence1(df: pd.DataFrame) -> pd.DataFrame: """ From a1848aed24055b97242cd858aeeebd3152850393 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 21:38:26 +0000 Subject: [PATCH 07/13] debug metro J line: can't group on route_short_name since it's not required per spec and can be nan. Instead, add in when joining to scheduled frequencies --- .../shared_utils/gtfs_analytics_data.yml | 2 +- .../40_speedmap_scratchpad.ipynb | 52 ++++++++++++++----- .../gtfs_schedule_wrangling.py | 2 +- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/_shared_utils/shared_utils/gtfs_analytics_data.yml b/_shared_utils/shared_utils/gtfs_analytics_data.yml index cc4bab0a0..db0b364d4 100644 --- a/_shared_utils/shared_utils/gtfs_analytics_data.yml +++ b/_shared_utils/shared_utils/gtfs_analytics_data.yml @@ -119,7 +119,7 @@ speedmap_segments: trip_stop_cols: ["trip_instance_key", "stop_sequence", "stop_sequence1"] shape_stop_cols: ["shape_array_key", "shape_id"] stop_pair_cols: ["stop_pair", "stop_pair_name", "segment_id"] - route_dir_cols: ["route_id", "route_short_name"] + route_dir_cols: ["route_id", "direction_id"] segments_file: "segment_options/speedmap_segments" shape_stop_single_segment: "rollup_singleday/speeds_shape_speedmap_segments" shape_stop_single_segment_detail: "rollup_singleday/speeds_shape_speedmap_segments_detail" diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 2ceb1a11b..a2f19bc9a 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -774,6 +774,27 @@ "df >> filter(_.route_id.str.contains('910'))" ] }, + { + "cell_type": "code", + "execution_count": 40, + "id": "a602c285-26f8-4d1f-8412-dd0437cb7543", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'route_short_name'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "catalog.speedmap_segments" + ] + }, { "cell_type": "code", "execution_count": 37, @@ -786,7 +807,17 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 41, + "id": "ad48874e-a6ea-4ee0-8e9d-7eb5f3f0a581", + "metadata": {}, + "outputs": [], + "source": [ + "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.route_dir_single_segment}_{analysis_date}.parquet'" + ] + }, + { + "cell_type": "code", + "execution_count": 42, "id": "ef401846-f54c-4805-a7aa-53ed1b630837", "metadata": {}, "outputs": [], @@ -796,7 +827,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 43, "id": "ffcec5ce-dcc2-402b-bef0-60f6bd25dd77", "metadata": {}, "outputs": [ @@ -822,16 +853,14 @@ " \n", " \n", " schedule_gtfs_dataset_key\n", - " shape_array_key\n", - " shape_id\n", " route_id\n", " route_short_name\n", " stop_pair\n", " stop_pair_name\n", " segment_id\n", - " time_of_day\n", + " time_period\n", " p50_mph\n", - " ...\n", + " n_trips\n", " p20_mph\n", " p80_mph\n", " name\n", @@ -840,25 +869,20 @@ " organization_name\n", " base64_url\n", " geometry\n", - " n_trips_sch\n", - " trips_hr_sch\n", " \n", " \n", " \n", " \n", "\n", - "

0 rows × 21 columns

\n", "" ], "text/plain": [ "Empty GeoDataFrame\n", - "Columns: [schedule_gtfs_dataset_key, shape_array_key, shape_id, route_id, route_short_name, stop_pair, stop_pair_name, segment_id, time_of_day, p50_mph, n_trips, p20_mph, p80_mph, name, caltrans_district, organization_source_record_id, organization_name, base64_url, geometry, n_trips_sch, trips_hr_sch]\n", - "Index: []\n", - "\n", - "[0 rows x 21 columns]" + "Columns: [schedule_gtfs_dataset_key, route_id, route_short_name, stop_pair, stop_pair_name, segment_id, time_period, p50_mph, n_trips, p20_mph, p80_mph, name, caltrans_district, organization_source_record_id, organization_name, base64_url, geometry]\n", + "Index: []" ] }, - "execution_count": 39, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } diff --git a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py index 3ddef7107..aa77b5930 100644 --- a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py +++ b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py @@ -521,7 +521,7 @@ def get_sched_trips_hr(analysis_date: str) -> pd.DataFrame: frequency available. Currently only supports detailed time of day. """ keep_trip_cols = ['trip_instance_key', 'gtfs_dataset_key', 'route_id', - 'shape_id'] + 'shape_id', 'route_short_name'] trips = helpers.import_scheduled_trips(analysis_date, columns=keep_trip_cols) trips = trips.rename( columns={'gtfs_dataset_key': 'schedule_gtfs_dataset_key'}) From 6d713849276ce011591a546ee9952ab68636b2d9 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 23:36:28 +0000 Subject: [PATCH 08/13] debug --- .../build_speedmaps_index.py | 1 + .../40_speedmap_scratchpad.ipynb | 615 +++++++++++------- .../scripts/average_segment_speeds.py | 3 +- .../gtfs_schedule_wrangling.py | 27 +- 4 files changed, 424 insertions(+), 222 deletions(-) diff --git a/ca_transit_speed_maps/build_speedmaps_index.py b/ca_transit_speed_maps/build_speedmaps_index.py index 38a42fbc0..20fcc2e0f 100644 --- a/ca_transit_speed_maps/build_speedmaps_index.py +++ b/ca_transit_speed_maps/build_speedmaps_index.py @@ -37,6 +37,7 @@ def build_speedmaps_index(analysis_date: dt.date, how: str = 'new') -> pd.DataFr _.public_customer_facing_or_regional_subfeed_fixed_route, _.vehicle_positions_gtfs_dataset_key != None) >> inner_join(_, dim_orgs, on = {'organization_source_record_id': 'source_record_id'}) + # TODO replace deprecated caltrans_district with via dim_county_geography >> select(_.organization_itp_id, _.organization_name, _.organization_source_record_id, _.caltrans_district, _._is_current, _.vehicle_positions_gtfs_dataset_key, _.schedule_gtfs_dataset_key) diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index a2f19bc9a..646c1b5f1 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -44,7 +44,7 @@ { "data": { "text/plain": [ - "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'route_short_name'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" + "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'direction_id'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" ] }, "execution_count": 3, @@ -165,7 +165,7 @@ " segment_id\n", " time_of_day\n", " p50_mph\n", - " n_trips\n", + " ...\n", " p20_mph\n", " p80_mph\n", " name\n", @@ -174,6 +174,8 @@ " organization_name\n", " base64_url\n", " geometry\n", + " n_trips_sch\n", + " trips_hr_sch\n", " \n", " \n", " \n", @@ -189,7 +191,7 @@ " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", " AM Peak\n", " 17.27\n", - " 4\n", + " ...\n", " 15.20\n", " 20.96\n", " TCRTA TripShot Schedule\n", @@ -198,6 +200,8 @@ " Tulare County Regional Transit Agency\n", " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", + " 4\n", + " 1.333333\n", " \n", " \n", " 1\n", @@ -206,20 +210,22 @@ " b0c096a2-4c32-4675-b005-43b58b3781e6\n", " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", " C30 WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", - " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", - " Midday\n", - " 20.38\n", - " 6\n", - " 18.46\n", - " 23.02\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", + " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", + " AM Peak\n", + " 49.50\n", + " ...\n", + " 43.85\n", + " 51.81\n", " TCRTA TripShot Schedule\n", " 06 - Fresno\n", " rec4YWVqVwJ9XqDbq\n", " Tulare County Regional Transit Agency\n", " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", + " LINESTRING (-119.10550 36.41377, -119.10562 36...\n", + " 4\n", + " 1.333333\n", " \n", " \n", " 2\n", @@ -228,23 +234,26 @@ " b0c096a2-4c32-4675-b005-43b58b3781e6\n", " 874b0dfa-ab3d-47da-ac75-5fd7b9bdea42\n", " C30 WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352...\n", - " Woodlake Park EB__Cypress St & Naranjo Blvd WB\n", - " 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-...\n", - " PM Peak\n", - " 23.90\n", - " 5\n", - " 22.49\n", - " 25.11\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7...\n", + " Cypress St & Naranjo Blvd WB__Millwood and Roa...\n", + " 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-...\n", + " AM Peak\n", + " 58.87\n", + " ...\n", + " 57.15\n", + " 59.50\n", " TCRTA TripShot Schedule\n", " 06 - Fresno\n", " rec4YWVqVwJ9XqDbq\n", " Tulare County Regional Transit Agency\n", " aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy...\n", - " LINESTRING (-119.09762 36.41481, -119.09762 36...\n", + " LINESTRING (-119.11666 36.41379, -119.11684 36...\n", + " 4\n", + " 1.333333\n", " \n", " \n", "\n", + "

3 rows × 21 columns

\n", "" ], "text/plain": [ @@ -260,23 +269,23 @@ "\n", " route_short_name stop_pair \\\n", "0 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "1 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", - "2 C30 WB 0d1ef8b5-90e4-40de-b37b-504cb862d18b__5b9a7352... \n", + "1 C30 WB 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", + "2 C30 WB 5b9a7352-556f-4272-b663-22f9821d6a40__5f894da7... \n", "\n", - " stop_pair_name \\\n", - "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "1 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", - "2 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + " stop_pair_name \\\n", + "0 Woodlake Park EB__Cypress St & Naranjo Blvd WB \n", + "1 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", + "2 Cypress St & Naranjo Blvd WB__Millwood and Roa... \n", "\n", " segment_id time_of_day p50_mph \\\n", "0 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... AM Peak 17.27 \n", - "1 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... Midday 20.38 \n", - "2 0d1ef8b5-90e4-40de-b37b-504cb862d18b-5b9a7352-... PM Peak 23.90 \n", + "1 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak 49.50 \n", + "2 5b9a7352-556f-4272-b663-22f9821d6a40-5f894da7-... AM Peak 58.87 \n", "\n", - " n_trips p20_mph p80_mph name caltrans_district \\\n", - "0 4 15.20 20.96 TCRTA TripShot Schedule 06 - Fresno \n", - "1 6 18.46 23.02 TCRTA TripShot Schedule 06 - Fresno \n", - "2 5 22.49 25.11 TCRTA TripShot Schedule 06 - Fresno \n", + " ... p20_mph p80_mph name caltrans_district \\\n", + "0 ... 15.20 20.96 TCRTA TripShot Schedule 06 - Fresno \n", + "1 ... 43.85 51.81 TCRTA TripShot Schedule 06 - Fresno \n", + "2 ... 57.15 59.50 TCRTA TripShot Schedule 06 - Fresno \n", "\n", " organization_source_record_id organization_name \\\n", "0 rec4YWVqVwJ9XqDbq Tulare County Regional Transit Agency \n", @@ -288,10 +297,12 @@ "1 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", "2 aHR0cHM6Ly90Y3J0YS50cmlwc2hvdC5jb20vdjEvZ3Rmcy... \n", "\n", - " geometry \n", - "0 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "1 LINESTRING (-119.09762 36.41481, -119.09762 36... \n", - "2 LINESTRING (-119.09762 36.41481, -119.09762 36... " + " geometry n_trips_sch trips_hr_sch \n", + "0 LINESTRING (-119.09762 36.41481, -119.09762 36... 4 1.333333 \n", + "1 LINESTRING (-119.10550 36.41377, -119.10562 36... 4 1.333333 \n", + "2 LINESTRING (-119.11666 36.41379, -119.11684 36... 4 1.333333 \n", + "\n", + "[3 rows x 21 columns]" ] }, "execution_count": 9, @@ -305,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 10, "id": "294b8f67-1486-48e9-8fe9-015b009d8e53", "metadata": {}, "outputs": [], @@ -315,7 +326,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 11, "id": "508d38d4-086c-43e6-8044-6ded0882e105", "metadata": {}, "outputs": [ @@ -325,7 +336,7 @@ "'gs://calitp-analytics-data/data-analyses/rt_delay/compiled_cached_views/trips_2024-10-16.parquet'" ] }, - "execution_count": 26, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -336,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 12, "id": "dc3543ea-2544-4917-887e-9de4441fb460", "metadata": {}, "outputs": [], @@ -346,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 13, "id": "de097b6e-9b83-4d3a-b3e6-3646c7c7be86", "metadata": {}, "outputs": [], @@ -356,7 +367,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 14, "id": "55d704c5-1a87-4bbf-bcde-e867b53c3988", "metadata": {}, "outputs": [ @@ -382,7 +393,6 @@ " \n", " \n", " route_id\n", - " direction_id\n", " shape_id\n", " time_of_day\n", " schedule_gtfs_dataset_key\n", @@ -394,7 +404,6 @@ " \n", " 0\n", " 001\n", - " 0.0\n", " 0010111\n", " AM Peak\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", @@ -404,7 +413,6 @@ " \n", " 1\n", " 001\n", - " 0.0\n", " 0010111\n", " Early AM\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", @@ -414,7 +422,6 @@ " \n", " 2\n", " 001\n", - " 0.0\n", " 0010111\n", " Midday\n", " 9809d3f8121513057bc5cb8de7b54ce2\n", @@ -426,18 +433,18 @@ "" ], "text/plain": [ - " route_id direction_id shape_id time_of_day \\\n", - "0 001 0.0 0010111 AM Peak \n", - "1 001 0.0 0010111 Early AM \n", - "2 001 0.0 0010111 Midday \n", + " route_id shape_id time_of_day schedule_gtfs_dataset_key n_trips \\\n", + "0 001 0010111 AM Peak 9809d3f8121513057bc5cb8de7b54ce2 3 \n", + "1 001 0010111 Early AM 9809d3f8121513057bc5cb8de7b54ce2 1 \n", + "2 001 0010111 Midday 9809d3f8121513057bc5cb8de7b54ce2 5 \n", "\n", - " schedule_gtfs_dataset_key n_trips trips_hr \n", - "0 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 \n", - "1 9809d3f8121513057bc5cb8de7b54ce2 1 0.333333 \n", - "2 9809d3f8121513057bc5cb8de7b54ce2 5 1.000000 " + " trips_hr \n", + "0 1.000000 \n", + "1 0.333333 \n", + "2 1.000000 " ] }, - "execution_count": 29, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -446,18 +453,10 @@ "df >> head(3)" ] }, - { - "cell_type": "markdown", - "id": "6a062796-ae2f-4081-b73b-8923c7bd85b2", - "metadata": {}, - "source": [ - "## Where'd the J line go??" - ] - }, { "cell_type": "code", - "execution_count": 30, - "id": "1ded1f93-6458-4365-b30b-744417bbf19f", + "execution_count": 15, + "id": "c6f784df-8dc0-4990-aaad-4a42af5b7e5e", "metadata": {}, "outputs": [ { @@ -482,129 +481,216 @@ " \n", " \n", " route_id\n", - " direction_id\n", " shape_id\n", " time_of_day\n", " schedule_gtfs_dataset_key\n", " n_trips\n", " trips_hr\n", + " route_short_name\n", " \n", " \n", " \n", " \n", - " 15680\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", + " 0\n", + " 001\n", + " 0010111\n", " AM Peak\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 19\n", - " 6.333333\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 3\n", + " 1.000000\n", + " 1\n", " \n", " \n", - " 15681\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", + " 1\n", + " 001\n", + " 0010111\n", " Early AM\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 15\n", - " 5.000000\n", - " \n", - " \n", - " 15682\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", - " Evening\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 9\n", - " 1.800000\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 1\n", + " 0.333333\n", + " 1\n", " \n", " \n", - " 15683\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", + " 2\n", + " 001\n", + " 0010111\n", " Midday\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 22\n", - " 4.400000\n", - " \n", - " \n", - " 15684\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", - " Owl\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 4\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 5\n", " 1.000000\n", + " 1\n", " \n", " \n", - " 15685\n", - " 910-13183\n", - " 0.0\n", - " 9100214_JUNE24\n", + " 3\n", + " 001\n", + " 0010111\n", " PM Peak\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 32\n", - " 6.400000\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 3\n", + " 0.600000\n", + " 1\n", " \n", " \n", - " 15686\n", - " 910-13183\n", - " 0.0\n", - " 9100215_JUNE24\n", + " 4\n", + " 001\n", + " 0010113\n", " AM Peak\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 7\n", - " 2.333333\n", + " 9809d3f8121513057bc5cb8de7b54ce2\n", + " 3\n", + " 1.000000\n", + " 1\n", " \n", " \n", - " 15687\n", - " 910-13183\n", - " 0.0\n", - " 9100215_JUNE24\n", - " Early AM\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 8\n", - " 2.666667\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", + " ...\n", " \n", " \n", - " 15688\n", - " 910-13183\n", - " 0.0\n", - " 9100215_JUNE24\n", - " Evening\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", + " 19176\n", + " shrdserv\n", + " shrdserv_loop_3\n", + " PM Peak\n", + " a8d5f90bfd689badb7e1deb041408e96\n", " 1\n", " 0.200000\n", + " Shared Services\n", " \n", " \n", - " 15689\n", - " 910-13183\n", - " 0.0\n", - " 9100215_JUNE24\n", + " 19177\n", + " valleywide\n", + " valleywide\n", + " AM Peak\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 12\n", + " 4.000000\n", + " None\n", + " \n", + " \n", + " 19178\n", + " valleywide\n", + " valleywide\n", + " Evening\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 9\n", + " 1.800000\n", + " None\n", + " \n", + " \n", + " 19179\n", + " valleywide\n", + " valleywide\n", " Midday\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 11\n", - " 2.200000\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 20\n", + " 4.000000\n", + " None\n", " \n", " \n", - " 15690\n", - " 910-13183\n", - " 0.0\n", - " 9100215_JUNE24\n", + " 19180\n", + " valleywide\n", + " valleywide\n", " PM Peak\n", - " 0666caf3ec1ecc96b74f4477ee4bc939\n", - " 11\n", - " 2.200000\n", + " 31152914d10e2d0977b8b2fabb167922\n", + " 20\n", + " 4.000000\n", + " None\n", + " \n", + " \n", + "\n", + "

19181 rows × 7 columns

\n", + "" + ], + "text/plain": [ + " route_id shape_id time_of_day \\\n", + "0 001 0010111 AM Peak \n", + "1 001 0010111 Early AM \n", + "2 001 0010111 Midday \n", + "3 001 0010111 PM Peak \n", + "4 001 0010113 AM Peak \n", + "... ... ... ... \n", + "19176 shrdserv shrdserv_loop_3 PM Peak \n", + "19177 valleywide valleywide AM Peak \n", + "19178 valleywide valleywide Evening \n", + "19179 valleywide valleywide Midday \n", + "19180 valleywide valleywide PM Peak \n", + "\n", + " schedule_gtfs_dataset_key n_trips trips_hr route_short_name \n", + "0 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 1 \n", + "1 9809d3f8121513057bc5cb8de7b54ce2 1 0.333333 1 \n", + "2 9809d3f8121513057bc5cb8de7b54ce2 5 1.000000 1 \n", + "3 9809d3f8121513057bc5cb8de7b54ce2 3 0.600000 1 \n", + "4 9809d3f8121513057bc5cb8de7b54ce2 3 1.000000 1 \n", + "... ... ... ... ... \n", + "19176 a8d5f90bfd689badb7e1deb041408e96 1 0.200000 Shared Services \n", + "19177 31152914d10e2d0977b8b2fabb167922 12 4.000000 None \n", + "19178 31152914d10e2d0977b8b2fabb167922 9 1.800000 None \n", + "19179 31152914d10e2d0977b8b2fabb167922 20 4.000000 None \n", + "19180 31152914d10e2d0977b8b2fabb167922 20 4.000000 None \n", + "\n", + "[19181 rows x 7 columns]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "gtfs_schedule_wrangling.merge_route_identifiers(df, analysis_date)" + ] + }, + { + "cell_type": "markdown", + "id": "6a062796-ae2f-4081-b73b-8923c7bd85b2", + "metadata": {}, + "source": [ + "## Where'd the J line go??" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "1ded1f93-6458-4365-b30b-744417bbf19f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", + " \n", + " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -612,9 +698,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -622,9 +707,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -632,9 +716,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -642,9 +725,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -652,9 +734,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -662,9 +743,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -672,9 +752,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -682,9 +761,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -692,9 +770,8 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", @@ -702,70 +779,168 @@ " \n", " \n", " \n", - " \n", + " \n", " \n", - " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", " \n", "
route_idshape_idtime_of_dayschedule_gtfs_dataset_keyn_tripstrips_hr
1569116242910-131831.09100209_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc9392.333333
1569216243910-131831.09100209_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc9392.666667
1569316244910-131831.09100209_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc9392.400000
1569416245910-131831.09100209_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc9390.250000
1569516246910-131831.09100209_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc9393.000000
1569616247910-131831.09100210_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc9396.333333
1569716248910-131831.09100210_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc9396.000000
1569816249910-131831.09100210_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc9392.200000
1569916250910-131831.09100210_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc9394.200000
1570016251910-131831.09100210_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc9391.000000
1570116252910-131831.09100210_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939306.000000
16253910-131839100214_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc939196.333333
16254910-131839100214_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc939155.000000
16255910-131839100214_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc93991.800000
16256910-131839100214_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939224.400000
16257910-131839100214_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc93941.000000
16258910-131839100214_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939326.400000
16259910-131839100215_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc93972.333333
16260910-131839100215_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc93982.666667
16261910-131839100215_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc93910.200000
16262910-131839100215_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939112.200000
16263910-131839100215_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939112.200000
\n", "
" ], "text/plain": [ - " route_id direction_id shape_id time_of_day \\\n", - "15680 910-13183 0.0 9100214_JUNE24 AM Peak \n", - "15681 910-13183 0.0 9100214_JUNE24 Early AM \n", - "15682 910-13183 0.0 9100214_JUNE24 Evening \n", - "15683 910-13183 0.0 9100214_JUNE24 Midday \n", - "15684 910-13183 0.0 9100214_JUNE24 Owl \n", - "15685 910-13183 0.0 9100214_JUNE24 PM Peak \n", - "15686 910-13183 0.0 9100215_JUNE24 AM Peak \n", - "15687 910-13183 0.0 9100215_JUNE24 Early AM \n", - "15688 910-13183 0.0 9100215_JUNE24 Evening \n", - "15689 910-13183 0.0 9100215_JUNE24 Midday \n", - "15690 910-13183 0.0 9100215_JUNE24 PM Peak \n", - "15691 910-13183 1.0 9100209_JUNE24 AM Peak \n", - "15692 910-13183 1.0 9100209_JUNE24 Early AM \n", - "15693 910-13183 1.0 9100209_JUNE24 Midday \n", - "15694 910-13183 1.0 9100209_JUNE24 Owl \n", - "15695 910-13183 1.0 9100209_JUNE24 PM Peak \n", - "15696 910-13183 1.0 9100210_JUNE24 AM Peak \n", - "15697 910-13183 1.0 9100210_JUNE24 Early AM \n", - "15698 910-13183 1.0 9100210_JUNE24 Evening \n", - "15699 910-13183 1.0 9100210_JUNE24 Midday \n", - "15700 910-13183 1.0 9100210_JUNE24 Owl \n", - "15701 910-13183 1.0 9100210_JUNE24 PM Peak \n", + " route_id shape_id time_of_day \\\n", + "16242 910-13183 9100209_JUNE24 AM Peak \n", + "16243 910-13183 9100209_JUNE24 Early AM \n", + "16244 910-13183 9100209_JUNE24 Midday \n", + "16245 910-13183 9100209_JUNE24 Owl \n", + "16246 910-13183 9100209_JUNE24 PM Peak \n", + "16247 910-13183 9100210_JUNE24 AM Peak \n", + "16248 910-13183 9100210_JUNE24 Early AM \n", + "16249 910-13183 9100210_JUNE24 Evening \n", + "16250 910-13183 9100210_JUNE24 Midday \n", + "16251 910-13183 9100210_JUNE24 Owl \n", + "16252 910-13183 9100210_JUNE24 PM Peak \n", + "16253 910-13183 9100214_JUNE24 AM Peak \n", + "16254 910-13183 9100214_JUNE24 Early AM \n", + "16255 910-13183 9100214_JUNE24 Evening \n", + "16256 910-13183 9100214_JUNE24 Midday \n", + "16257 910-13183 9100214_JUNE24 Owl \n", + "16258 910-13183 9100214_JUNE24 PM Peak \n", + "16259 910-13183 9100215_JUNE24 AM Peak \n", + "16260 910-13183 9100215_JUNE24 Early AM \n", + "16261 910-13183 9100215_JUNE24 Evening \n", + "16262 910-13183 9100215_JUNE24 Midday \n", + "16263 910-13183 9100215_JUNE24 PM Peak \n", "\n", " schedule_gtfs_dataset_key n_trips trips_hr \n", - "15680 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", - "15681 0666caf3ec1ecc96b74f4477ee4bc939 15 5.000000 \n", - "15682 0666caf3ec1ecc96b74f4477ee4bc939 9 1.800000 \n", - "15683 0666caf3ec1ecc96b74f4477ee4bc939 22 4.400000 \n", - "15684 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", - "15685 0666caf3ec1ecc96b74f4477ee4bc939 32 6.400000 \n", - "15686 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", - "15687 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", - "15688 0666caf3ec1ecc96b74f4477ee4bc939 1 0.200000 \n", - "15689 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", - "15690 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", - "15691 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", - "15692 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", - "15693 0666caf3ec1ecc96b74f4477ee4bc939 12 2.400000 \n", - "15694 0666caf3ec1ecc96b74f4477ee4bc939 1 0.250000 \n", - "15695 0666caf3ec1ecc96b74f4477ee4bc939 15 3.000000 \n", - "15696 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", - "15697 0666caf3ec1ecc96b74f4477ee4bc939 18 6.000000 \n", - "15698 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", - "15699 0666caf3ec1ecc96b74f4477ee4bc939 21 4.200000 \n", - "15700 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", - "15701 0666caf3ec1ecc96b74f4477ee4bc939 30 6.000000 " + "16242 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", + "16243 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", + "16244 0666caf3ec1ecc96b74f4477ee4bc939 12 2.400000 \n", + "16245 0666caf3ec1ecc96b74f4477ee4bc939 1 0.250000 \n", + "16246 0666caf3ec1ecc96b74f4477ee4bc939 15 3.000000 \n", + "16247 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", + "16248 0666caf3ec1ecc96b74f4477ee4bc939 18 6.000000 \n", + "16249 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", + "16250 0666caf3ec1ecc96b74f4477ee4bc939 21 4.200000 \n", + "16251 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", + "16252 0666caf3ec1ecc96b74f4477ee4bc939 30 6.000000 \n", + "16253 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", + "16254 0666caf3ec1ecc96b74f4477ee4bc939 15 5.000000 \n", + "16255 0666caf3ec1ecc96b74f4477ee4bc939 9 1.800000 \n", + "16256 0666caf3ec1ecc96b74f4477ee4bc939 22 4.400000 \n", + "16257 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", + "16258 0666caf3ec1ecc96b74f4477ee4bc939 32 6.400000 \n", + "16259 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", + "16260 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", + "16261 0666caf3ec1ecc96b74f4477ee4bc939 1 0.200000 \n", + "16262 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", + "16263 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 " ] }, - "execution_count": 30, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -776,17 +951,17 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 16, "id": "a602c285-26f8-4d1f-8412-dd0437cb7543", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'route_short_name'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" + "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'direction_id'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" ] }, - "execution_count": 40, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } diff --git a/rt_segment_speeds/scripts/average_segment_speeds.py b/rt_segment_speeds/scripts/average_segment_speeds.py index de1dcd32e..623576360 100644 --- a/rt_segment_speeds/scripts/average_segment_speeds.py +++ b/rt_segment_speeds/scripts/average_segment_speeds.py @@ -228,12 +228,13 @@ def segment_averages_detail( ) avg_speeds_with_geom = compute(avg_speeds_with_geom)[0] - # is this the best spot to add scheduled frequency? + # is this the best spot to add scheduled frequency and route_short_name? sched_trips_hr = gtfs_schedule_wrangling.get_sched_trips_hr(analysis_date) sched_trips_hr = sched_trips_hr.rename(columns={'n_trips': 'n_trips_sch', 'trips_hr': 'trips_hr_sch'}) sched_trips_hr_cols = ['route_id', 'shape_id', 'time_of_day', 'schedule_gtfs_dataset_key'] avg_speeds_with_geom = pd.merge(avg_speeds_with_geom, sched_trips_hr, on=sched_trips_hr_cols) + avg_speeds_with_geom = gtfs_schedule_wrangling.merge_route_identifiers(avg_speeds_with_geom, analysis_date) utils.geoparquet_gcs_export( avg_speeds_with_geom, diff --git a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py index aa77b5930..b98470d7a 100644 --- a/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py +++ b/rt_segment_speeds/segment_speed_utils/gtfs_schedule_wrangling.py @@ -515,13 +515,38 @@ def merge_operator_identifiers( return df +def merge_route_identifiers( + df: pd.DataFrame, + analysis_date: str, +) -> pd.DataFrame: + """ + Merge in route_short_name given df with route_id, + schedule_gtfs_dataset_key. + Can't group by route_short_name or route_long_name in pipeline since either can + be nan per GTFS spec; grouping will result in those being dropped which is + undesireable. + """ + keep_trip_cols = ['gtfs_dataset_key', 'route_id', 'route_short_name'] + trips = helpers.import_scheduled_trips(analysis_date, columns=keep_trip_cols) + trips = trips.rename( + columns={'gtfs_dataset_key': 'schedule_gtfs_dataset_key'}) + routes = trips.drop_duplicates() + df = pd.merge( + df, + routes, + on = ["schedule_gtfs_dataset_key", "route_id"], + how = "inner" + ) + + return df + def get_sched_trips_hr(analysis_date: str) -> pd.DataFrame: """ For speedmaps (and other analyses), it's helpful to have scheduled frequency available. Currently only supports detailed time of day. """ keep_trip_cols = ['trip_instance_key', 'gtfs_dataset_key', 'route_id', - 'shape_id', 'route_short_name'] + 'shape_id'] trips = helpers.import_scheduled_trips(analysis_date, columns=keep_trip_cols) trips = trips.rename( columns={'gtfs_dataset_key': 'schedule_gtfs_dataset_key'}) From 1af4a53f18f1cc80c4867e1d4706f532624a6f18 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 23:54:00 +0000 Subject: [PATCH 09/13] test re-adding route_short_name at end... working --- ca_transit_speed_maps/01_new_speedmaps.ipynb | 327 ++++-------------- .../40_speedmap_scratchpad.ipynb | 64 +--- rt_segment_speeds/logs/avg_speeds.log | 3 + 3 files changed, 76 insertions(+), 318 deletions(-) diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index dd18c87f5..a19e03f14 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 70, "id": "46898b5c-b5cc-4096-ab68-8c3e42fab870", "metadata": {}, "outputs": [], @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 71, "id": "cf3d8814-6f22-4a22-8b03-429ebb63a397", "metadata": {}, "outputs": [], @@ -37,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 72, "id": "9f15ed6a-5ab7-4f57-9695-3f762781b74c", "metadata": { "tags": [ @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 73, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 74, "id": "eea40f4b-c378-4b70-a80b-bbe79f8441bf", "metadata": { "tags": [] @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 75, "id": "c54b78fd-de92-45d9-b54d-49c5b88945c7", "metadata": {}, "outputs": [ @@ -140,7 +140,7 @@ "42 0666caf3ec1ecc96b74f4477ee4bc939 speedmap_segs_available " ] }, - "execution_count": 39, + "execution_count": 75, "metadata": {}, "output_type": "execute_result" } @@ -151,7 +151,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 76, "id": "1b9762c8-0235-4d8f-b7a4-20a3213eb45e", "metadata": {}, "outputs": [], @@ -161,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 77, "id": "9302c0ad-1201-4c5a-8267-ec52719cf777", "metadata": {}, "outputs": [], @@ -171,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 78, "id": "19dbeff0-faf6-43e3-9edf-6e68dfeceeac", "metadata": {}, "outputs": [], @@ -181,7 +181,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 79, "id": "9f3c4c93-a5f5-40d7-9315-63e4fecbd738", "metadata": {}, "outputs": [], @@ -191,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 69, + "execution_count": 80, "id": "e35e835e-9041-4735-917b-2517532e6166", "metadata": {}, "outputs": [ @@ -220,14 +220,13 @@ " shape_array_key\n", " shape_id\n", " route_id\n", - " route_short_name\n", + " direction_id\n", " stop_pair\n", " stop_pair_name\n", " segment_id\n", " time_of_day\n", " p50_mph\n", " ...\n", - " p20_mph\n", " p80_mph\n", " name\n", " caltrans_district\n", @@ -237,23 +236,23 @@ " geometry\n", " n_trips_sch\n", " trips_hr_sch\n", + " route_short_name\n", " \n", " \n", " \n", " \n", - " 9729\n", + " 5265\n", " 0666caf3ec1ecc96b74f4477ee4bc939\n", " 1d801329ec1c7b1da3460ede3c0fe8bc\n", " 1200106_JUNE24\n", " 120-13183\n", - " 120\n", + " 1.0\n", " 16644__14345\n", " Whittwood Center__Santa Gertrudes / Starbuck\n", " 16644-14345-1\n", " AM Peak\n", " 14.49\n", " ...\n", - " 13.00\n", " 16.38\n", " LA Metro Bus Schedule\n", " 07 - Los Angeles\n", @@ -263,21 +262,21 @@ " LINESTRING (-117.99579 33.94440, -117.99579 33...\n", " 4\n", " 1.333333\n", + " 120\n", " \n", " \n", - " 9730\n", + " 5266\n", " 0666caf3ec1ecc96b74f4477ee4bc939\n", " 1d801329ec1c7b1da3460ede3c0fe8bc\n", " 1200106_JUNE24\n", " 120-13183\n", - " 120\n", + " 1.0\n", " 14345__14346\n", " Santa Gertrudes / Starbuck__Santa Gertrudes / ...\n", " 14345-14346-1\n", " AM Peak\n", " 26.67\n", " ...\n", - " 22.58\n", " 28.96\n", " LA Metro Bus Schedule\n", " 07 - Los Angeles\n", @@ -287,21 +286,21 @@ " LINESTRING (-117.99307 33.93974, -117.99307 33...\n", " 4\n", " 1.333333\n", + " 120\n", " \n", " \n", - " 9731\n", + " 5267\n", " 0666caf3ec1ecc96b74f4477ee4bc939\n", " 1d801329ec1c7b1da3460ede3c0fe8bc\n", " 1200106_JUNE24\n", " 120-13183\n", - " 120\n", + " 1.0\n", " 14346__14344\n", " Santa Gertrudes / Yermo__Santa Gertrudes / Lef...\n", " 14346-14344-1\n", " AM Peak\n", " 11.10\n", " ...\n", - " 7.31\n", " 16.04\n", " LA Metro Bus Schedule\n", " 07 - Los Angeles\n", @@ -311,62 +310,63 @@ " LINESTRING (-117.99308 33.93630, -117.99308 33...\n", " 4\n", " 1.333333\n", + " 120\n", " \n", " \n", "\n", - "

3 rows × 21 columns

\n", + "

3 rows × 22 columns

\n", "" ], "text/plain": [ " schedule_gtfs_dataset_key shape_array_key \\\n", - "9729 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", - "9730 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", - "9731 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", + "5265 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", + "5266 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", + "5267 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", "\n", - " shape_id route_id route_short_name stop_pair \\\n", - "9729 1200106_JUNE24 120-13183 120 16644__14345 \n", - "9730 1200106_JUNE24 120-13183 120 14345__14346 \n", - "9731 1200106_JUNE24 120-13183 120 14346__14344 \n", + " shape_id route_id direction_id stop_pair \\\n", + "5265 1200106_JUNE24 120-13183 1.0 16644__14345 \n", + "5266 1200106_JUNE24 120-13183 1.0 14345__14346 \n", + "5267 1200106_JUNE24 120-13183 1.0 14346__14344 \n", "\n", " stop_pair_name segment_id \\\n", - "9729 Whittwood Center__Santa Gertrudes / Starbuck 16644-14345-1 \n", - "9730 Santa Gertrudes / Starbuck__Santa Gertrudes / ... 14345-14346-1 \n", - "9731 Santa Gertrudes / Yermo__Santa Gertrudes / Lef... 14346-14344-1 \n", + "5265 Whittwood Center__Santa Gertrudes / Starbuck 16644-14345-1 \n", + "5266 Santa Gertrudes / Starbuck__Santa Gertrudes / ... 14345-14346-1 \n", + "5267 Santa Gertrudes / Yermo__Santa Gertrudes / Lef... 14346-14344-1 \n", "\n", - " time_of_day p50_mph ... p20_mph p80_mph name \\\n", - "9729 AM Peak 14.49 ... 13.00 16.38 LA Metro Bus Schedule \n", - "9730 AM Peak 26.67 ... 22.58 28.96 LA Metro Bus Schedule \n", - "9731 AM Peak 11.10 ... 7.31 16.04 LA Metro Bus Schedule \n", + " time_of_day p50_mph ... p80_mph name \\\n", + "5265 AM Peak 14.49 ... 16.38 LA Metro Bus Schedule \n", + "5266 AM Peak 26.67 ... 28.96 LA Metro Bus Schedule \n", + "5267 AM Peak 11.10 ... 16.04 LA Metro Bus Schedule \n", "\n", - " caltrans_district organization_source_record_id \\\n", - "9729 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "9730 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "9731 07 - Los Angeles recPnGkwdpnr8jmHB \n", + " caltrans_district organization_source_record_id \\\n", + "5265 07 - Los Angeles recPnGkwdpnr8jmHB \n", + "5266 07 - Los Angeles recPnGkwdpnr8jmHB \n", + "5267 07 - Los Angeles recPnGkwdpnr8jmHB \n", "\n", " organization_name \\\n", - "9729 Los Angeles County Metropolitan Transportation... \n", - "9730 Los Angeles County Metropolitan Transportation... \n", - "9731 Los Angeles County Metropolitan Transportation... \n", + "5265 Los Angeles County Metropolitan Transportation... \n", + "5266 Los Angeles County Metropolitan Transportation... \n", + "5267 Los Angeles County Metropolitan Transportation... \n", "\n", " base64_url \\\n", - "9729 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "9730 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "9731 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "5265 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "5266 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "5267 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", "\n", " geometry n_trips_sch \\\n", - "9729 LINESTRING (-117.99579 33.94440, -117.99579 33... 4 \n", - "9730 LINESTRING (-117.99307 33.93974, -117.99307 33... 4 \n", - "9731 LINESTRING (-117.99308 33.93630, -117.99308 33... 4 \n", + "5265 LINESTRING (-117.99579 33.94440, -117.99579 33... 4 \n", + "5266 LINESTRING (-117.99307 33.93974, -117.99307 33... 4 \n", + "5267 LINESTRING (-117.99308 33.93630, -117.99308 33... 4 \n", "\n", - " trips_hr_sch \n", - "9729 1.333333 \n", - "9730 1.333333 \n", - "9731 1.333333 \n", + " trips_hr_sch route_short_name \n", + "5265 1.333333 120 \n", + "5266 1.333333 120 \n", + "5267 1.333333 120 \n", "\n", - "[3 rows x 21 columns]" + "[3 rows x 22 columns]" ] }, - "execution_count": 69, + "execution_count": 80, "metadata": {}, "output_type": "execute_result" } @@ -377,7 +377,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 81, "id": "f87584fb-f37d-4869-ba5d-af70a5a0e0e3", "metadata": {}, "outputs": [], @@ -387,7 +387,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 82, "id": "edc84eda-ce2b-481f-ac78-6b7209cb25f4", "metadata": {}, "outputs": [], @@ -407,7 +407,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67", "metadata": {}, "outputs": [], @@ -417,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23", "metadata": {}, "outputs": [], @@ -428,180 +428,20 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "87c7db4f-3da9-4ba4-915b-88432a841b39", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_idroute_short_namestop_pairstop_pair_namesegment_idtime_of_dayp50_mph...p20_mphp80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometryn_trips_schtrips_hr_sch
342530666caf3ec1ecc96b74f4477ee4bc9394901c1a3b0efda4363bafac83036f8af1110423_JUNE24111-1318311112569__14726Studebaker / Borson__Studebaker / Imperial12569-14726-1AM Peak8.59...8.598.59LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...POLYGON ((175823.879 -453844.437, 175808.618 -...10.333333
342540666caf3ec1ecc96b74f4477ee4bc9394901c1a3b0efda4363bafac83036f8af1110423_JUNE24111-1318311114726__14724Studebaker / Imperial__Studebaker / Firestone14726-14724-1AM Peak7.14...7.147.14LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...POLYGON ((175820.029 -453597.893, 175804.674 -...10.333333
\n", - "

2 rows × 21 columns

\n", - "
" - ], - "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "34253 0666caf3ec1ecc96b74f4477ee4bc939 4901c1a3b0efda4363bafac83036f8af \n", - "34254 0666caf3ec1ecc96b74f4477ee4bc939 4901c1a3b0efda4363bafac83036f8af \n", - "\n", - " shape_id route_id route_short_name stop_pair \\\n", - "34253 1110423_JUNE24 111-13183 111 12569__14726 \n", - "34254 1110423_JUNE24 111-13183 111 14726__14724 \n", - "\n", - " stop_pair_name segment_id \\\n", - "34253 Studebaker / Borson__Studebaker / Imperial 12569-14726-1 \n", - "34254 Studebaker / Imperial__Studebaker / Firestone 14726-14724-1 \n", - "\n", - " time_of_day p50_mph ... p20_mph p80_mph name \\\n", - "34253 AM Peak 8.59 ... 8.59 8.59 LA Metro Bus Schedule \n", - "34254 AM Peak 7.14 ... 7.14 7.14 LA Metro Bus Schedule \n", - "\n", - " caltrans_district organization_source_record_id \\\n", - "34253 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "34254 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "\n", - " organization_name \\\n", - "34253 Los Angeles County Metropolitan Transportation... \n", - "34254 Los Angeles County Metropolitan Transportation... \n", - "\n", - " base64_url \\\n", - "34253 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "34254 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "\n", - " geometry n_trips_sch \\\n", - "34253 POLYGON ((175823.879 -453844.437, 175808.618 -... 1 \n", - "34254 POLYGON ((175820.029 -453597.893, 175804.674 -... 1 \n", - "\n", - " trips_hr_sch \n", - "34253 0.333333 \n", - "34254 0.333333 \n", - "\n", - "[2 rows x 21 columns]" - ] - }, - "execution_count": 49, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "peak_test >> head(2)" ] }, { "cell_type": "code", - "execution_count": 50, + "execution_count": null, "id": "e7c32718-4eb2-4c2b-aba0-cca397aaabf3", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", - " 'route_short_name', 'stop_pair', 'stop_pair_name', 'segment_id',\n", - " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", - " 'caltrans_district', 'organization_source_record_id',\n", - " 'organization_name', 'base64_url', 'geometry', 'n_trips_sch',\n", - " 'trips_hr_sch'],\n", - " dtype='object')" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "peak_test.columns" ] @@ -616,18 +456,10 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "10a3ff1d-04f8-40b8-ab91-5ef96fde9b6a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "writing to calitp-map-tiles/testing/182_new.geojson.gz\n" - ] - } - ], + "outputs": [], "source": [ "speedmap_state = shared_utils.rt_utils.set_state_export(\n", " peak_test, filename=f'{itp_id}_new', map_type='speedmap',\n", @@ -637,31 +469,10 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": null, "id": "75f2695e-4b80-4d91-8dce-1fa8e347729b", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs Early AM 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_new.geojson.gz',\n", - " 'properties': {'stroked': False,\n", - " 'highlight_saturation_multiplier': 0.5,\n", - " 'tooltip_speed_key': 'p20_mph'},\n", - " 'type': 'speedmap'}],\n", - " 'lat_lon': (34.05429096594501, -118.29944262320139),\n", - " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIEVhcmx5IEFNIDIwMjQtMTAtMTYiLCAidXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3Rlc3RpbmcvMTgyX25ldy5nZW9qc29uLmd6IiwgInByb3BlcnRpZXMiOiB7InN0cm9rZWQiOiBmYWxzZSwgImhpZ2hsaWdodF9zYXR1cmF0aW9uX211bHRpcGxpZXIiOiAwLjUsICJ0b29sdGlwX3NwZWVkX2tleSI6ICJwMjBfbXBoIn0sICJ0eXBlIjogInNwZWVkbWFwIn1dLCAibGF0X2xvbiI6IFszNC4wNTQyOTA5NjU5NDUwMSwgLTExOC4yOTk0NDI2MjMyMDEzOV0sICJ6b29tIjogMTMsICJsZWdlbmRfdXJsIjogImh0dHBzOi8vc3RvcmFnZS5nb29nbGVhcGlzLmNvbS9jYWxpdHAtbWFwLXRpbGVzL3NwZWVkc19sZWdlbmRfY29sb3JfYWNjZXNzLnN2ZyJ9'}" - ] - }, - "execution_count": 59, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "speedmap_state" ] diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 646c1b5f1..63e836a57 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -972,7 +972,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 17, "id": "32cf4f45-bf10-4edf-a525-7804ea7ada47", "metadata": {}, "outputs": [], @@ -992,7 +992,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "ef401846-f54c-4805-a7aa-53ed1b630837", "metadata": {}, "outputs": [], @@ -1002,66 +1002,10 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "ffcec5ce-dcc2-402b-bef0-60f6bd25dd77", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
schedule_gtfs_dataset_keyroute_idroute_short_namestop_pairstop_pair_namesegment_idtime_periodp50_mphn_tripsp20_mphp80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometry
\n", - "
" - ], - "text/plain": [ - "Empty GeoDataFrame\n", - "Columns: [schedule_gtfs_dataset_key, route_id, route_short_name, stop_pair, stop_pair_name, segment_id, time_period, p50_mph, n_trips, p20_mph, p80_mph, name, caltrans_district, organization_source_record_id, organization_name, base64_url, geometry]\n", - "Index: []" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "speedmap_segs >> filter(_.route_id.str.contains('910'))" ] diff --git a/rt_segment_speeds/logs/avg_speeds.log b/rt_segment_speeds/logs/avg_speeds.log index d46d0d878..f2447451f 100644 --- a/rt_segment_speeds/logs/avg_speeds.log +++ b/rt_segment_speeds/logs/avg_speeds.log @@ -540,3 +540,6 @@ 2024-11-04 12:49:57.565 | INFO | average_segment_speeds:segment_averages_detail:245 - speedmap_segments detailed segment averaging for ['2024-10-16'] execution time: 0:06:25.396982 2024-11-04 12:55:52.804 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:05:55.031920 2024-11-04 13:00:43.796 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:04:50.815376 +2024-11-04 15:43:06.434 | INFO | average_segment_speeds:segment_averages_detail:246 - speedmap_segments detailed segment averaging for ['2024-10-16'] execution time: 0:06:16.711909 +2024-11-04 15:48:26.324 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:05:19.708023 +2024-11-04 15:53:12.740 | INFO | average_segment_speeds:segment_averages:182 - speedmap_segments segment averaging for ['2024-10-16'] execution time: 0:04:46.258219 From 1b7d1e894a0f3a94b09042aaad6276d798d49727 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Mon, 4 Nov 2024 23:59:51 +0000 Subject: [PATCH 10/13] testing --- ca_transit_speed_maps/01_new_speedmaps.ipynb | 209 +++++++++- .../40_speedmap_scratchpad.ipynb | 375 +----------------- 2 files changed, 202 insertions(+), 382 deletions(-) diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index a19e03f14..848a7315d 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -407,7 +407,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 83, "id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67", "metadata": {}, "outputs": [], @@ -417,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 84, "id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23", "metadata": {}, "outputs": [], @@ -428,20 +428,180 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 85, "id": "87c7db4f-3da9-4ba4-915b-88432a841b39", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_iddirection_idstop_pairstop_pair_namesegment_idtime_of_dayp50_mph...p80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometryn_trips_schtrips_hr_schroute_short_name
105010666caf3ec1ecc96b74f4477ee4bc939fedc605c108af558e4e545806741ea0f510358_JUNE2451-131830.0283__8824Avalon / Imperial__Avalon / 111th283-8824-1AM Peak12.34...12.34LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...POLYGON ((160449.331 -452365.708, 160434.047 -...10.33333351
105020666caf3ec1ecc96b74f4477ee4bc939fedc605c108af558e4e545806741ea0f510358_JUNE2451-131830.08824__8823Avalon / 111th__Avalon / 110th8824-8823-1AM Peak14.66...14.66LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...POLYGON ((160443.819 -452040.084, 160428.472 -...10.33333351
\n", + "

2 rows × 22 columns

\n", + "
" + ], + "text/plain": [ + " schedule_gtfs_dataset_key shape_array_key \\\n", + "10501 0666caf3ec1ecc96b74f4477ee4bc939 fedc605c108af558e4e545806741ea0f \n", + "10502 0666caf3ec1ecc96b74f4477ee4bc939 fedc605c108af558e4e545806741ea0f \n", + "\n", + " shape_id route_id direction_id stop_pair \\\n", + "10501 510358_JUNE24 51-13183 0.0 283__8824 \n", + "10502 510358_JUNE24 51-13183 0.0 8824__8823 \n", + "\n", + " stop_pair_name segment_id time_of_day p50_mph \\\n", + "10501 Avalon / Imperial__Avalon / 111th 283-8824-1 AM Peak 12.34 \n", + "10502 Avalon / 111th__Avalon / 110th 8824-8823-1 AM Peak 14.66 \n", + "\n", + " ... p80_mph name caltrans_district \\\n", + "10501 ... 12.34 LA Metro Bus Schedule 07 - Los Angeles \n", + "10502 ... 14.66 LA Metro Bus Schedule 07 - Los Angeles \n", + "\n", + " organization_source_record_id \\\n", + "10501 recPnGkwdpnr8jmHB \n", + "10502 recPnGkwdpnr8jmHB \n", + "\n", + " organization_name \\\n", + "10501 Los Angeles County Metropolitan Transportation... \n", + "10502 Los Angeles County Metropolitan Transportation... \n", + "\n", + " base64_url \\\n", + "10501 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "10502 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", + "\n", + " geometry n_trips_sch \\\n", + "10501 POLYGON ((160449.331 -452365.708, 160434.047 -... 1 \n", + "10502 POLYGON ((160443.819 -452040.084, 160428.472 -... 1 \n", + "\n", + " trips_hr_sch route_short_name \n", + "10501 0.333333 51 \n", + "10502 0.333333 51 \n", + "\n", + "[2 rows x 22 columns]" + ] + }, + "execution_count": 85, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "peak_test >> head(2)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 86, "id": "e7c32718-4eb2-4c2b-aba0-cca397aaabf3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", + " 'direction_id', 'stop_pair', 'stop_pair_name', 'segment_id',\n", + " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", + " 'caltrans_district', 'organization_source_record_id',\n", + " 'organization_name', 'base64_url', 'geometry', 'n_trips_sch',\n", + " 'trips_hr_sch', 'route_short_name'],\n", + " dtype='object')" + ] + }, + "execution_count": 86, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "peak_test.columns" ] @@ -456,10 +616,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 87, "id": "10a3ff1d-04f8-40b8-ab91-5ef96fde9b6a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "writing to calitp-map-tiles/testing/182_new.geojson.gz\n" + ] + } + ], "source": [ "speedmap_state = shared_utils.rt_utils.set_state_export(\n", " peak_test, filename=f'{itp_id}_new', map_type='speedmap',\n", @@ -469,10 +637,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 88, "id": "75f2695e-4b80-4d91-8dce-1fa8e347729b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'state_dict': {'name': 'null',\n", + " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", + " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_new.geojson.gz',\n", + " 'properties': {'stroked': False,\n", + " 'highlight_saturation_multiplier': 0.5,\n", + " 'tooltip_speed_key': 'p20_mph'},\n", + " 'type': 'speedmap'}],\n", + " 'lat_lon': (34.0539357609537, -118.29997523003668),\n", + " 'zoom': 13,\n", + " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", + " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy8xODJfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM0LjA1MzkzNTc2MDk1MzcsIC0xMTguMjk5OTc1MjMwMDM2NjhdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "speedmap_state" ] diff --git a/rt_segment_speeds/40_speedmap_scratchpad.ipynb b/rt_segment_speeds/40_speedmap_scratchpad.ipynb index 63e836a57..f405efc55 100644 --- a/rt_segment_speeds/40_speedmap_scratchpad.ipynb +++ b/rt_segment_speeds/40_speedmap_scratchpad.ipynb @@ -649,378 +649,9 @@ "id": "6a062796-ae2f-4081-b73b-8923c7bd85b2", "metadata": {}, "source": [ - "## Where'd the J line go??" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "1ded1f93-6458-4365-b30b-744417bbf19f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
route_idshape_idtime_of_dayschedule_gtfs_dataset_keyn_tripstrips_hr
16242910-131839100209_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc93972.333333
16243910-131839100209_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc93982.666667
16244910-131839100209_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939122.400000
16245910-131839100209_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc93910.250000
16246910-131839100209_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939153.000000
16247910-131839100210_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc939196.333333
16248910-131839100210_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc939186.000000
16249910-131839100210_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc939112.200000
16250910-131839100210_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939214.200000
16251910-131839100210_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc93941.000000
16252910-131839100210_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939306.000000
16253910-131839100214_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc939196.333333
16254910-131839100214_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc939155.000000
16255910-131839100214_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc93991.800000
16256910-131839100214_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939224.400000
16257910-131839100214_JUNE24Owl0666caf3ec1ecc96b74f4477ee4bc93941.000000
16258910-131839100214_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939326.400000
16259910-131839100215_JUNE24AM Peak0666caf3ec1ecc96b74f4477ee4bc93972.333333
16260910-131839100215_JUNE24Early AM0666caf3ec1ecc96b74f4477ee4bc93982.666667
16261910-131839100215_JUNE24Evening0666caf3ec1ecc96b74f4477ee4bc93910.200000
16262910-131839100215_JUNE24Midday0666caf3ec1ecc96b74f4477ee4bc939112.200000
16263910-131839100215_JUNE24PM Peak0666caf3ec1ecc96b74f4477ee4bc939112.200000
\n", - "
" - ], - "text/plain": [ - " route_id shape_id time_of_day \\\n", - "16242 910-13183 9100209_JUNE24 AM Peak \n", - "16243 910-13183 9100209_JUNE24 Early AM \n", - "16244 910-13183 9100209_JUNE24 Midday \n", - "16245 910-13183 9100209_JUNE24 Owl \n", - "16246 910-13183 9100209_JUNE24 PM Peak \n", - "16247 910-13183 9100210_JUNE24 AM Peak \n", - "16248 910-13183 9100210_JUNE24 Early AM \n", - "16249 910-13183 9100210_JUNE24 Evening \n", - "16250 910-13183 9100210_JUNE24 Midday \n", - "16251 910-13183 9100210_JUNE24 Owl \n", - "16252 910-13183 9100210_JUNE24 PM Peak \n", - "16253 910-13183 9100214_JUNE24 AM Peak \n", - "16254 910-13183 9100214_JUNE24 Early AM \n", - "16255 910-13183 9100214_JUNE24 Evening \n", - "16256 910-13183 9100214_JUNE24 Midday \n", - "16257 910-13183 9100214_JUNE24 Owl \n", - "16258 910-13183 9100214_JUNE24 PM Peak \n", - "16259 910-13183 9100215_JUNE24 AM Peak \n", - "16260 910-13183 9100215_JUNE24 Early AM \n", - "16261 910-13183 9100215_JUNE24 Evening \n", - "16262 910-13183 9100215_JUNE24 Midday \n", - "16263 910-13183 9100215_JUNE24 PM Peak \n", - "\n", - " schedule_gtfs_dataset_key n_trips trips_hr \n", - "16242 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", - "16243 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", - "16244 0666caf3ec1ecc96b74f4477ee4bc939 12 2.400000 \n", - "16245 0666caf3ec1ecc96b74f4477ee4bc939 1 0.250000 \n", - "16246 0666caf3ec1ecc96b74f4477ee4bc939 15 3.000000 \n", - "16247 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", - "16248 0666caf3ec1ecc96b74f4477ee4bc939 18 6.000000 \n", - "16249 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", - "16250 0666caf3ec1ecc96b74f4477ee4bc939 21 4.200000 \n", - "16251 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", - "16252 0666caf3ec1ecc96b74f4477ee4bc939 30 6.000000 \n", - "16253 0666caf3ec1ecc96b74f4477ee4bc939 19 6.333333 \n", - "16254 0666caf3ec1ecc96b74f4477ee4bc939 15 5.000000 \n", - "16255 0666caf3ec1ecc96b74f4477ee4bc939 9 1.800000 \n", - "16256 0666caf3ec1ecc96b74f4477ee4bc939 22 4.400000 \n", - "16257 0666caf3ec1ecc96b74f4477ee4bc939 4 1.000000 \n", - "16258 0666caf3ec1ecc96b74f4477ee4bc939 32 6.400000 \n", - "16259 0666caf3ec1ecc96b74f4477ee4bc939 7 2.333333 \n", - "16260 0666caf3ec1ecc96b74f4477ee4bc939 8 2.666667 \n", - "16261 0666caf3ec1ecc96b74f4477ee4bc939 1 0.200000 \n", - "16262 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 \n", - "16263 0666caf3ec1ecc96b74f4477ee4bc939 11 2.200000 " - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df >> filter(_.route_id.str.contains('910'))" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "a602c285-26f8-4d1f-8412-dd0437cb7543", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'dir': '${gcs_paths.SEGMENT_GCS}', 'stage1': '${speeds_tables.vp_dwell}', 'proxy_stop_times': 'stop_time_expansion/speedmap_stop_times', 'stage2': 'nearest/nearest_vp_speedmap_proxy', 'stage2b': 'nearest/nearest2_vp_speedmap_proxy', 'stage3': 'speedmap/stop_arrivals_proxy', 'stage3b': 'speedmap/stop_arrivals', 'stage4': 'speedmap/speeds', 'trip_stop_cols': ['trip_instance_key', 'stop_sequence', 'stop_sequence1'], 'shape_stop_cols': ['shape_array_key', 'shape_id'], 'stop_pair_cols': ['stop_pair', 'stop_pair_name', 'segment_id'], 'route_dir_cols': ['route_id', 'direction_id'], 'segments_file': 'segment_options/speedmap_segments', 'shape_stop_single_segment': 'rollup_singleday/speeds_shape_speedmap_segments', 'shape_stop_single_segment_detail': 'rollup_singleday/speeds_shape_speedmap_segments_detail', 'route_dir_single_segment': 'rollup_singleday/speeds_route_dir_speedmap_segments', 'route_dir_multi_segment': 'rollup_multiday/speeds_route_dir_speedmap_segments', 'min_trip_minutes': '${speed_vars.time_min_cutoff}', 'max_trip_minutes': 180, 'max_speed': '${speed_vars.max_speed}', 'min_meters_elapsed': 1609, 'segment_meters': 1000}" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "catalog.speedmap_segments" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "32cf4f45-bf10-4edf-a525-7804ea7ada47", - "metadata": {}, - "outputs": [], - "source": [ - "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.shape_stop_single_segment_detail}_{analysis_date}.parquet'" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "id": "ad48874e-a6ea-4ee0-8e9d-7eb5f3f0a581", - "metadata": {}, - "outputs": [], - "source": [ - "path = f'{catalog.speedmap_segments.dir}{catalog.speedmap_segments.route_dir_single_segment}_{analysis_date}.parquet'" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ef401846-f54c-4805-a7aa-53ed1b630837", - "metadata": {}, - "outputs": [], - "source": [ - "speedmap_segs = gpd.read_parquet(path) # aggregated" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffcec5ce-dcc2-402b-bef0-60f6bd25dd77", - "metadata": {}, - "outputs": [], - "source": [ - "speedmap_segs >> filter(_.route_id.str.contains('910'))" - ] - }, - { - "cell_type": "markdown", - "id": "f919f640-261f-427f-be55-e8b2e4349f12", - "metadata": {}, - "source": [ - "it has no route_short_name...\n", - "```\n", - "857-13183,857,Metro Local Line,C & K LINE LINK,3,,,\n", - "901-13183,,Metro G Line 901,METRO G LINE,3,FC4C02,FFFFFF,https://www.metro.net/g-line/\n", - "910-13183,,Metro J Line 910/950,METRO J LINE,3,ADB8BF,000000,https://www.metro.net/j-line/\n", - "```" + "## Where'd the J line go??\n", + "\n", + "Has no route_short_name, removed that from grouping cols and added at end" ] } ], From 3a251eecde73fd5aae668fefe85bf28fe3c427ea Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 5 Nov 2024 00:07:36 +0000 Subject: [PATCH 11/13] format --- _shared_utils/shared_utils/rt_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_shared_utils/shared_utils/rt_utils.py b/_shared_utils/shared_utils/rt_utils.py index 5b987b404..c207f50f8 100644 --- a/_shared_utils/shared_utils/rt_utils.py +++ b/_shared_utils/shared_utils/rt_utils.py @@ -561,12 +561,14 @@ def categorize_time_of_day(value: Union[int, dt.datetime]) -> str: else: return "Evening" + def time_of_day_durations() -> pd.Series: """ Get duration in hours of each time of day classification. """ return pd.Series([categorize_time_of_day(x) for x in range(25)]).value_counts() + @jit(nopython=True) # numba gives huge speedup here (~60x) def time_at_position_numba(desired_position, shape_array, dt_float_array): if desired_position < shape_array.max() and desired_position > shape_array.min(): From c4bedd023ce1790f25c9810126408ab51a0fc8d8 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 5 Nov 2024 00:28:36 +0000 Subject: [PATCH 12/13] clean up new nb, get ready to migrate fully --- ca_transit_speed_maps/01_new_speedmaps.ipynb | 464 ++----------------- ca_transit_speed_maps/Makefile | 4 + ca_transit_speed_maps/stage_run_portfolio.py | 8 +- portfolio/sites/rt.yml | 28 +- 4 files changed, 70 insertions(+), 434 deletions(-) diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index 848a7315d..d7f023013 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 70, + "execution_count": 1, "id": "46898b5c-b5cc-4096-ab68-8c3e42fab870", "metadata": {}, "outputs": [], @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 71, + "execution_count": 2, "id": "cf3d8814-6f22-4a22-8b03-429ebb63a397", "metadata": {}, "outputs": [], @@ -37,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 72, + "execution_count": 3, "id": "9f15ed6a-5ab7-4f57-9695-3f762781b74c", "metadata": { "tags": [ @@ -52,106 +52,30 @@ }, { "cell_type": "code", - "execution_count": 73, + "execution_count": 4, "id": "a639fd84-29ca-4678-b568-2b1022701e14", "metadata": {}, "outputs": [], "source": [ "analysis_date = build_speedmaps_index.ANALYSIS_DATE\n", - "import datetime as dt\n", - "# if itp_id == 293:\n", - "# analysis_date = dt.date(2023, 9, 13)" + "import datetime as dt" ] }, { "cell_type": "code", - "execution_count": 74, + "execution_count": 5, "id": "eea40f4b-c378-4b70-a80b-bbe79f8441bf", "metadata": { "tags": [] }, "outputs": [], "source": [ - "speedmap_index = pd.read_parquet(f'_rt_progress_{analysis_date}.parquet') >> filter(_.organization_itp_id == itp_id)\n", - "# speedmap_index = pd.read_parquet(f'_rt_progress_{analysis_date}.parquet') >> filter(_.organization_name.str.contains('Torr'))" + "speedmap_index = pd.read_parquet(f'_rt_progress_{analysis_date}.parquet') >> filter(_.organization_itp_id == itp_id)" ] }, { "cell_type": "code", - "execution_count": 75, - "id": "c54b78fd-de92-45d9-b54d-49c5b88945c7", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
organization_nameorganization_itp_idorganization_source_record_idcaltrans_district_is_currentanalysis_dateschedule_gtfs_dataset_keystatus
42Los Angeles County Metropolitan Transportation...182recPnGkwdpnr8jmHB07 - Los AngelesTrue2024-10-160666caf3ec1ecc96b74f4477ee4bc939speedmap_segs_available
\n", - "
" - ], - "text/plain": [ - " organization_name organization_itp_id \\\n", - "42 Los Angeles County Metropolitan Transportation... 182 \n", - "\n", - " organization_source_record_id caltrans_district _is_current analysis_date \\\n", - "42 recPnGkwdpnr8jmHB 07 - Los Angeles True 2024-10-16 \n", - "\n", - " schedule_gtfs_dataset_key status \n", - "42 0666caf3ec1ecc96b74f4477ee4bc939 speedmap_segs_available " - ] - }, - "execution_count": 75, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_index" - ] - }, - { - "cell_type": "code", - "execution_count": 76, + "execution_count": 6, "id": "1b9762c8-0235-4d8f-b7a4-20a3213eb45e", "metadata": {}, "outputs": [], @@ -161,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 7, "id": "9302c0ad-1201-4c5a-8267-ec52719cf777", "metadata": {}, "outputs": [], @@ -171,17 +95,7 @@ }, { "cell_type": "code", - "execution_count": 78, - "id": "19dbeff0-faf6-43e3-9edf-6e68dfeceeac", - "metadata": {}, - "outputs": [], - "source": [ - "# speedmap_segs.columns" - ] - }, - { - "cell_type": "code", - "execution_count": 79, + "execution_count": 8, "id": "9f3c4c93-a5f5-40d7-9315-63e4fecbd738", "metadata": {}, "outputs": [], @@ -191,209 +105,15 @@ }, { "cell_type": "code", - "execution_count": 80, - "id": "e35e835e-9041-4735-917b-2517532e6166", - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
schedule_gtfs_dataset_keyshape_array_keyshape_idroute_iddirection_idstop_pairstop_pair_namesegment_idtime_of_dayp50_mph...p80_mphnamecaltrans_districtorganization_source_record_idorganization_namebase64_urlgeometryn_trips_schtrips_hr_schroute_short_name
52650666caf3ec1ecc96b74f4477ee4bc9391d801329ec1c7b1da3460ede3c0fe8bc1200106_JUNE24120-131831.016644__14345Whittwood Center__Santa Gertrudes / Starbuck16644-14345-1AM Peak14.49...16.38LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...LINESTRING (-117.99579 33.94440, -117.99579 33...41.333333120
52660666caf3ec1ecc96b74f4477ee4bc9391d801329ec1c7b1da3460ede3c0fe8bc1200106_JUNE24120-131831.014345__14346Santa Gertrudes / Starbuck__Santa Gertrudes / ...14345-14346-1AM Peak26.67...28.96LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...LINESTRING (-117.99307 33.93974, -117.99307 33...41.333333120
52670666caf3ec1ecc96b74f4477ee4bc9391d801329ec1c7b1da3460ede3c0fe8bc1200106_JUNE24120-131831.014346__14344Santa Gertrudes / Yermo__Santa Gertrudes / Lef...14346-14344-1AM Peak11.10...16.04LA Metro Bus Schedule07 - Los AngelesrecPnGkwdpnr8jmHBLos Angeles County Metropolitan Transportation...aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...LINESTRING (-117.99308 33.93630, -117.99308 33...41.333333120
\n", - "

3 rows × 22 columns

\n", - "
" - ], - "text/plain": [ - " schedule_gtfs_dataset_key shape_array_key \\\n", - "5265 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", - "5266 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", - "5267 0666caf3ec1ecc96b74f4477ee4bc939 1d801329ec1c7b1da3460ede3c0fe8bc \n", - "\n", - " shape_id route_id direction_id stop_pair \\\n", - "5265 1200106_JUNE24 120-13183 1.0 16644__14345 \n", - "5266 1200106_JUNE24 120-13183 1.0 14345__14346 \n", - "5267 1200106_JUNE24 120-13183 1.0 14346__14344 \n", - "\n", - " stop_pair_name segment_id \\\n", - "5265 Whittwood Center__Santa Gertrudes / Starbuck 16644-14345-1 \n", - "5266 Santa Gertrudes / Starbuck__Santa Gertrudes / ... 14345-14346-1 \n", - "5267 Santa Gertrudes / Yermo__Santa Gertrudes / Lef... 14346-14344-1 \n", - "\n", - " time_of_day p50_mph ... p80_mph name \\\n", - "5265 AM Peak 14.49 ... 16.38 LA Metro Bus Schedule \n", - "5266 AM Peak 26.67 ... 28.96 LA Metro Bus Schedule \n", - "5267 AM Peak 11.10 ... 16.04 LA Metro Bus Schedule \n", - "\n", - " caltrans_district organization_source_record_id \\\n", - "5265 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "5266 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "5267 07 - Los Angeles recPnGkwdpnr8jmHB \n", - "\n", - " organization_name \\\n", - "5265 Los Angeles County Metropolitan Transportation... \n", - "5266 Los Angeles County Metropolitan Transportation... \n", - "5267 Los Angeles County Metropolitan Transportation... \n", - "\n", - " base64_url \\\n", - "5265 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "5266 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "5267 aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy... \n", - "\n", - " geometry n_trips_sch \\\n", - "5265 LINESTRING (-117.99579 33.94440, -117.99579 33... 4 \n", - "5266 LINESTRING (-117.99307 33.93974, -117.99307 33... 4 \n", - "5267 LINESTRING (-117.99308 33.93630, -117.99308 33... 4 \n", - "\n", - " trips_hr_sch route_short_name \n", - "5265 1.333333 120 \n", - "5266 1.333333 120 \n", - "5267 1.333333 120 \n", - "\n", - "[3 rows x 22 columns]" - ] - }, - "execution_count": 80, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_segs >> head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 81, - "id": "f87584fb-f37d-4869-ba5d-af70a5a0e0e3", - "metadata": {}, - "outputs": [], - "source": [ - "peak_test = speedmap_segs >> filter(_.time_of_day == 'AM Peak')" - ] - }, - { - "cell_type": "code", - "execution_count": 82, + "execution_count": 9, "id": "edc84eda-ce2b-481f-ac78-6b7209cb25f4", "metadata": {}, "outputs": [], "source": [ - "def prep_gdf(gdf):\n", + "# TODO to utils\n", + "def time_period_and_arrowize(gdf, time_period):\n", " \n", + " gdf = gdf >> filter(_.time_of_day == time_period)\n", " gdf = gdf.to_crs(calitp_data_analysis.geography_utils.CA_NAD83Albers)\n", "\n", " ## shift to right side of road to display direction\n", @@ -407,17 +127,17 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": 10, "id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67", "metadata": {}, "outputs": [], "source": [ - "peak_test = prep_gdf(peak_test)" + "peak_test = time_period_and_arrowize(speedmap_segs, 'AM Peak')" ] }, { "cell_type": "code", - "execution_count": 84, + "execution_count": 11, "id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23", "metadata": {}, "outputs": [], @@ -428,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 85, + "execution_count": 12, "id": "87c7db4f-3da9-4ba4-915b-88432a841b39", "metadata": {}, "outputs": [ @@ -570,7 +290,7 @@ "[2 rows x 22 columns]" ] }, - "execution_count": 85, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -580,57 +300,41 @@ ] }, { - "cell_type": "code", - "execution_count": 86, - "id": "e7c32718-4eb2-4c2b-aba0-cca397aaabf3", + "cell_type": "markdown", + "id": "4e4c26e4-afca-48e1-b9fc-53393858a414", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", - " 'direction_id', 'stop_pair', 'stop_pair_name', 'segment_id',\n", - " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", - " 'caltrans_district', 'organization_source_record_id',\n", - " 'organization_name', 'base64_url', 'geometry', 'n_trips_sch',\n", - " 'trips_hr_sch', 'route_short_name'],\n", - " dtype='object')" - ] - }, - "execution_count": 86, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "peak_test.columns" + "## export map" ] }, { - "cell_type": "markdown", - "id": "4e4c26e4-afca-48e1-b9fc-53393858a414", + "cell_type": "code", + "execution_count": 63, + "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", "metadata": {}, + "outputs": [], "source": [ - "## export map" + "time_of_day_lower = time_of_day.lower().replace(' ', '_')" ] }, { "cell_type": "code", - "execution_count": 87, - "id": "10a3ff1d-04f8-40b8-ab91-5ef96fde9b6a", + "execution_count": 65, + "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "writing to calitp-map-tiles/testing/182_new.geojson.gz\n" + "writing to calitp-map-tiles/testing/182_pm_peak_new.geojson.gz\n" ] } ], "source": [ + "# TODO clone render method from RtFilterMapper, to utils\n", "speedmap_state = shared_utils.rt_utils.set_state_export(\n", - " peak_test, filename=f'{itp_id}_new', map_type='speedmap',\n", + " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", " color_col='p20_mph', cmap=cmap, legend_url=url,\n", " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" ] @@ -666,104 +370,22 @@ "speedmap_state" ] }, - { - "cell_type": "markdown", - "id": "6ff8e431-c4e5-4048-8c72-9ac5a5edeb79", - "metadata": {}, - "source": [ - "## other test" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "id": "02ffc2b6-9b8f-456b-ae33-85e7eea79df5", - "metadata": {}, - "outputs": [], - "source": [ - "time_of_day = 'PM Peak'" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "id": "2f44c03e-c7cc-4e49-8da4-be653d4c3546", - "metadata": {}, - "outputs": [], - "source": [ - "period_speeds = speedmap_segs >> filter(_.time_of_day == time_of_day)" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "id": "53a9f9cc-38d8-44d3-b7a6-a33fca62d32b", - "metadata": {}, - "outputs": [], - "source": [ - "period_test = prep_gdf(period_speeds)" - ] - }, { "cell_type": "code", - "execution_count": 63, - "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", + "execution_count": null, + "id": "737ad30b-cf8b-403a-ba37-4a77e00cfff1", "metadata": {}, "outputs": [], "source": [ - "time_of_day_lower = time_of_day.lower().replace(' ', '_')" - ] - }, - { - "cell_type": "code", - "execution_count": 65, - "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "writing to calitp-map-tiles/testing/182_pm_peak_new.geojson.gz\n" - ] - } - ], - "source": [ - "speedmap_state = shared_utils.rt_utils.set_state_export(\n", - " period_test, filename=f'{itp_id}_{time_of_day_lower}_new', map_type='speedmap',\n", - " color_col='p20_mph', cmap=cmap, legend_url=url,\n", - " cache_seconds=0, map_title=f'Speedmap Segs {time_of_day} {analysis_date}')" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "id": "360aee2f-9076-4c7d-9843-0f7959489f5c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_pm_peak_new.geojson.gz',\n", - " 'properties': {'stroked': False,\n", - " 'highlight_saturation_multiplier': 0.5,\n", - " 'tooltip_speed_key': 'p20_mph'},\n", - " 'type': 'speedmap'}],\n", - " 'lat_lon': (34.04804074656423, -118.29635317134563),\n", - " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy8xODJfcG1fcGVha19uZXcuZ2VvanNvbi5neiIsICJwcm9wZXJ0aWVzIjogeyJzdHJva2VkIjogZmFsc2UsICJoaWdobGlnaHRfc2F0dXJhdGlvbl9tdWx0aXBsaWVyIjogMC41LCAidG9vbHRpcF9zcGVlZF9rZXkiOiAicDIwX21waCJ9LCAidHlwZSI6ICJzcGVlZG1hcCJ9XSwgImxhdF9sb24iOiBbMzQuMDQ4MDQwNzQ2NTY0MjMsIC0xMTguMjk2MzUzMTcxMzQ1NjNdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" - ] - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "speedmap_state" + "## TODO get a better chart -- p20 - 50 - 80 seg speed?\n", + "# try:\n", + "# rt_day.set_filter(start_time='06:00', end_time='22:00')\n", + "# display(Markdown(f'Median Trip Speed by Hour of Day{rt_day.filter_formatted}'))\n", + "\n", + "# rt_day.chart_speeds(no_title=True);\n", + "# except:\n", + "# display(Markdown(f'Chart not available for this agency'))\n", + "# pass" ] } ], diff --git a/ca_transit_speed_maps/Makefile b/ca_transit_speed_maps/Makefile index 5df496396..122694c9d 100644 --- a/ca_transit_speed_maps/Makefile +++ b/ca_transit_speed_maps/Makefile @@ -1,3 +1,7 @@ +generate_speedmaps_quickly: + python build_speedmaps_index.py + python stage_run_portfolio.py + generate_speedmaps_slowly: python build_speedmaps_index.py python check_stage_intermediate.py diff --git a/ca_transit_speed_maps/stage_run_portfolio.py b/ca_transit_speed_maps/stage_run_portfolio.py index b244ea9cd..088803c33 100644 --- a/ca_transit_speed_maps/stage_run_portfolio.py +++ b/ca_transit_speed_maps/stage_run_portfolio.py @@ -23,9 +23,8 @@ def make_rt_site_yml(speedmaps_index_joined, rt_site_path = '../portfolio/sites/rt.yml'): - # make sure intermediate data is ran or at least attempted - assert speedmaps_index_joined.status.isin(['map_confirmed', - 'parser_failed', 'map_failed']).all(), 'must run prior scripts first, see Makefile' + # make sure index is generated + assert speedmaps_index_joined.status.isin(['speedmap_segs_available']).all(), 'must run prior scripts first, see Makefile' with open(rt_site_path) as rt_site: rt_site_data = yaml.load(rt_site, yaml.Loader) @@ -37,8 +36,7 @@ def make_rt_site_yml(speedmaps_index_joined, continue chapter_dict = {} filtered = (speedmaps_index_joined - >> filter(_.caltrans_district == district, - -_.status.isin(['parser_failed', 'map_failed'])) + >> filter(_.caltrans_district == district) >> arrange(_.organization_name) ) chapter_dict['caption'] = f'District {district}' diff --git a/portfolio/sites/rt.yml b/portfolio/sites/rt.yml index be4e2854a..4131b2841 100644 --- a/portfolio/sites/rt.yml +++ b/portfolio/sites/rt.yml @@ -1,5 +1,5 @@ directory: ./ca_transit_speed_maps/ -notebook: ./ca_transit_speed_maps/speedmaps.ipynb +notebook: ./ca_transit_speed_maps/01_new_speedmaps.ipynb parts: - chapters: - caption: District 01 - Eureka @@ -10,17 +10,25 @@ parts: - itp_id: 108 - itp_id: 135 - itp_id: 159 + - itp_id: 198 + - itp_id: 261 - caption: District 02 - Redding params: district: 02 - Redding sections: - itp_id: 259 + - itp_id: 334 - caption: District 03 - Marysville params: district: 03 - Marysville sections: + - itp_id: 48 - itp_id: 105 + - itp_id: 489 + - itp_id: 221 + - itp_id: 273 - itp_id: 331 + - itp_id: 351 - itp_id: 372 - caption: District 04 - Oakland params: @@ -37,6 +45,7 @@ parts: - itp_id: 70 - itp_id: 336 - itp_id: 127 + - itp_id: 167 - itp_id: 194 - itp_id: 218 - itp_id: 246 @@ -54,10 +63,11 @@ parts: params: district: 05 - San Luis Obispo sections: + - itp_id: 287 - itp_id: 298 - - itp_id: 312 - itp_id: 208 - itp_id: 289 + - itp_id: 293 - itp_id: 296 - caption: District 06 - Fresno params: @@ -66,8 +76,9 @@ parts: - itp_id: 116 - itp_id: 361 - itp_id: 126 + - itp_id: 146 - itp_id: 148 - - itp_id: 188 + - itp_id: 474 - caption: District 07 - Los Angeles params: district: 07 - Los Angeles @@ -75,8 +86,8 @@ parts: - itp_id: 16 - itp_id: 45 - itp_id: 54 + - itp_id: 75 - itp_id: 87 - - itp_id: 97 - itp_id: 183 - itp_id: 210 - itp_id: 228 @@ -84,24 +95,23 @@ parts: - itp_id: 243 - itp_id: 260 - itp_id: 295 - - itp_id: 300 - itp_id: 308 - itp_id: 337 - itp_id: 339 - - itp_id: 112 - itp_id: 123 + - itp_id: 170 - itp_id: 182 + - itp_id: 165 - itp_id: 380 - - itp_id: 170 - caption: District 08 - San Bernardino params: district: 08 - San Bernardino sections: - - itp_id: 34 - itp_id: 214 - itp_id: 232 - itp_id: 238 - itp_id: 269 + - itp_id: 327 - itp_id: 360 - caption: District 09 - Bishop params: @@ -117,6 +127,7 @@ parts: - itp_id: 10 - itp_id: 284 - itp_id: 484 + - itp_id: 482 - caption: District 11 - San Diego params: district: 11 - San Diego @@ -128,6 +139,7 @@ parts: params: district: 12 - Irvine sections: + - itp_id: 14 - itp_id: 235 readme: ./ca_transit_speed_maps/README.md title: California Transit Speed Maps From f0ae2830e40d12cc8712f1a1c4c83964d07dd29a Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 6 Nov 2024 00:38:52 +0000 Subject: [PATCH 13/13] attempt new chart --- ca_transit_speed_maps/01_new_speedmaps.ipynb | 885 ++++++++++++++++++- 1 file changed, 856 insertions(+), 29 deletions(-) diff --git a/ca_transit_speed_maps/01_new_speedmaps.ipynb b/ca_transit_speed_maps/01_new_speedmaps.ipynb index d7f023013..387c7fb81 100644 --- a/ca_transit_speed_maps/01_new_speedmaps.ipynb +++ b/ca_transit_speed_maps/01_new_speedmaps.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 62, "id": "46898b5c-b5cc-4096-ab68-8c3e42fab870", "metadata": {}, "outputs": [], @@ -12,8 +12,9 @@ "warnings.filterwarnings('ignore')\n", "\n", "import calitp_data_analysis.magics\n", + "from calitp_data_analysis import calitp_color_palette\n", "\n", - "from rt_analysis import rt_filter_map_plot\n", + "# from rt_analysis import rt_filter_map_plot\n", "import build_speedmaps_index\n", "\n", "from IPython.display import display, Markdown\n", @@ -47,7 +48,7 @@ "outputs": [], "source": [ "## parameters cell\n", - "itp_id = 182" + "itp_id = 300" ] }, { @@ -309,28 +310,32 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 13, "id": "d483e182-b36c-487e-a194-7a9e48d5b32f", "metadata": {}, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'time_of_day' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m time_of_day_lower \u001b[38;5;241m=\u001b[39m \u001b[43mtime_of_day\u001b[49m\u001b[38;5;241m.\u001b[39mlower()\u001b[38;5;241m.\u001b[39mreplace(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", + "\u001b[0;31mNameError\u001b[0m: name 'time_of_day' is not defined" + ] + } + ], "source": [ "time_of_day_lower = time_of_day.lower().replace(' ', '_')" ] }, { "cell_type": "code", - "execution_count": 65, + "execution_count": null, "id": "51e108ee-19f5-4266-8848-fb5ac57f5108", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "writing to calitp-map-tiles/testing/182_pm_peak_new.geojson.gz\n" - ] - } - ], + "outputs": [], "source": [ "# TODO clone render method from RtFilterMapper, to utils\n", "speedmap_state = shared_utils.rt_utils.set_state_export(\n", @@ -341,33 +346,855 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": null, "id": "75f2695e-4b80-4d91-8dce-1fa8e347729b", "metadata": {}, + "outputs": [], + "source": [ + "speedmap_state" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "5af14034-e54b-4d00-bf78-5882ae3a7b24", + "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'state_dict': {'name': 'null',\n", - " 'layers': [{'name': 'Speedmap Segs PM Peak 2024-10-16',\n", - " 'url': 'https://storage.googleapis.com/calitp-map-tiles/testing/182_new.geojson.gz',\n", - " 'properties': {'stroked': False,\n", - " 'highlight_saturation_multiplier': 0.5,\n", - " 'tooltip_speed_key': 'p20_mph'},\n", - " 'type': 'speedmap'}],\n", - " 'lat_lon': (34.0539357609537, -118.29997523003668),\n", - " 'zoom': 13,\n", - " 'legend_url': 'https://storage.googleapis.com/calitp-map-tiles/speeds_legend_color_access.svg'},\n", - " 'spa_link': 'https://embeddable-maps.calitp.org/?state=eyJuYW1lIjogIm51bGwiLCAibGF5ZXJzIjogW3sibmFtZSI6ICJTcGVlZG1hcCBTZWdzIFBNIFBlYWsgMjAyNC0xMC0xNiIsICJ1cmwiOiAiaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL2NhbGl0cC1tYXAtdGlsZXMvdGVzdGluZy8xODJfbmV3Lmdlb2pzb24uZ3oiLCAicHJvcGVydGllcyI6IHsic3Ryb2tlZCI6IGZhbHNlLCAiaGlnaGxpZ2h0X3NhdHVyYXRpb25fbXVsdGlwbGllciI6IDAuNSwgInRvb2x0aXBfc3BlZWRfa2V5IjogInAyMF9tcGgifSwgInR5cGUiOiAic3BlZWRtYXAifV0sICJsYXRfbG9uIjogWzM0LjA1MzkzNTc2MDk1MzcsIC0xMTguMjk5OTc1MjMwMDM2NjhdLCAiem9vbSI6IDEzLCAibGVnZW5kX3VybCI6ICJodHRwczovL3N0b3JhZ2UuZ29vZ2xlYXBpcy5jb20vY2FsaXRwLW1hcC10aWxlcy9zcGVlZHNfbGVnZW5kX2NvbG9yX2FjY2Vzcy5zdmcifQ=='}" + "Index(['schedule_gtfs_dataset_key', 'shape_array_key', 'shape_id', 'route_id',\n", + " 'direction_id', 'stop_pair', 'stop_pair_name', 'segment_id',\n", + " 'time_of_day', 'p50_mph', 'n_trips', 'p20_mph', 'p80_mph', 'name',\n", + " 'caltrans_district', 'organization_source_record_id',\n", + " 'organization_name', 'base64_url', 'geometry', 'n_trips_sch',\n", + " 'trips_hr_sch', 'route_short_name'],\n", + " dtype='object')" ] }, - "execution_count": 88, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "speedmap_state" + "speedmap_segs.columns" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fdf9c56a-0ad8-44b8-8bed-a677c9d36037", + "metadata": {}, + "outputs": [], + "source": [ + "speedmap_segs" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "df0b34b1-f3fd-4081-8598-eed78541da71", + "metadata": {}, + "outputs": [ + { + "ename": "ModuleNotFoundError", + "evalue": "No module named 'vega_datasets'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[15], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01maltair\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01malt\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mvega_datasets\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m data\n\u001b[1;32m 4\u001b[0m source \u001b[38;5;241m=\u001b[39m data\u001b[38;5;241m.\u001b[39mbarley()\n\u001b[1;32m 6\u001b[0m error_bars \u001b[38;5;241m=\u001b[39m alt\u001b[38;5;241m.\u001b[39mChart(source)\u001b[38;5;241m.\u001b[39mmark_errorbar(extent\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstdev\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mencode(\n\u001b[1;32m 7\u001b[0m alt\u001b[38;5;241m.\u001b[39mY(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myield:Q\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39mscale(zero\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m),\n\u001b[1;32m 8\u001b[0m alt\u001b[38;5;241m.\u001b[39mX(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mvariety:N\u001b[39m\u001b[38;5;124m\"\u001b[39m),\n\u001b[1;32m 9\u001b[0m )\n", + "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'vega_datasets'" + ] + } + ], + "source": [ + "import altair as alt\n", + "from vega_datasets import data\n", + "\n", + "source = data.barley()\n", + "\n", + "error_bars = alt.Chart(source).mark_errorbar(extent=\"stdev\").encode(\n", + " alt.Y(\"yield:Q\").scale(zero=False),\n", + " alt.X(\"variety:N\"),\n", + ")\n", + "\n", + "points = alt.Chart(source).mark_point(\n", + " filled=True,\n", + " color=\"black\",\n", + ").encode(\n", + " alt.Y(\"mean(yield)\"),\n", + " alt.X(\"variety:N\"),\n", + ")\n", + "\n", + "error_bars + points" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "ded22024-1209-419c-bfce-22499d58718a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
time_of_dayp50_mphp20_mphp80_mphy_erry_err2
5265AM Peak13.0013.0013.0013.0013.00
5266AM Peak22.5822.5822.5822.5822.58
5267AM Peak7.317.317.317.317.31
5268AM Peak15.7215.7215.7215.7215.72
5269AM Peak18.6218.6218.6218.6218.62
.....................
126376Early AM55.4555.4555.4555.4555.45
126377Early AM54.6254.6254.6254.6254.62
126378Early AM8.228.228.228.228.22
126379Early AM17.6017.6017.6017.6017.60
126380Early AM16.0216.0216.0216.0216.02
\n", + "

121116 rows × 6 columns

\n", + "
" + ], + "text/plain": [ + " time_of_day p50_mph p20_mph p80_mph y_err y_err2\n", + "5265 AM Peak 13.00 13.00 13.00 13.00 13.00\n", + "5266 AM Peak 22.58 22.58 22.58 22.58 22.58\n", + "5267 AM Peak 7.31 7.31 7.31 7.31 7.31\n", + "5268 AM Peak 15.72 15.72 15.72 15.72 15.72\n", + "5269 AM Peak 18.62 18.62 18.62 18.62 18.62\n", + "... ... ... ... ... ... ...\n", + "126376 Early AM 55.45 55.45 55.45 55.45 55.45\n", + "126377 Early AM 54.62 54.62 54.62 54.62 54.62\n", + "126378 Early AM 8.22 8.22 8.22 8.22 8.22\n", + "126379 Early AM 17.60 17.60 17.60 17.60 17.60\n", + "126380 Early AM 16.02 16.02 16.02 16.02 16.02\n", + "\n", + "[121116 rows x 6 columns]" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df >> group_by" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "23e5a153-f608-4aad-b9ca-8cabc7f90017", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "
\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "alt.Chart(df).mark_errorbar().encode(\n", + " # y = alt.Y(\"p50_mph:Q\").scale(zero=False),\n", + " y = alt.Y(\"p50_mph:Q\"),\n", + " yError=(\"y_err:Q\"),\n", + " yError2=(\"y_err2:Q\"),\n", + " x = alt.X(\"time_of_day:N\", sort=['Early AM', 'AM Peak', 'Midday', 'PM Peak', 'Evening', 'Owl']),\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "3feb8dbd-afea-4e30-8fd9-544875699e70", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
time_of_dayp50_mphp20_mphp80_mphy_erry_err2
0AM Peak13.3510.7416.612.613.26
1Early AM15.3712.8518.332.522.96
2Evening17.1715.0119.622.162.45
3Midday12.789.9616.412.823.63
4Owl19.2517.1321.242.121.99
5PM Peak12.7810.1516.372.633.59
\n", + "
" + ], + "text/plain": [ + " time_of_day p50_mph p20_mph p80_mph y_err y_err2\n", + "0 AM Peak 13.35 10.74 16.61 2.61 3.26\n", + "1 Early AM 15.37 12.85 18.33 2.52 2.96\n", + "2 Evening 17.17 15.01 19.62 2.16 2.45\n", + "3 Midday 12.78 9.96 16.41 2.82 3.63\n", + "4 Owl 19.25 17.13 21.24 2.12 1.99\n", + "5 PM Peak 12.78 10.15 16.37 2.63 3.59" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "id": "52e9a61d-d9bc-474d-a6ed-2120099d0592", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0 -2.61\n", + "1 -2.52\n", + "2 -2.16\n", + "3 -2.82\n", + "4 -2.12\n", + "5 -2.63\n", + "dtype: float64" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "-(df['p50_mph'] - df['p20_mph'])" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "id": "bba0a5ba-a95a-4923-b04f-800b74e63a98", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "branca.colormap.StepColormap" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(cmap)" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "64083c0e-4283-4554-ae8a-3e4e8a34ce21", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['__call__',\n", + " '__class__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__le__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " '__weakref__',\n", + " '_children',\n", + " '_env',\n", + " '_get_self_bounds',\n", + " '_id',\n", + " '_name',\n", + " '_parent',\n", + " '_repr_html_',\n", + " '_template',\n", + " 'add_child',\n", + " 'add_children',\n", + " 'add_to',\n", + " 'caption',\n", + " 'colors',\n", + " 'get_bounds',\n", + " 'get_name',\n", + " 'get_root',\n", + " 'index',\n", + " 'render',\n", + " 'rgb_bytes_tuple',\n", + " 'rgb_hex_str',\n", + " 'rgba_bytes_tuple',\n", + " 'rgba_floats_tuple',\n", + " 'rgba_hex_str',\n", + " 'save',\n", + " 'scale',\n", + " 'to_dict',\n", + " 'to_json',\n", + " 'to_linear',\n", + " 'vmax',\n", + " 'vmin']" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dir(cmap)" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "id": "df62d501-9ef1-4203-a881-4e381651590e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[[None, None], [None, None]]" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cmap.get_bounds()" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "id": "7c9501e3-24e7-4677-beaf-fa138d6a0837", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "['__call__',\n", + " '__class__',\n", + " '__delattr__',\n", + " '__dict__',\n", + " '__dir__',\n", + " '__doc__',\n", + " '__eq__',\n", + " '__format__',\n", + " '__ge__',\n", + " '__getattribute__',\n", + " '__gt__',\n", + " '__hash__',\n", + " '__init__',\n", + " '__init_subclass__',\n", + " '__le__',\n", + " '__lt__',\n", + " '__module__',\n", + " '__ne__',\n", + " '__new__',\n", + " '__reduce__',\n", + " '__reduce_ex__',\n", + " '__repr__',\n", + " '__setattr__',\n", + " '__sizeof__',\n", + " '__str__',\n", + " '__subclasshook__',\n", + " '__weakref__',\n", + " '_children',\n", + " '_env',\n", + " '_get_self_bounds',\n", + " '_id',\n", + " '_name',\n", + " '_parent',\n", + " '_repr_html_',\n", + " '_template',\n", + " 'add_child',\n", + " 'add_children',\n", + " 'add_to',\n", + " 'caption',\n", + " 'colors',\n", + " 'get_bounds',\n", + " 'get_name',\n", + " 'get_root',\n", + " 'index',\n", + " 'render',\n", + " 'rgb_bytes_tuple',\n", + " 'rgb_hex_str',\n", + " 'rgba_bytes_tuple',\n", + " 'rgba_floats_tuple',\n", + " 'rgba_hex_str',\n", + " 'save',\n", + " 'scale',\n", + " 'to_dict',\n", + " 'to_json',\n", + " 'to_linear',\n", + " 'vmax',\n", + " 'vmin']" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "dir(cmap.scale())" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "6d2ccae7-a8b6-4e44-9095-17e4e416ea29", + "metadata": {}, + "outputs": [ + { + "ename": "SchemaValidationError", + "evalue": "`Scale` has no parameter named 'children'\n\nExisting parameter names are:\nalign domain exponent paddingOuter round \nbase domainMax interpolate range scheme \nbins domainMid nice rangeMax type \nclamp domainMin padding rangeMin zero \nconstant domainRaw paddingInner reverse \n\nSee the help for `Scale` to read the full description of these parameters", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mSchemaValidationError\u001b[0m Traceback (most recent call last)", + "File \u001b[0;32m/opt/conda/lib/python3.9/site-packages/altair/vegalite/v5/api.py:961\u001b[0m, in \u001b[0;36mTopLevelMixin.to_dict\u001b[0;34m(self, validate, format, ignore, context)\u001b[0m\n\u001b[1;32m 956\u001b[0m context[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtop_level\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 958\u001b[0m \u001b[38;5;66;03m# TopLevelMixin instance does not necessarily have to_dict defined\u001b[39;00m\n\u001b[1;32m 959\u001b[0m \u001b[38;5;66;03m# but due to how Altair is set up this should hold.\u001b[39;00m\n\u001b[1;32m 960\u001b[0m \u001b[38;5;66;03m# Too complex to type hint right now\u001b[39;00m\n\u001b[0;32m--> 961\u001b[0m vegalite_spec \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mTopLevelMixin\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcopy\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_dict\u001b[49m\u001b[43m(\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore[misc]\u001b[39;49;00m\n\u001b[1;32m 962\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalidate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalidate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mignore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mignore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mdict\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mcontext\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpre_transform\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 963\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 965\u001b[0m \u001b[38;5;66;03m# TODO: following entries are added after validation. Should they be validated?\u001b[39;00m\n\u001b[1;32m 966\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_top_level:\n\u001b[1;32m 967\u001b[0m \u001b[38;5;66;03m# since this is top-level we add $schema if it's missing\u001b[39;00m\n", + "File \u001b[0;32m/opt/conda/lib/python3.9/site-packages/altair/utils/schemapi.py:978\u001b[0m, in \u001b[0;36mSchemaBase.to_dict\u001b[0;34m(self, validate, ignore, context)\u001b[0m\n\u001b[1;32m 971\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mvalidate(result)\n\u001b[1;32m 972\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m jsonschema\u001b[38;5;241m.\u001b[39mValidationError \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 973\u001b[0m \u001b[38;5;66;03m# We do not raise `from err` as else the resulting\u001b[39;00m\n\u001b[1;32m 974\u001b[0m \u001b[38;5;66;03m# traceback is very long as it contains part\u001b[39;00m\n\u001b[1;32m 975\u001b[0m \u001b[38;5;66;03m# of the Vega-Lite schema. It would also first\u001b[39;00m\n\u001b[1;32m 976\u001b[0m \u001b[38;5;66;03m# show the less helpful ValidationError instead of\u001b[39;00m\n\u001b[1;32m 977\u001b[0m \u001b[38;5;66;03m# the more user friendly SchemaValidationError\u001b[39;00m\n\u001b[0;32m--> 978\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m SchemaValidationError(\u001b[38;5;28mself\u001b[39m, err) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 979\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n", + "\u001b[0;31mSchemaValidationError\u001b[0m: `Scale` has no parameter named 'children'\n\nExisting parameter names are:\nalign domain exponent paddingOuter round \nbase domainMax interpolate range scheme \nbins domainMid nice rangeMax type \nclamp domainMin padding rangeMin zero \nconstant domainRaw paddingInner reverse \n\nSee the help for `Scale` to read the full description of these parameters" + ] + }, + { + "data": { + "text/plain": [ + "alt.LayerChart(...)" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = speedmap_segs[['time_of_day', 'p50_mph', 'p20_mph', 'p80_mph']]\n", + "df = df >> group_by(_.time_of_day) >> summarize(p50_mph = _.p50_mph.quantile(.5),\n", + " p20_mph = _.p20_mph.quantile(.5),\n", + " p80_mph = _.p80_mph.quantile(.5),)\n", + "df['y_err'] = -(df['p50_mph'] - df['p20_mph'])\n", + "df['y_err2'] = df['p80_mph'] - df['p50_mph']\n", + "\n", + "error_bars = alt.Chart(df).mark_errorbar(thickness=5,\n", + " color='gray',\n", + " opacity=.8).encode(\n", + " # y = alt.Y(\"p50_mph:Q\").scale(zero=False),\n", + " y = alt.Y(\"p50_mph:Q\").scale(zero=False),\n", + " yError=(\"y_err:Q\"),\n", + " yError2=(\"y_err2:Q\"),\n", + " x = alt.X(\"time_of_day:N\", sort=['Early AM', 'AM Peak', 'Midday', 'PM Peak', 'Evening', 'Owl']),\n", + ")\n", + "\n", + "points = alt.Chart(df).mark_point(\n", + " filled=True,\n", + " # color=\"black\",\n", + ").encode(\n", + " alt.Y(\"p50_mph:Q\"),\n", + " alt.X(\"time_of_day:N\", sort=['Early AM', 'AM Peak', 'Midday', 'PM Peak', 'Evening', 'Owl']),\n", + " color=alt.Color('p50_mph', scale=cmap)\n", + ")\n", + "\n", + "error_bars + points\n", + "# error_bars" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "551c030e-6f02-49d8-92f2-1d283fd3bc94", + "metadata": {}, + "outputs": [], + "source": [ + "source = pd.DataFrame({\n", + " \"yield_error\": [7.5522, 6.9775, 3.9167, 11.9732],\n", + " \"yield_center\": [32.4, 30.96667, 33.966665, 30.45],\n", + " \"variety\": [\"Glabron\", \"Manchuria\", \"No. 457\", \"No. 462\"],\n", + "})\n", + "\n", + "bar = alt.Chart(source).mark_errorbar().encode(\n", + " x=alt.X(\"yield_center:Q\").scale(zero=False).title(\"yield\"),\n", + " xError=(\"yield_error:Q\"),\n", + " y=alt.Y(\"variety:N\"),\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "8dd67db3-eeb8-4b0b-ae2e-d5e3a96f1de6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "
\n", + "" + ], + "text/plain": [ + "alt.Chart(...)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bar" ] }, {