-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1228 from cal-itp/sep-open-data
Sep open data
- Loading branch information
Showing
45 changed files
with
1,235 additions
and
1,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
2024-09-18: | ||
- Alhambra Schedule | ||
- Amador Schedule | ||
- Anaheim Resort Schedule | ||
- Anaheim Resort Schedule v2 | ||
- Antelope Valley Transit Authority Schedule | ||
- Arcadia Schedule | ||
- Arvin Schedule | ||
- Auburn Schedule | ||
- B-Line Schedule | ||
- Baldwin Park Schedule | ||
- Banning Pass Schedule | ||
- Bay Area 511 AC Transit Schedule | ||
- Bay Area 511 ACE Schedule | ||
- Bay Area 511 Angel Island-Tiburon Ferry Schedule | ||
- Bay Area 511 BART Schedule | ||
- Bay Area 511 Caltrain Schedule | ||
- Bay Area 511 Capitol Corridor Schedule | ||
- Bay Area 511 Commute.org Schedule | ||
- Bay Area 511 County Connection Schedule | ||
- Bay Area 511 Dumbarton Express Schedule | ||
- Bay Area 511 Emery Go-Round Schedule | ||
- Bay Area 511 Fairfield and Suisun Transit Schedule | ||
- Bay Area 511 Golden Gate Ferry Schedule | ||
- Bay Area 511 Golden Gate Transit Schedule | ||
- Bay Area 511 MVGO Schedule | ||
- Bay Area 511 Marin Schedule | ||
- Bay Area 511 Mission Bay Schedule | ||
- Bay Area 511 Muni Schedule | ||
- Bay Area 511 Petaluma Schedule | ||
- Bay Area 511 Rio Vista Delta Breeze Schedule | ||
- Bay Area 511 SFO AirTrain Schedule | ||
- Bay Area 511 SamTrans Schedule | ||
- Bay Area 511 San Francisco Bay Ferry Schedule | ||
- Bay Area 511 Santa Clara Transit Schedule | ||
- Bay Area 511 Santa Rosa CityBus Schedule | ||
- Bay Area 511 SolTrans Schedule | ||
- Bay Area 511 Sonoma County Transit Schedule | ||
- Bay Area 511 Sonoma-Marin Area Rail Transit Schedule | ||
- Bay Area 511 South San Francisco Shuttle Schedule | ||
- Bay Area 511 Treasure Island Ferry Schedule | ||
- Bay Area 511 Tri Delta Schedule | ||
- Bay Area 511 Tri-Valley Wheels Schedule | ||
- Bay Area 511 Union City Transit Schedule | ||
- Bay Area 511 Vacaville City Coach Schedule | ||
- Bay Area 511 Vine Transit Schedule | ||
- Bay Area 511 WestCAT Schedule | ||
- Beach Cities GMV Schedule | ||
- Bear Schedule | ||
- Beaumont Pass Schedule | ||
- Bell Gardens Schedule | ||
- Bellflower Bus Schedule | ||
- Big Blue Bus Schedule | ||
- Big Blue Bus Swiftly Schedule | ||
- BruinBus Schedule | ||
- Burbank Schedule | ||
- Calabasas Schedule | ||
- Calaveras Schedule | ||
- Cerritos on Wheels Schedule | ||
- Cerritos on Wheels Website Schedule | ||
- Clean Air Express Schedule | ||
- Clovis Schedule | ||
- Commerce Schedule | ||
- Corona Schedule | ||
- County Express Schedule | ||
- Cudahy Schedule | ||
- Culver City Schedule | ||
- Curry Public Transit Schedule | ||
- Dana Point Trolley Schedule | ||
- Delano Schedule | ||
- Desert Roadrunner GMV Schedule | ||
- Desert Roadrunner Schedule | ||
- DowneyLINK GMV Schedule | ||
- Eastern Sierra Schedule | ||
- El Dorado Schedule | ||
- El Monte Schedule | ||
- Elk Grove Schedule | ||
- Flixbus Schedule | ||
- Foothill Schedule | ||
- Fresno County Schedule | ||
- Fresno Schedule | ||
- G Trans Schedule | ||
- GET Schedule | ||
- Get Around Town Express Schedule | ||
- Glendale Schedule | ||
- Glendora Schedule | ||
- Glenn Schedule | ||
- Go West Schedule | ||
- Grapeline Schedule | ||
- Guadalupe Flyer Schedule | ||
- Havasu Landing Ferry Schedule | ||
- Humboldt Schedule | ||
- Huntington Schedule | ||
- Imperial Valley Transit Schedule | ||
- Inglewood Schedule | ||
- Irvine CONNECT Schedule | ||
- Kern Schedule | ||
- Kings Schedule | ||
- LA DOT Schedule | ||
- LA Metro Bus Schedule | ||
- LA Metro Rail Schedule | ||
- LADPW Schedule | ||
- LAX FlyAway Schedule | ||
- LAX Flyaway Bus Schedule | ||
- LAX Shuttles Schedule | ||
- La Campana Schedule | ||
- La Puente Schedule | ||
- Laguna Beach Schedule | ||
- Lake Schedule | ||
- Lassen Schedule | ||
- Lawndale Beat GMV Schedule | ||
- Lawndale Schedule | ||
- Lompoc Schedule | ||
- Long Beach Schedule | ||
- Lynwood Schedule IPS | ||
- MV Shuttle Schedule | ||
- Madera County Connection Schedule | ||
- Madera Metro Schedule | ||
- Mariposa Grove Shuttle Schedule | ||
- Maywood Schedule | ||
- Mendocino Schedule | ||
- Merced GMV Schedule | ||
- Merced Schedule | ||
- Metrolink Schedule | ||
- Montebello Schedule | ||
- Monterey Salinas Schedule | ||
- Morongo Basin Schedule | ||
- Morro Bay Cal-ITP Schedule | ||
- Mountain Transit GMV Schedule | ||
- Mountain Transit Schedule | ||
- Needles Schedule | ||
- Nevada County Schedule | ||
- North County Schedule | ||
- Norwalk Avail Schedule | ||
- OCTA Schedule | ||
- OmniTrans Schedule | ||
- Oregon POINT | ||
- Palos Verdes PTA Schedule | ||
- Pasadena Schedule | ||
- Placer Schedule | ||
- Plumas Schedule | ||
- PresidiGo Schedule | ||
- Redding Schedule | ||
- Redwood Coast Schedule | ||
- Riverside Schedule | ||
- Rosemead Passio Schedule | ||
- Roseville Schedule | ||
- Roseville Transit GMV Schedule | ||
- SBMTD Schedule | ||
- SLO Schedule | ||
- SLORTA Schedule | ||
- Sage Stage Schedule | ||
- San Clemente Trolley Schedule | ||
- San Diego Schedule | ||
- San Fernando Schedule | ||
- San Joaquin Schedule | ||
- San Juan Capistrano Trolley Schedule | ||
- Santa Clarita Schedule | ||
- Santa Maria Schedule | ||
- Santa Ynez Mecatran Schedule | ||
- Sierra Madre Schedule | ||
- Siskiyou Schedule | ||
- South County Transit Link Schedule | ||
- South San Francisco Schedule | ||
- Spirit Bus Passio Schedule | ||
- StanRTA Schedule | ||
- Stanford Schedule | ||
- SunLine Avail Schedule | ||
- 'TART, North Lake Tahoe Schedule' | ||
- TCRTA TripShot Schedule | ||
- Tahoe Transportation District GMV Schedule | ||
- Tahoe Transportation District Schedule | ||
- Tehama Schedule | ||
- Torrance Schedule | ||
- Tracy Schedule | ||
- Trinity Schedule | ||
- Tuolumne Remix Schedule | ||
- Turlock Schedule | ||
- UCSC Schedule | ||
- Unitrans Schedule | ||
- VCTC GMV Schedule | ||
- Victor Valley GMV Schedule | ||
- Victor Valley Schedule | ||
- Visalia Schedule | ||
- WeHo Schedule | ||
- YARTS Schedule | ||
- Yolobus Schedule | ||
- Yosemite Valley Shuttle Schedule | ||
- Yuba-Sutter Schedule | ||
- Yuma Schedule | ||
- eTrans Schedule | ||
2024-08-14: | ||
- Santa Cruz Schedule | ||
2024-06-12: | ||
- Anteater Express Schedule | ||
- Lassen Flex | ||
- Lynwood Schedule | ||
- Manteca Schedule | ||
2024-05-22: | ||
- El Segundo Schedule | ||
- Redwood Coast Schedulel | ||
2024-04-17: | ||
- Sacramento Schedule | ||
2024-03-13: | ||
- Avalon Schedule | ||
2024-02-14: | ||
- Rosemead Schedule | ||
2023-12-13: | ||
- DowneyLINK Schedule | ||
- Humboldt Flex | ||
- Laguna Beach Flex | ||
- Manteca Flex | ||
- Placer Flex | ||
- San Joaquin Flex | ||
- Spirit Bus Schedule | ||
- StanRTA Flex | ||
- TART Flex | ||
- Thousand Oaks Flex | ||
- Tracy Flex | ||
- Turlock Flex | ||
- Union City Flex | ||
- VCTC Flex | ||
- WestCAT Flex | ||
2023-11-15: | ||
- Amtrak Schedule | ||
- Mission Bay Schedule | ||
2023-08-15: | ||
- Blossom Express Schedule | ||
- Eastern Sierra Flex | ||
2023-06-14: | ||
- Tuolumne Schedule | ||
2023-04-12: | ||
- Guadalupe Flex | ||
2023-03-15: | ||
- TIME GMV Schedule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
""" | ||
Grab all the operators by service date from | ||
saved scheduled_trips tables from GCS. | ||
Create a yaml that tells us the most recent | ||
date available for each operator (schedule_gtfs_dataset_name). | ||
""" | ||
import pandas as pd | ||
import pyaml # use pyaml because it gets us prettier indents than yaml | ||
|
||
from pathlib import Path | ||
from typing import Union | ||
|
||
from shared_utils import rt_dates | ||
from segment_speed_utils import time_series_utils | ||
|
||
def filter_to_recent_date(df: pd.DataFrame) -> pd.DataFrame: | ||
""" | ||
By schedule_gtfs_dataset_name, keep the most recent | ||
service_date that shows up in scheduled trips. | ||
""" | ||
df2 = (df.groupby("name", group_keys=False) | ||
.service_date | ||
.max() | ||
.reset_index() | ||
.sort_values(["service_date", "name"], ascending=[False, True]) | ||
.reset_index(drop=True) | ||
.astype({"service_date": "str"}) | ||
) | ||
return df2 | ||
|
||
def export_results_yml( | ||
df: pd.DataFrame, | ||
export_yaml: Union[str, Path] | ||
): | ||
""" | ||
Save out our results from df. | ||
Convert df into a dictionary and save out dictionary results as yaml. | ||
""" | ||
# TODO: check this list manually and there will be some | ||
# operator names that have more recent names that we are keeping, | ||
# so we can remove these from our yaml | ||
exclude_me = [ | ||
"TIME GMV" | ||
] | ||
|
||
df2 = df[~df.name.isin(exclude_me)] | ||
|
||
my_dict = { | ||
**{ | ||
date_key: df2[df2.service_date==date_key].name.tolist() | ||
for date_key in df2.service_date.unique() | ||
} | ||
} | ||
|
||
# sort_keys=False to prevent alphabetical sort (earliest date first) | ||
# because we want to main our results and yaml with most recent date first | ||
output = pyaml.dump(my_dict, sort_keys=False) | ||
|
||
with open(export_yaml, "w") as f: | ||
f.write(output) | ||
|
||
print(f"{export_yaml} exported") | ||
|
||
return | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
from update_vars import (GTFS_DATA_DICT, | ||
COMPILED_CACHED_VIEWS, | ||
PUBLISHED_OPERATORS_YAML) | ||
|
||
TABLE = GTFS_DATA_DICT.schedule_downloads.trips | ||
|
||
operators = time_series_utils.concatenate_datasets_across_dates( | ||
COMPILED_CACHED_VIEWS, | ||
TABLE, | ||
rt_dates.y2024_dates + rt_dates.y2023_dates, | ||
data_type = "df", | ||
get_pandas = True, | ||
columns = ["name"] | ||
).drop_duplicates().pipe(filter_to_recent_date) | ||
|
||
export_results_yml(operators, PUBLISHED_OPERATORS_YAML) |
Oops, something went wrong.