Skip to content

Commit

Permalink
update geography_utils refs to CA_NAD83Albers_m or _ft
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffanychu90 committed Dec 23, 2024
1 parent 6d00bb0 commit 0bf308a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bus_service_increase/create_analysis_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_shapes(selected_date: str) -> gpd.GeoDataFrame:
selected_date,
columns = ["shape_array_key", "geometry"],
get_pandas = True,
crs = geography_utils.CA_NAD83Albers
crs = geography_utils.CA_NAD83Albers_m
).pipe(
helpers.remove_shapes_outside_ca
).merge(
Expand All @@ -151,7 +151,7 @@ def get_shapes(selected_date: str) -> gpd.GeoDataFrame:


def dissolve_census_tracts(
crs: str = geography_utils.CA_NAD83Albers
crs: str = geography_utils.CA_NAD83Albers_m
) -> gpd.GeoDataFrame:
census_tracts = (
catalog.calenviroscreen_lehd_by_tract.read()
Expand Down
2 changes: 1 addition & 1 deletion bus_service_increase/highways-existing-transit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"plot_df = gdf[\n",
" gdf.route_length >= geography_utils.FEET_PER_MI * 0.5\n",
" ].assign(\n",
" geometry = (gdf.geometry.to_crs(geography_utils.CA_StatePlane)\n",
" geometry = (gdf.geometry.to_crs(geography_utils.CA_NAD83Albers_ft)\n",
" .buffer(300)\n",
" .to_crs(geography_utils.WGS84)\n",
" )\n",
Expand Down
2 changes: 1 addition & 1 deletion la_metro_demo/A2_clean_up_gtfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# LA Metro data is for Oct 2022, so let's use the date we already downloaded
analysis_date = rt_dates.DATES["oct2022"]
PROJECT_CRS = geography_utils.CA_NAD83Albers
PROJECT_CRS = geography_utils.CA_NAD83Albers_m


def fill_missing_route_short_name(df: pd.DataFrame) -> pd.DataFrame:
Expand Down
2 changes: 1 addition & 1 deletion la_metro_demo/A3_assemble_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import A2_clean_up_gtfs as clean_up_gtfs

PROJECT_CRS = geography_utils.CA_NAD83Albers
PROJECT_CRS = geography_utils.CA_NAD83Albers_m
BUS_SERVICE_GCS = "gs://calitp-analytics-data/data-analyses/bus_service_increase/"


Expand Down
2 changes: 1 addition & 1 deletion py_crow_flies/py_crow_flies.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"outputs": [],
"source": [
"# Transform the grid points to your preferred CRS\n",
"central = central.to_crs(shared_utils.geography_utils.CA_NAD83Albers).set_index('pointid')\n",
"central = central.to_crs(shared_utils.geography_utils.CA_NAD83Albers_m).set_index('pointid')\n",
"central = central >> select(-_.Point_ID)"
]
},
Expand Down
6 changes: 3 additions & 3 deletions rt_segment_speeds/11_tiger.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
" f\"{SHARED_GCS}all_roads_2020_state06.parquet\",\n",
" filters=[(\"MTFCC\", \"in\", road_type_wanted)],\n",
" columns=[\"LINEARID\", \"geometry\", \"FULLNAME\"],\n",
" ).to_crs(geography_utils.CA_NAD83Albers)\n",
" ).to_crs(geography_utils.CA_NAD83Albers_m)\n",
"\n",
" # If a road has mutliple rows but the same\n",
" # linear ID, dissolve it so it becomes one row.\n",
Expand Down Expand Up @@ -238,7 +238,7 @@
" .drop_duplicates()\n",
" )\n",
"\n",
" stops = stops.set_crs(geography_utils.CA_NAD83Albers)\n",
" stops = stops.set_crs(geography_utils.CA_NAD83Albers_m)\n",
"\n",
" # Buffer each stop by 50 feet\n",
" stops = stops.assign(buffered_geometry=stops.geometry.buffer(50))\n",
Expand Down Expand Up @@ -287,7 +287,7 @@
" \"\"\"\n",
" gtfs_shapes = helpers.import_scheduled_shapes(date).compute().drop_duplicates()\n",
"\n",
" gtfs_shapes = gtfs_shapes.set_crs(geography_utils.CA_NAD83Albers)\n",
" gtfs_shapes = gtfs_shapes.set_crs(geography_utils.CA_NAD83Albers_m)\n",
"\n",
" trips = (\n",
" helpers.import_scheduled_trips(date, (), [\"name\", \"shape_array_key\"])\n",
Expand Down
4 changes: 2 additions & 2 deletions thruway_bus_validators/A2_plot_amtrak_thruway.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"outputs": [],
"source": [
"gdf = gdf.assign(\n",
" route_mi = ((gdf.geometry.to_crs(geography_utils.CA_StatePlane)\n",
" route_mi = ((gdf.geometry.to_crs(geography_utils.CA_NAD83Albers_ft)\n",
" .length).divide(geography_utils.FEET_PER_MI)).round(2)\n",
")"
]
Expand Down Expand Up @@ -470,7 +470,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions thruway_bus_validators/A4_local_routes_same_od.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def keep_long_shape_ids(routelines: dg.GeoDataFrame | gpd.GeoDataFrame,
Filter down routelines file to just routes that are pretty long
with shape_id.
"""
routelines = routelines.to_crs(geography_utils.CA_StatePlane)
routelines = routelines.to_crs(geography_utils.CA_NAD83Albers_ft)

routelines = routelines.assign(
route_mi = routelines.geometry.length.divide(
Expand Down Expand Up @@ -115,7 +115,7 @@ def buffer_around_origin_destination(gdf: gpd.GeoDataFrame,
geom_cols = list(gdf.select_dtypes("geometry").columns)

for c in geom_cols:
gdf[c] = gdf[c].to_crs(geography_utils.CA_StatePlane)
gdf[c] = gdf[c].to_crs(geography_utils.CA_NAD83Albers_ft)

gdf = gdf.assign(
origin_buffer = gdf.origin.buffer(buffer_feet),
Expand Down

0 comments on commit 0bf308a

Please sign in to comment.