diff --git a/.gitattributes b/.gitattributes index cb03b31a30..ec31ea3293 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ portfolio/**/*.ipynb filter=lfs diff=lfs merge=lfs -text +portfolio/route_speeds/**/*.ipynb +portfolio/ntd_monthly_ridership/**/*.ipynb portfolio/dla/district_10__district_title_district-10-stockton/0__dla_district_report__district_10__district_title_district-10-stockton.ipynb filter=lfs diff=lfs merge=lfs -text portfolio/dla/district_11__district_title_district-11-san-diego/0__dla_district_report__district_11__district_title_district-11-san-diego.ipynb filter=lfs diff=lfs merge=lfs -text portfolio/dla/district_12__district_title_district-12-irvine/0__dla_district_report__district_12__district_title_district-12-irvine.ipynb filter=lfs diff=lfs merge=lfs -text diff --git a/Makefile b/Makefile index e07bb7b32b..2c5b86d316 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,9 @@ install_env: #cd rt_delay/ && make setup_rt_analysis && cd .. cd rt_segment_speeds && pip install -r requirements.txt && cd .. +production_portfolio: + python portfolio/portfolio.py index --deploy --prod + # Create .egg to upload to dask cloud cluster egg_modules: cd ~/data-analyses/rt_segment_speeds && python setup.py bdist_egg && cd .. diff --git a/_shared_utils/shared_utils/rt_dates.py b/_shared_utils/shared_utils/rt_dates.py index 25c4603942..67deabb542 100644 --- a/_shared_utils/shared_utils/rt_dates.py +++ b/_shared_utils/shared_utils/rt_dates.py @@ -61,3 +61,18 @@ "Q3_2023": "2023-07-12", "Q4_2023": "2023-10-11", } + +MONTH_DICT = { + 1: "January", + 2: "February", + 3: "March", + 4: "April", + 5: "May", + 6: "June", + 7: "July", + 8: "August", + 9: "September", + 10: "October", + 11: "November", + 12: "December", +} diff --git a/ntd/README.md b/ntd/README.md new file mode 100644 index 0000000000..3782bd155e --- /dev/null +++ b/ntd/README.md @@ -0,0 +1,10 @@ +# NTD Monthly Ridership by RTPA + +Provide CalSTA with NTD Monthly Ridership by each regional transportation planning authority (RTPA). + +This report shows general ridership trends by transit agency, mode, and type of service. Reported unlinked passenger trips are reported, as well as the change from the prior year. For example, July 2023's change would be the change in July 2023's reported values against July 2022's reported values. + +## Datasets +1. NTD monthly data: https://www.transit.dot.gov/ntd/data-product/monthly-module-adjusted-data-release. +2. [RTPA list](https://gis.data.ca.gov/datasets/CAEnergy::regional-transportation-planning-agencies/explore?appid=cf412a17daaa47bca93c6d6b7e77aff0&edit=true) +3. Download our processed full data [here](https://storage.googleapis.com/calitp-publish-data-analysis/ntd_monthly_ridership/). \ No newline at end of file diff --git a/ntd/monthly_ridership_by_rtpa.py b/ntd/monthly_ridership_by_rtpa.py new file mode 100644 index 0000000000..c1a79c5e48 --- /dev/null +++ b/ntd/monthly_ridership_by_rtpa.py @@ -0,0 +1,185 @@ +""" +NTD Monthly Ridership by RTPA + +1. Transit operators (`ntd_id`) in CA should be associated with RTPAs (use crosswalk uploaded in GCS) +2. For each RTPA, grab the latest month's ridership column, sort transit operators alphabetically, and write out spreadsheets. +3. Spreadsheets stored in folder to send to CalSTA. +""" +import gcsfs +import geopandas as gpd +import os +import pandas as pd +import shutil + +from calitp_data_analysis.sql import to_snakecase +from segment_speed_utils.project_vars import PUBLIC_GCS +from shared_utils.rt_dates import MONTH_DICT +from update_vars import GCS_FILE_PATH, NTD_MODES, NTD_TOS + +fs = gcsfs.GCSFileSystem() + +RTPA_URL = ("https://services3.arcgis.com/bWPjFyq029ChCGur/arcgis/rest/services/" + "RTPAs/FeatureServer/0/query?outFields=*&where=1%3D1&f=geojson" + ) + +#gpd.read_file(RTPA_URL).RTPA.drop_duplicates().to_csv("rtpa.csv") +def add_change_columns( + df: pd.DataFrame, + year: int, + month: int +) -> pd.DataFrame: + """ + """ + ntd_month_col = f"{month}/{year}" + prior_year_col = f"{month}/{int(year)-1}" + + df[f"change_1yr_{ntd_month_col}"] = df[ntd_month_col] - df[prior_year_col] + df = get_percent_change(df, ntd_month_col, prior_year_col) + + return df + + +def get_percent_change( + df: pd.DataFrame, + current_col: str, + prior_col: str +) -> pd.DataFrame: + + df[f"pct_change_1yr_{current_col}"] = ( + (df[current_col] - df[prior_col]) + .divide(df[current_col]) + .round(4) + ) + + return df + +def save_rtpa_outputs( + df: pd.DataFrame, year: int, month: str, + upload_to_public: bool = False +): + """ + Export a csv for each RTPA into a folder. + Zip that folder. + Upload zipped file to GCS. + """ + for i in df.RTPA.unique(): + # Filename should be snakecase + rtpa_snakecase = i.replace(' ', '_').lower() + + (df[df.RTPA == i] + .sort_values("NTD ID") + .drop(columns = "_merge") + .to_csv( + f"./{year}_{month}/{rtpa_snakecase}.csv", + index = False) + ) + + # Zip this folder, and save zipped output to GCS + shutil.make_archive(f"./{year}_{month}", "zip", f"{year}_{month}") + print("Zipped folder") + + fs.upload( + f"./{year}_{month}.zip", + f"{GCS_FILE_PATH}{year}_{month}.zip" + ) + + if upload_to_public: + fs.upload( + f"./{year}_{month}.zip", + f"{PUBLIC_GCS}ntd_monthly_ridership/{year}_{month}.zip" + ) + + print("Uploaded to GCS") + + return + + +def produce_ntd_monthly_ridership_by_rtpa( + upt_url: str, + year: int, + month: str +) -> pd.DataFrame: + """ + Import NTD data from url, filter to CA, + merge in crosswalk, and save individual csvs. + """ + # Import data, make sure NTD ID is string + full_upt = pd.read_excel( + upt_url, sheet_name = "UPT", + dtype = {"NTD ID": "str"} + ) + + full_upt = full_upt[full_upt.Agency.notna()].reset_index(drop=True) + full_upt.to_parquet( + f"{GCS_FILE_PATH}ntd_monthly_ridership_{year}_{month}.parquet" + ) + + # Filter to CA + ca = full_upt[(full_upt["UZA Name"].str.contains(", CA")) & + (full_upt.Agency.notna())].reset_index(drop=True) + + crosswalk = pd.read_csv( + f"{GCS_FILE_PATH}ntd_id_rtpa_crosswalk.csv", + dtype = {"NTD ID": "str"} + ) + + df = pd.merge( + ca, + # Merging on too many columns can create problems + # because csvs and dtypes aren't stable / consistent + # for NTD ID, Legacy NTD ID, and UZA + crosswalk[["NTD ID", "RTPA"]], + on = "NTD ID", + how = "left", + indicator = True + ) + + print(df._merge.value_counts()) + + # Good, everything merged, as we want + if len(df[df._merge=="left_only"]) > 0: + raise ValueError("There are unmerged rows to crosswalk") + + # Add new columns + reversed_months = {v:k for k, v in MONTH_DICT.items()} + + for m in range(1, reversed_months[month] + 1): + df = add_change_columns(df, year, m) + + df = df.assign( + Mode_full = df.Mode.map(NTD_MODES), + TOS_full = df.TOS.map(NTD_TOS) + ) + + return df + + +def remove_local_outputs(year: int, month: str): + shutil.rmtree(f"{year}_{month}/") + os.remove(f"{year}_{month}.zip") + + +if __name__ == "__main__": + + # Define variables we'll probably change later + from update_vars import YEAR, MONTH, MONTH_CREATED + + FULL_URL = ( + "https://www.transit.dot.gov/sites/fta.dot.gov/files/" + f"{MONTH_CREATED}/{MONTH}%20{YEAR}%20" + "Complete%20Monthly%20Ridership%20%28with%20" + "adjustments%20and%20estimates%29.xlsx" + ) + + df = produce_ntd_monthly_ridership_by_rtpa(FULL_URL, YEAR, MONTH) + print(df.columns) + df.to_parquet(f"{GCS_FILE_PATH}ca_monthly_ridership_{YEAR}_{MONTH}.parquet") + + # For each RTPA, we'll produce a single csv and save it to a local folder + os.makedirs(f"./{YEAR}_{MONTH}/") + + df = pd.read_parquet( + f"{GCS_FILE_PATH}ca_monthly_ridership_{YEAR}_{MONTH}.parquet" + ) + save_rtpa_outputs(df, YEAR, MONTH, upload_to_public = False) + remove_local_outputs(YEAR, MONTH) \ No newline at end of file diff --git a/ntd/monthly_ridership_report.ipynb b/ntd/monthly_ridership_report.ipynb new file mode 100644 index 0000000000..801eb82b7c --- /dev/null +++ b/ntd/monthly_ridership_report.ipynb @@ -0,0 +1,423 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "39433d1d-c54e-475c-878e-78c992d0eb58", + "metadata": {}, + "outputs": [], + "source": [ + "%%capture\n", + "import warnings\n", + "warnings.filterwarnings('ignore')\n", + "\n", + "import altair as alt\n", + "import calitp_data_analysis.magics\n", + "import pandas as pd\n", + "\n", + "from IPython.display import Markdown\n", + "\n", + "from bus_service_utils import chart_utils\n", + "from calitp_data_analysis import calitp_color_palette as cp\n", + "from update_vars import GCS_FILE_PATH\n", + "#from monthly_ridership_by_rtpa import get_percent_change\n", + "\n", + "#alt.renderers.enable(\"html\")\n", + "alt.data_transformers.enable('default', max_rows=None)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "798b9f83-ee62-489d-bc7c-9d1542af0a29", + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "# parameters cell for local\n", + "#rtpa = \"Butte County Association of Governments\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f649dd2e-d38b-439c-94cd-a7480dc77511", + "metadata": {}, + "outputs": [], + "source": [ + "%%capture_parameters\n", + "rtpa" + ] + }, + { + "cell_type": "markdown", + "id": "bae4c08b-308e-4c38-b82c-42c94eadf120", + "metadata": {}, + "source": [ + "# {rtpa}\n", + "## Monthly Ridership Trends\n", + "\n", + "**Download the [zipped data](https://storage.googleapis.com/calitp-publish-data-analysis/ntd_monthly_ridership/).**" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cf017b79-26d5-455b-8c99-e9ba27d2dd77", + "metadata": {}, + "outputs": [], + "source": [ + "df = pd.read_parquet(\n", + " f\"{GCS_FILE_PATH}ca_monthly_ridership_2023_October.parquet\",\n", + " filters = [[(\"RTPA\", \"==\", rtpa)]]\n", + ").drop(\n", + " columns = [\"Mode\", \"TOS\"]\n", + ").rename(columns = {\"Mode_full\": \"Mode\", \"TOS_full\": \"TOS\"})" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bf36cb45-9594-4b4f-a8f0-39be6e5a450c", + "metadata": {}, + "outputs": [], + "source": [ + "# find columns that are recent enough to plot\n", + "MIN_YEAR = 2018\n", + "\n", + "not_id_cols = [c for c in df.columns if \"/\" in c]\n", + "\n", + "recent_years = [\n", + " c for c in not_id_cols if int(c.split(\"/\")[1]) >= MIN_YEAR and \n", + " \"pct\" not in c\n", + "]\n", + "\n", + "upt_cols = [\n", + " c for c in recent_years if \"change\" not in c\n", + "]\n", + "\n", + "change_cols = [c for c in recent_years if \"change\" in c]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e60de663-a6a3-4e5d-a0d4-13aaba7efa35", + "metadata": {}, + "outputs": [], + "source": [ + "def sum_by_group(df: pd.DataFrame, group_cols: list) -> pd.DataFrame:\n", + " \"\"\"\n", + " Since df is wide, use pivot_table() to sum up all\n", + " the columns that show UPT.\n", + " \"\"\"\n", + " grouped_df = df.pivot_table(\n", + " index = group_cols, \n", + " values = recent_years, \n", + " aggfunc=\"sum\"\n", + " ).reset_index().reindex(columns = group_cols + recent_years)\n", + " \n", + " return grouped_df\n", + "\n", + "def make_long(df: pd.DataFrame, group_cols: list, value_cols: list):\n", + " df_long = df[group_cols + value_cols].melt(\n", + " id_vars = group_cols, \n", + " value_vars = value_cols,\n", + " )\n", + " \n", + " df_long = df_long.assign(\n", + " variable = df_long.variable.str.replace(\"change_1yr_\", \"\")\n", + " )\n", + " \n", + " return df_long" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e441011a-a8cb-4841-b9f4-11b322e39954", + "metadata": {}, + "outputs": [], + "source": [ + "agency_cols = [\"NTD ID\", \"Agency\", \"RTPA\"]\n", + "mode_cols = [\"Mode\", \"RTPA\"]\n", + "tos_cols = [\"TOS\", \"RTPA\"]\n", + "\n", + "by_agency = sum_by_group(df, agency_cols)\n", + "by_mode = sum_by_group(df, mode_cols)\n", + "by_tos = sum_by_group(df, tos_cols)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f52e71b2-1ad8-4713-9500-9f97cbcfc2c2", + "metadata": {}, + "outputs": [], + "source": [ + "def assemble_long_df(df: pd.DataFrame, group_cols: list) -> pd.DataFrame:\n", + " \"\"\"\n", + " Need df to be long to make chart.\n", + " Let's put raw UPT and change side-by-side.\n", + " \"\"\"\n", + " df_raw = make_long(df, group_cols, upt_cols).rename(\n", + " columns = {\"value\": \"upt\"})\n", + " df_change = make_long(df, group_cols, change_cols).rename(\n", + " columns = {\"value\": \"change_1yr\"})\n", + "\n", + " final = pd.merge(\n", + " df_raw,\n", + " df_change,\n", + " on = group_cols + [\"variable\"],\n", + " how = \"left\"\n", + " )\n", + " \n", + " final = final.assign(\n", + " year = final.variable.str.split(\"/\", expand=True)[1],\n", + " month = final.variable.str.split(\"/\", expand=True)[0].str.zfill(2)\n", + " )\n", + " \n", + " final = final.assign(\n", + " year_month = final.year + \"-\" + final.month\n", + " )\n", + " \n", + " return final" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1bca9016-0024-44e0-b0a0-e11a313ca308", + "metadata": {}, + "outputs": [], + "source": [ + "by_agency_long = assemble_long_df(by_agency, agency_cols)\n", + "by_mode_long = assemble_long_df(by_mode, mode_cols)\n", + "by_tos_long = assemble_long_df(by_tos, tos_cols)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1606b9e3-1311-40ea-aec8-1fa4ac0c2522", + "metadata": {}, + "outputs": [], + "source": [ + "LABELING_DICT = {\n", + " \"upt\": \"Unlinked Passenger Trips\",\n", + " \"change_1yr\": \"Change in Unlinked Passenger Trips from Prior Year\",\n", + " \"TOS\": \"Type of Service\",\n", + " \"year_month\": \"Date\"\n", + "}\n", + "\n", + "def labeling(word: str) -> str:\n", + " return chart_utils.labeling(word, LABELING_DICT)\n", + "\n", + "WIDTH = 300\n", + "HEIGHT = 150" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "53510310-eaea-400d-af32-20f4c8773514", + "metadata": {}, + "outputs": [], + "source": [ + "def make_line_chart(\n", + " df: pd.DataFrame, \n", + " y_col: str,\n", + " color_col: str,\n", + ") -> alt.Chart:\n", + " df = df[df[y_col] > 0].dropna(subset = y_col)\n", + "\n", + " x_label = [i for i in df.year_month.unique() if \n", + " any(substring in i for substring in \n", + " [\"-01\", \"-06\"])\n", + " ] \n", + " chart = (alt.Chart(df)\n", + " .mark_line()\n", + " .encode(\n", + " x = alt.X(\"year_month:O\", \n", + " axis=alt.Axis(values = x_label), \n", + " title = \"Date\"\n", + " ),\n", + " y = alt.Y(y_col, title = labeling(y_col)),\n", + " color = alt.Color(color_col, title = \"\", \n", + " scale = alt.Scale(\n", + " range = cp.CALITP_CATEGORY_BRIGHT_COLORS + \n", + " cp.CALITP_CATEGORY_BOLD_COLORS\n", + " )),\n", + " tooltip = [\"year_month\", y_col, color_col, \"RTPA\"]\n", + " ).properties(width = WIDTH, height = HEIGHT)\n", + " .facet(color_col, columns=2, title = \"\")\n", + " .resolve_scale(y=\"independent\")\n", + " ).properties(\n", + " title = f\"{labeling(y_col)} by {labeling(color_col)}\"\n", + " ).interactive()\n", + " \n", + " return chart" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f59f697a-912a-4dfe-bcac-02c9fc50b55d", + "metadata": {}, + "outputs": [], + "source": [ + "def make_bar_chart(\n", + " df: pd.DataFrame, \n", + " y_col: str,\n", + " color_col: str,\n", + ") -> alt.Chart:\n", + " \n", + " def short_label(word):\n", + " shorten_dict = {\n", + " \"change_1yr\": \"Change\",\n", + " }\n", + " return shorten_dict[word]\n", + " \n", + " # For change column, we are missing everything prior to 2023\n", + " df = df[df[y_col] > 0].dropna(subset = y_col)\n", + " \n", + " x_label = [i for i in df.year_month.unique() if \n", + " any(substring in i for substring in \n", + " [\"-01\", \"-03\", \"-06\", \"-09\"])\n", + " ]\n", + " \n", + " chart = (alt.Chart(df)\n", + " .mark_bar()\n", + " .encode(\n", + " x = alt.X(\"year_month:O\", \n", + " axis=alt.Axis(values = x_label), \n", + " title = \"Date\"\n", + " ),\n", + " y = alt.Y(y_col, title = short_label(y_col)),\n", + " color = alt.Color(color_col, title = \"\", \n", + " scale = alt.Scale(\n", + " range = cp.CALITP_CATEGORY_BRIGHT_COLORS + \n", + " cp.CALITP_CATEGORY_BOLD_COLORS\n", + " )),\n", + " tooltip = [\"year_month\", y_col, color_col, \"RTPA\"]\n", + " ).properties(width = WIDTH, height = HEIGHT)\n", + " .facet(color_col, columns=2, title = \"\")\n", + " .resolve_scale(x=\"shared\", \n", + " y=\"independent\")\n", + " ).properties(\n", + " title = f\"{labeling(y_col)} by {labeling(color_col)}\"\n", + " ).interactive()\n", + " \n", + " return chart" + ] + }, + { + "cell_type": "markdown", + "id": "ba59c380-aa2f-4fd2-a18b-f75e18074abc", + "metadata": {}, + "source": [ + "### Transit Agency" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c068b244-f4c2-4ae7-9153-d2724ee9f5c2", + "metadata": {}, + "outputs": [], + "source": [ + "make_line_chart(by_agency_long, y_col = \"upt\", color_col = \"Agency\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5c2251bd-deea-44ee-9936-f4ede8b45ee1", + "metadata": {}, + "outputs": [], + "source": [ + "make_bar_chart(by_agency_long, y_col = \"change_1yr\", color_col = \"Agency\")" + ] + }, + { + "cell_type": "markdown", + "id": "4d7db69c-9e51-4e1f-ac33-604a8afe4da5", + "metadata": {}, + "source": [ + "### Transit Mode" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6d132a31-971d-44f2-a1aa-d60b2cf055f6", + "metadata": {}, + "outputs": [], + "source": [ + "make_line_chart(by_mode_long, y_col = \"upt\", color_col = \"Mode\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a2d861b0-6baa-4d7c-89eb-4b686a77ba3e", + "metadata": {}, + "outputs": [], + "source": [ + "make_bar_chart(by_mode_long, y_col = \"change_1yr\", color_col = \"Mode\")" + ] + }, + { + "cell_type": "markdown", + "id": "1923cc1a-2e8c-471b-b578-a002fd27fe7f", + "metadata": {}, + "source": [ + "### Type of Service" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e9999254-f07b-4041-a474-880a2b026434", + "metadata": {}, + "outputs": [], + "source": [ + "make_line_chart(by_tos_long, y_col = \"upt\", color_col = \"TOS\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3c147008-7d5f-473a-886b-65bbd030de5b", + "metadata": {}, + "outputs": [], + "source": [ + "make_bar_chart(by_tos_long, y_col = \"change_1yr\", color_col = \"TOS\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/ntd/update_vars.py b/ntd/update_vars.py new file mode 100644 index 0000000000..c20fc5b963 --- /dev/null +++ b/ntd/update_vars.py @@ -0,0 +1,29 @@ +GCS_FILE_PATH = "gs://calitp-analytics-data/data-analyses/ntd/" + +YEAR = "2023" +MONTH = "October" +MONTH_CREATED = "2023-12" + +NTD_MODES = { + "CB": "Commuter Bus", + "CC": "Cable Car", + "CR": "Commuter Rail", + "DR": "Demand Response", + "FB": "Ferryboats", + "HR": "Heavy Rail", + "LR": "Light Rail", + "MB": "Bus", + "MG": "Monorail / Automated Guideway", + "RB": "Bus Rapid Transit", + "SR": "Streetcar", + "TB": "Trolleybus", + "VP": "Vanpool", + "YR": "Hybrid Rail", +} + +NTD_TOS = { + "DO": "Directly Operated", + "PT": "Purchased Transportation", + "TN": "Purchased Transportation - Transportation Network Company", + "TX": "Purchased Transportation - Taxi" +} \ No newline at end of file diff --git a/portfolio/ntd_monthly_ridership/README.md b/portfolio/ntd_monthly_ridership/README.md new file mode 100644 index 0000000000..3782bd155e --- /dev/null +++ b/portfolio/ntd_monthly_ridership/README.md @@ -0,0 +1,10 @@ +# NTD Monthly Ridership by RTPA + +Provide CalSTA with NTD Monthly Ridership by each regional transportation planning authority (RTPA). + +This report shows general ridership trends by transit agency, mode, and type of service. Reported unlinked passenger trips are reported, as well as the change from the prior year. For example, July 2023's change would be the change in July 2023's reported values against July 2022's reported values. + +## Datasets +1. NTD monthly data: https://www.transit.dot.gov/ntd/data-product/monthly-module-adjusted-data-release. +2. [RTPA list](https://gis.data.ca.gov/datasets/CAEnergy::regional-transportation-planning-agencies/explore?appid=cf412a17daaa47bca93c6d6b7e77aff0&edit=true) +3. Download our processed full data [here](https://storage.googleapis.com/calitp-publish-data-analysis/ntd_monthly_ridership/). \ No newline at end of file diff --git a/portfolio/ntd_monthly_ridership/_config.yml b/portfolio/ntd_monthly_ridership/_config.yml new file mode 100644 index 0000000000..62d440f494 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/_config.yml @@ -0,0 +1,43 @@ +# Book settings +# Learn more at https://jupyterbook.org/customize/config.html + +title: NTD Monthly Ridership by RTPA +author: Cal-ITP +copyright: "2022" +#logo: calitp_logo_MAIN.png + +# Force re-execution of notebooks on each build. +# See https://jupyterbook.org/content/execute.html +execute: + execute_notebooks: 'off' + allow_errors: false + timeout: -1 + +# Define the name of the latex output file for PDF builds +latex: + latex_documents: + targetname: book.tex + +launch_buttons: + binderhub_url: "https://mybinder.org" + jupyterhub_url: "https://hubtest.k8s.calitp.jarv.us" + thebe: true + +repository: + url: https://github.com/cal-itp/data-analyses/ # Online location of your book +# path_to_book: docs # Optional path to your book, relative to the repository root + path_to_book: ntd + branch: main # Which branch of the repository should be used when creating links (optional) + +# Add GitHub buttons to your book +# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository +html: + use_issues_button: true + use_repository_button: true + use_edit_page_button: true + google_analytics_id: 'G-JCX3Z8JZJC' + +sphinx: + config: + html_js_files: + - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js \ No newline at end of file diff --git a/portfolio/ntd_monthly_ridership/_toc.yml b/portfolio/ntd_monthly_ridership/_toc.yml new file mode 100644 index 0000000000..ca9f4b3cf5 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/_toc.yml @@ -0,0 +1,24 @@ +format: jb-book +parts: +- caption: null + chapters: + - file: rtpa_alpine-county-local-transportation-commission/0__monthly_ridership_report__rtpa_alpine-county-local-transportation-commission.ipynb + - file: rtpa_butte-county-association-of-governments/0__monthly_ridership_report__rtpa_butte-county-association-of-governments.ipynb + - file: rtpa_fresno-council-of-governments/0__monthly_ridership_report__rtpa_fresno-council-of-governments.ipynb + - file: rtpa_kern-council-of-governments/0__monthly_ridership_report__rtpa_kern-council-of-governments.ipynb + - file: rtpa_kings-county-association-of-governments/0__monthly_ridership_report__rtpa_kings-county-association-of-governments.ipynb + - file: rtpa_merced-county-association-of-governments/0__monthly_ridership_report__rtpa_merced-county-association-of-governments.ipynb + - file: rtpa_metropolitan-transportation-commission/0__monthly_ridership_report__rtpa_metropolitan-transportation-commission.ipynb + - file: rtpa_sacramento-area-council-of-governments/0__monthly_ridership_report__rtpa_sacramento-area-council-of-governments.ipynb + - file: rtpa_san-diego-association-of-governments/0__monthly_ridership_report__rtpa_san-diego-association-of-governments.ipynb + - file: rtpa_san-joaquin-council-of-governments/0__monthly_ridership_report__rtpa_san-joaquin-council-of-governments.ipynb + - file: rtpa_san-luis-obispo-council-of-governments/0__monthly_ridership_report__rtpa_san-luis-obispo-council-of-governments.ipynb + - file: rtpa_santa-barbara-county-association-of-governments/0__monthly_ridership_report__rtpa_santa-barbara-county-association-of-governments.ipynb + - file: rtpa_santa-cruz-county-regional-transportation-commission/0__monthly_ridership_report__rtpa_santa-cruz-county-regional-transportation-commission.ipynb + - file: rtpa_shasta-regional-transportation-agency/0__monthly_ridership_report__rtpa_shasta-regional-transportation-agency.ipynb + - file: rtpa_southern-california-association-of-governments/0__monthly_ridership_report__rtpa_southern-california-association-of-governments.ipynb + - file: rtpa_stanislaus-council-of-governments/0__monthly_ridership_report__rtpa_stanislaus-council-of-governments.ipynb + - file: rtpa_tahoe-regional-planning-agency/0__monthly_ridership_report__rtpa_tahoe-regional-planning-agency.ipynb + - file: rtpa_transportation-agency-for-monterey-county/0__monthly_ridership_report__rtpa_transportation-agency-for-monterey-county.ipynb + - file: rtpa_tulare-county-association-of-governments/0__monthly_ridership_report__rtpa_tulare-county-association-of-governments.ipynb +root: README diff --git a/portfolio/ntd_monthly_ridership/rtpa_alpine-county-local-transportation-commission/0__monthly_ridership_report__rtpa_alpine-county-local-transportation-commission.ipynb b/portfolio/ntd_monthly_ridership/rtpa_alpine-county-local-transportation-commission/0__monthly_ridership_report__rtpa_alpine-county-local-transportation-commission.ipynb new file mode 100644 index 0000000000..934b83161d --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_alpine-county-local-transportation-commission/0__monthly_ridership_report__rtpa_alpine-county-local-transportation-commission.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbb82ad56b0b5d363b0524c00d832f7d4ca0aa824fc32cbbd86e668cd2920f74 +size 144150 diff --git a/portfolio/ntd_monthly_ridership/rtpa_butte-county-association-of-governments/0__monthly_ridership_report__rtpa_butte-county-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_butte-county-association-of-governments/0__monthly_ridership_report__rtpa_butte-county-association-of-governments.ipynb new file mode 100644 index 0000000000..86ae8b072e --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_butte-county-association-of-governments/0__monthly_ridership_report__rtpa_butte-county-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a723222f37757270241561c8b62bf5d60d241238c72aec0776d3d128bd52a859 +size 130080 diff --git a/portfolio/ntd_monthly_ridership/rtpa_fresno-council-of-governments/0__monthly_ridership_report__rtpa_fresno-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_fresno-council-of-governments/0__monthly_ridership_report__rtpa_fresno-council-of-governments.ipynb new file mode 100644 index 0000000000..fcb5091a2c --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_fresno-council-of-governments/0__monthly_ridership_report__rtpa_fresno-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18717c9aba70ee950a4300a9d405850c56d60f6a65460f8292f95da0a2e594d2 +size 141386 diff --git a/portfolio/ntd_monthly_ridership/rtpa_kern-council-of-governments/0__monthly_ridership_report__rtpa_kern-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_kern-council-of-governments/0__monthly_ridership_report__rtpa_kern-council-of-governments.ipynb new file mode 100644 index 0000000000..a9ef4510ed --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_kern-council-of-governments/0__monthly_ridership_report__rtpa_kern-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fafd0a0258d46466cf2e729e91bb06c9e4ce86bbe3e8ca2fb12b1bb391aede91 +size 124500 diff --git a/portfolio/ntd_monthly_ridership/rtpa_kings-county-association-of-governments/0__monthly_ridership_report__rtpa_kings-county-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_kings-county-association-of-governments/0__monthly_ridership_report__rtpa_kings-county-association-of-governments.ipynb new file mode 100644 index 0000000000..686c81a795 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_kings-county-association-of-governments/0__monthly_ridership_report__rtpa_kings-county-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b102e922a42c7bf6beaca129b941ddc039ba23efc07b604ed271efbb2a68c398 +size 179184 diff --git a/portfolio/ntd_monthly_ridership/rtpa_merced-county-association-of-governments/0__monthly_ridership_report__rtpa_merced-county-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_merced-county-association-of-governments/0__monthly_ridership_report__rtpa_merced-county-association-of-governments.ipynb new file mode 100644 index 0000000000..0e44992f59 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_merced-county-association-of-governments/0__monthly_ridership_report__rtpa_merced-county-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:580cb1048c722c7bc15e231ca3454a85c5726bb8985f9f8cf667e128a49123ee +size 131127 diff --git a/portfolio/ntd_monthly_ridership/rtpa_metropolitan-transportation-commission/0__monthly_ridership_report__rtpa_metropolitan-transportation-commission.ipynb b/portfolio/ntd_monthly_ridership/rtpa_metropolitan-transportation-commission/0__monthly_ridership_report__rtpa_metropolitan-transportation-commission.ipynb new file mode 100644 index 0000000000..7c43d11138 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_metropolitan-transportation-commission/0__monthly_ridership_report__rtpa_metropolitan-transportation-commission.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:defa6d88125988e5d3fff701ff8d853cd49dceccafd3fc40a9fd7899f428413b +size 775748 diff --git a/portfolio/ntd_monthly_ridership/rtpa_sacramento-area-council-of-governments/0__monthly_ridership_report__rtpa_sacramento-area-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_sacramento-area-council-of-governments/0__monthly_ridership_report__rtpa_sacramento-area-council-of-governments.ipynb new file mode 100644 index 0000000000..4d1172a61a --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_sacramento-area-council-of-governments/0__monthly_ridership_report__rtpa_sacramento-area-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d43e105c98d8e0e2a2e3793d319779aa75b4392da044d5327555b85e80bc3be +size 316688 diff --git a/portfolio/ntd_monthly_ridership/rtpa_san-diego-association-of-governments/0__monthly_ridership_report__rtpa_san-diego-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_san-diego-association-of-governments/0__monthly_ridership_report__rtpa_san-diego-association-of-governments.ipynb new file mode 100644 index 0000000000..b067acf745 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_san-diego-association-of-governments/0__monthly_ridership_report__rtpa_san-diego-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75e4f6d46ab1e0326360412968a9b33828d3fcd3d9d2c439783c4c900d86f40a +size 287610 diff --git a/portfolio/ntd_monthly_ridership/rtpa_san-joaquin-council-of-governments/0__monthly_ridership_report__rtpa_san-joaquin-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_san-joaquin-council-of-governments/0__monthly_ridership_report__rtpa_san-joaquin-council-of-governments.ipynb new file mode 100644 index 0000000000..d515654ff2 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_san-joaquin-council-of-governments/0__monthly_ridership_report__rtpa_san-joaquin-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f812e12c0a00c5c5e372110894ee3743bb580eac7e2dd80c3f3ba523488383b7 +size 247749 diff --git a/portfolio/ntd_monthly_ridership/rtpa_san-luis-obispo-council-of-governments/0__monthly_ridership_report__rtpa_san-luis-obispo-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_san-luis-obispo-council-of-governments/0__monthly_ridership_report__rtpa_san-luis-obispo-council-of-governments.ipynb new file mode 100644 index 0000000000..c0315fcb77 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_san-luis-obispo-council-of-governments/0__monthly_ridership_report__rtpa_san-luis-obispo-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7943353b66f7d6bc87c5ccd149864950694a17b12785ddec183ba32c93380b15 +size 187191 diff --git a/portfolio/ntd_monthly_ridership/rtpa_santa-barbara-county-association-of-governments/0__monthly_ridership_report__rtpa_santa-barbara-county-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_santa-barbara-county-association-of-governments/0__monthly_ridership_report__rtpa_santa-barbara-county-association-of-governments.ipynb new file mode 100644 index 0000000000..f237c8e4fb --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_santa-barbara-county-association-of-governments/0__monthly_ridership_report__rtpa_santa-barbara-county-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96a801a306e74a745706997b429d6225a56bbe966c97c34c575cdc12b53575a6 +size 112025 diff --git a/portfolio/ntd_monthly_ridership/rtpa_santa-cruz-county-regional-transportation-commission/0__monthly_ridership_report__rtpa_santa-cruz-county-regional-transportation-commission.ipynb b/portfolio/ntd_monthly_ridership/rtpa_santa-cruz-county-regional-transportation-commission/0__monthly_ridership_report__rtpa_santa-cruz-county-regional-transportation-commission.ipynb new file mode 100644 index 0000000000..24de064505 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_santa-cruz-county-regional-transportation-commission/0__monthly_ridership_report__rtpa_santa-cruz-county-regional-transportation-commission.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0305707661590c4071a5280411add6f647c4d0283adf49bfeb7d49f05b2792fa +size 150426 diff --git a/portfolio/ntd_monthly_ridership/rtpa_shasta-regional-transportation-agency/0__monthly_ridership_report__rtpa_shasta-regional-transportation-agency.ipynb b/portfolio/ntd_monthly_ridership/rtpa_shasta-regional-transportation-agency/0__monthly_ridership_report__rtpa_shasta-regional-transportation-agency.ipynb new file mode 100644 index 0000000000..610b624354 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_shasta-regional-transportation-agency/0__monthly_ridership_report__rtpa_shasta-regional-transportation-agency.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21dd4523c8bdf4b9bcc724835f45f3e6a21d3dbbe2137a4d0156f46773fb8be2 +size 104266 diff --git a/portfolio/ntd_monthly_ridership/rtpa_southern-california-association-of-governments/0__monthly_ridership_report__rtpa_southern-california-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_southern-california-association-of-governments/0__monthly_ridership_report__rtpa_southern-california-association-of-governments.ipynb new file mode 100644 index 0000000000..0c4f340864 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_southern-california-association-of-governments/0__monthly_ridership_report__rtpa_southern-california-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26aee45b37318d4b72b5281c7d44356e13b7292fece0578d34ab6abd19129a30 +size 941880 diff --git a/portfolio/ntd_monthly_ridership/rtpa_stanislaus-council-of-governments/0__monthly_ridership_report__rtpa_stanislaus-council-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_stanislaus-council-of-governments/0__monthly_ridership_report__rtpa_stanislaus-council-of-governments.ipynb new file mode 100644 index 0000000000..754d9264fa --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_stanislaus-council-of-governments/0__monthly_ridership_report__rtpa_stanislaus-council-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e12f01bd0107c94cdcbe0c11dbcb7b44a1a9e171f243ff87ae568f3cf9049e9c +size 171363 diff --git a/portfolio/ntd_monthly_ridership/rtpa_tahoe-regional-planning-agency/0__monthly_ridership_report__rtpa_tahoe-regional-planning-agency.ipynb b/portfolio/ntd_monthly_ridership/rtpa_tahoe-regional-planning-agency/0__monthly_ridership_report__rtpa_tahoe-regional-planning-agency.ipynb new file mode 100644 index 0000000000..fa1211fa89 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_tahoe-regional-planning-agency/0__monthly_ridership_report__rtpa_tahoe-regional-planning-agency.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31678d45bfa20bff1726d0bb439d78e3c9f175f2120776956bd6a492adb2ca0c +size 131929 diff --git a/portfolio/ntd_monthly_ridership/rtpa_transportation-agency-for-monterey-county/0__monthly_ridership_report__rtpa_transportation-agency-for-monterey-county.ipynb b/portfolio/ntd_monthly_ridership/rtpa_transportation-agency-for-monterey-county/0__monthly_ridership_report__rtpa_transportation-agency-for-monterey-county.ipynb new file mode 100644 index 0000000000..a9204f3199 --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_transportation-agency-for-monterey-county/0__monthly_ridership_report__rtpa_transportation-agency-for-monterey-county.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6214d0bf0b292da817f21a93c08f2c3dcaf2901377175f452eaf75d480e36f02 +size 157969 diff --git a/portfolio/ntd_monthly_ridership/rtpa_tulare-county-association-of-governments/0__monthly_ridership_report__rtpa_tulare-county-association-of-governments.ipynb b/portfolio/ntd_monthly_ridership/rtpa_tulare-county-association-of-governments/0__monthly_ridership_report__rtpa_tulare-county-association-of-governments.ipynb new file mode 100644 index 0000000000..e1cadf714c --- /dev/null +++ b/portfolio/ntd_monthly_ridership/rtpa_tulare-county-association-of-governments/0__monthly_ridership_report__rtpa_tulare-county-association-of-governments.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aff88d548b1f62b878dc432ea12d7f5337b6c8490d52b70944fad8f79066cf5a +size 162246 diff --git a/portfolio/sites/ntd_monthly_ridership.yml b/portfolio/sites/ntd_monthly_ridership.yml new file mode 100644 index 0000000000..e676b24c84 --- /dev/null +++ b/portfolio/sites/ntd_monthly_ridership.yml @@ -0,0 +1,45 @@ +title: NTD Monthly Ridership by RTPA +directory: ./ntd/ +readme: ./ntd/README.md +notebook: ./ntd/monthly_ridership_report.ipynb +parts: +- caption: Introduction +- chapters: + - params: + rtpa: Alpine County Local Transportation Commission + - params: + rtpa: Butte County Association of Governments + - params: + rtpa: Fresno Council of Governments + - params: + rtpa: Kern Council of Governments + - params: + rtpa: Kings County Association of Governments + - params: + rtpa: Merced County Association of Governments + - params: + rtpa: Metropolitan Transportation Commission + - params: + rtpa: Sacramento Area Council of Governments + - params: + rtpa: San Diego Association of Governments + - params: + rtpa: San Joaquin Council of Governments + - params: + rtpa: San Luis Obispo Council of Governments + - params: + rtpa: Santa Barbara County Association of Governments + - params: + rtpa: Santa Cruz County Regional Transportation Commission + - params: + rtpa: Shasta Regional Transportation Agency + - params: + rtpa: Southern California Association of Governments + - params: + rtpa: Stanislaus Council of Governments + - params: + rtpa: Tahoe Regional Planning Agency + - params: + rtpa: Transportation Agency for Monterey County + - params: + rtpa: Tulare County Association of Governments \ No newline at end of file