Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
edasmalchi committed Nov 4, 2024
1 parent 1af4a53 commit 1b7d1e8
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 382 deletions.
209 changes: 199 additions & 10 deletions ca_transit_speed_maps/01_new_speedmaps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 83,
"id": "6af2c7fd-b769-4fbf-bbcf-75080972cc67",
"metadata": {},
"outputs": [],
Expand All @@ -417,7 +417,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 84,
"id": "cedc030e-8d19-4a0b-b3a5-5a3d6c0dce23",
"metadata": {},
"outputs": [],
Expand All @@ -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": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>schedule_gtfs_dataset_key</th>\n",
" <th>shape_array_key</th>\n",
" <th>shape_id</th>\n",
" <th>route_id</th>\n",
" <th>direction_id</th>\n",
" <th>stop_pair</th>\n",
" <th>stop_pair_name</th>\n",
" <th>segment_id</th>\n",
" <th>time_of_day</th>\n",
" <th>p50_mph</th>\n",
" <th>...</th>\n",
" <th>p80_mph</th>\n",
" <th>name</th>\n",
" <th>caltrans_district</th>\n",
" <th>organization_source_record_id</th>\n",
" <th>organization_name</th>\n",
" <th>base64_url</th>\n",
" <th>geometry</th>\n",
" <th>n_trips_sch</th>\n",
" <th>trips_hr_sch</th>\n",
" <th>route_short_name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>10501</th>\n",
" <td>0666caf3ec1ecc96b74f4477ee4bc939</td>\n",
" <td>fedc605c108af558e4e545806741ea0f</td>\n",
" <td>510358_JUNE24</td>\n",
" <td>51-13183</td>\n",
" <td>0.0</td>\n",
" <td>283__8824</td>\n",
" <td>Avalon / Imperial__Avalon / 111th</td>\n",
" <td>283-8824-1</td>\n",
" <td>AM Peak</td>\n",
" <td>12.34</td>\n",
" <td>...</td>\n",
" <td>12.34</td>\n",
" <td>LA Metro Bus Schedule</td>\n",
" <td>07 - Los Angeles</td>\n",
" <td>recPnGkwdpnr8jmHB</td>\n",
" <td>Los Angeles County Metropolitan Transportation...</td>\n",
" <td>aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...</td>\n",
" <td>POLYGON ((160449.331 -452365.708, 160434.047 -...</td>\n",
" <td>1</td>\n",
" <td>0.333333</td>\n",
" <td>51</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10502</th>\n",
" <td>0666caf3ec1ecc96b74f4477ee4bc939</td>\n",
" <td>fedc605c108af558e4e545806741ea0f</td>\n",
" <td>510358_JUNE24</td>\n",
" <td>51-13183</td>\n",
" <td>0.0</td>\n",
" <td>8824__8823</td>\n",
" <td>Avalon / 111th__Avalon / 110th</td>\n",
" <td>8824-8823-1</td>\n",
" <td>AM Peak</td>\n",
" <td>14.66</td>\n",
" <td>...</td>\n",
" <td>14.66</td>\n",
" <td>LA Metro Bus Schedule</td>\n",
" <td>07 - Los Angeles</td>\n",
" <td>recPnGkwdpnr8jmHB</td>\n",
" <td>Los Angeles County Metropolitan Transportation...</td>\n",
" <td>aHR0cHM6Ly9naXRsYWIuY29tL0xBQ01UQS9ndGZzX2J1cy...</td>\n",
" <td>POLYGON ((160443.819 -452040.084, 160428.472 -...</td>\n",
" <td>1</td>\n",
" <td>0.333333</td>\n",
" <td>51</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>2 rows × 22 columns</p>\n",
"</div>"
],
"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"
]
Expand All @@ -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",
Expand All @@ -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"
]
Expand Down
Loading

0 comments on commit 1b7d1e8

Please sign in to comment.