Skip to content

Commit

Permalink
Merge pull request #912 from cal-itp/update-starter-kit
Browse files Browse the repository at this point in the history
update tutorials, fix broken links, add references
  • Loading branch information
tiffanychu90 authored Sep 29, 2023
2 parents dc93d04 + ccc55e9 commit 2773998
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 10 deletions.
2 changes: 1 addition & 1 deletion starter_kit/basics_04.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
" * Play with inner join or left join, what's the difference? Which one do you want?\n",
" * Play with switching around the left_df and right_df, what's the right order?\n",
"* By county: count number of stops and stops per sq_mi.\n",
" * Hint 1: Start with a CRS with units in feet or meters, then do a conversion to sq mi. [CRS in shared_utils](https://github.com/cal-itp/data-analyses/blob/main/_shared_utils/shared_utils/geography_utils.py)\n",
" * Hint 1: Start with a CRS with units in feet or meters, then do a conversion to sq mi. [CRS in geography_utils](https://github.com/cal-itp/data-infra/blob/main/packages/calitp-data-analysis/calitp_data_analysis/geography_utils.py)\n",
" * Hint 2: to find area, you can create a new column and calculate `gdf.geometry.area`. [geometry manipulations docs](https://geopandas.org/en/stable/docs/user_guide/geometric_manipulations.html)"
]
},
Expand Down
6 changes: 3 additions & 3 deletions starter_kit/basics_04_steps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"source": [
"## Turn lat/lon into point geometry\n",
"\n",
"* There is a [function in calitp_data_analysis](https://github.com/cal-itp/data-infra/blob/main/packages/calitp-data-analysis/calitp_data_analysis/geography_utils.py#L57-L84) that does it. Show the steps within the function (the long way), and also create the `geometry` column using `shared_utils`.\n",
"* There is a [function in calitp_data_analysis](https://github.com/cal-itp/data-infra/blob/main/packages/calitp-data-analysis/calitp_data_analysis/geography_utils.py#L57-L84) that does it. Show the steps within the function (the long way), and also create the `geometry` column using `calitp_data_analysis`.\n",
"* Use `geography_utils.create_point_geometry??` to see what goes into that function, and what that function looks like under the hood."
]
},
Expand All @@ -137,7 +137,7 @@
"\n",
"A gdf would have a coordinate reference system that converts the points or lines into a place on the spherical Earth. The most common CRS is called `WGS 84`, and its code is `EPSG:4326`. This is what you'd see when you use Google Maps to find lat/lon of a place.\n",
"\n",
"[Read](https://desktop.arcgis.com/en/arcmap/latest/map/projections/about-geographic-coordinate-systems.htm) about the `WGS 84` geographic coordinate system.\n",
"[Read](https://desktop.arcgis.com/en/arcmap/latest/map/projections/about-geographic-coordinate-systems.htm) about the `WGS84` geographic coordinate system.\n",
"\n",
"[Read](https://desktop.arcgis.com/en/arcmap/latest/map/projections/about-projected-coordinate-systems.htm) about projected coordinate reference systems, which is essentially about flattening our spherical Earth into a 2D plane so we can measure distances and whatnot.\n",
"\n",
Expand Down Expand Up @@ -188,7 +188,7 @@
" * Play with inner join or left join, what's the difference? Which one do you want?\n",
" * Play with switching around the left_df and right_df, what's the right order?\n",
"* By county: count number of stops and stops per sq_mi.\n",
" * Hint 1: Start with a CRS with units in feet or meters, then do a conversion to sq mi. [CRS in shared_utils](https://github.com/cal-itp/data-analyses/blob/main/_shared_utils/shared_utils/geography_utils.py)\n",
" * Hint 1: Start with a CRS with units in feet or meters, then do a conversion to sq mi. [CRS in geography_utils](https://github.com/cal-itp/data-infra/blob/main/packages/calitp-data-analysis/calitp_data_analysis/geography_utils.py)\n",
" * Hint 2: to find area, you can create a new column and calculate `gdf.geometry.area`. [geometry manipulations docs](https://geopandas.org/en/stable/docs/user_guide/geometric_manipulations.html)"
]
},
Expand Down
60 changes: 58 additions & 2 deletions starter_kit/basics_05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@
{
"cell_type": "markdown",
"id": "6c762aa7-15ac-4f6d-9867-e35b0b723a57",
"metadata": {},
"metadata": {
"tags": []
},
"source": [
"## Research Question\n",
"\n",
"What's the average number of trips per stop by operators in southern California? Show visualizations at the operator and county-level.\n",
"<br>**Geographic scope:** southern California counties\n",
"<br>**Deliverables:** chart(s) and map(s) showing metrics comparing across counties and also across operators. Make these visualizations using function(s).\n",
"\n",
"### Prep data\n",
"\n",
"* Use the same query, but grab a different set of operators. These are in southern California, so the map should zoom in counties ranging from LA to SD.\n",
Expand Down Expand Up @@ -218,7 +226,7 @@
"### Visualizations\n",
"* Make one chart for comparing trips per stop by operators, and another chart for comparing it by counties. Use a function to do this.\n",
"* Make 1 map for comparing trips per stop by counties. Use `gdf.explore()` to do this.\n",
"* Visualizations should follow the Cal-ITP style guide: [styleguide example notebook](https://github.com/cal-itp/data-analyses/blob/main/example_report/style-guide-examples.ipynb)\n",
"* Visualizations should follow the Cal-ITP style guide: [styleguide example notebook](https://github.com/cal-itp/data-analyses/blob/main/starter_kit/style-guide-examples.ipynb)\n",
"* More on `folium` and `ipyleaflet`: https://github.com/jorisvandenbossche/geopandas-tutorial/blob/master/05-more-on-visualization.ipynb"
]
},
Expand All @@ -233,6 +241,54 @@
"from calitp_data_analysis import styleguide\n",
"from calitp_data_analysis import calitp_color_palette as cp"
]
},
{
"cell_type": "markdown",
"id": "c2dbfb90-1ffa-4ac9-9c96-9fd1b13273d7",
"metadata": {},
"source": [
"Make a chart and a map of total stop events by county."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05489f8d-3b5c-4fbc-9650-94ed122b7ade",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "b25d7866-a582-4af8-a64b-af1b35fbdfff",
"metadata": {},
"source": [
"Make a chart and a map of stop events per stop by county."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0ad7f55-cfb0-4415-a327-abc8cef3fbf5",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "90ed5119-967d-496f-a6a2-70d6ebefa435",
"metadata": {},
"source": [
"Use a Markdown cell and write how you would summarize and interpret the visualizations."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b12a2ab9-ba93-4367-86d3-b08ae2a3923b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion starter_kit/basics_05_steps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
"### Visualizations\n",
"* Make one chart for comparing trips per stop by operators, and another chart for comparing it by counties. Use a function to do this.\n",
"* Make 1 map for comparing trips per stop by counties. Use `gdf.explore()` to do this.\n",
"* Visualizations should follow the Cal-ITP style guide: [styleguide example notebook](https://github.com/cal-itp/data-analyses/blob/main/example_report/style-guide-examples.ipynb)\n",
"* Visualizations should follow the Cal-ITP style guide: [styleguide example notebook](https://github.com/cal-itp/data-analyses/blob/main/starter_kit/style-guide-examples.ipynb)\n",
"* More on `folium` and `ipyleaflet`: https://github.com/jorisvandenbossche/geopandas-tutorial/blob/master/05-more-on-visualization.ipynb"
]
},
Expand Down
9 changes: 7 additions & 2 deletions starter_kit/basics_06.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@
"import intake\n",
"import pandas as pd\n",
"\n",
"from calitp_data_analysis import geography_utils, utils\n",
"from calitp_data_analysis import styleguide\n",
"\n",
"# Hint: if this doesn't import: refer to docs for correctly import\n",
"# cd into _shared_utils folder, run the make setup_env command\n",
"from calitp_data_analysis import geography_utils"
"from shared_utils import portfolio_utils"
]
},
{
Expand Down Expand Up @@ -61,7 +64,9 @@
"## Combine datasets\n",
"* Do a merge or spatial join to combine the geospatial and tabular data\n",
"* Create a new column of a summary statistic to visualize\n",
"* Rely on `shared_utils` to do at least one operation (aggregation, re-projecting to a different CRS, exporting geoparquet, etc)"
"* Rely on `calitp_data_analysis` or `shared_utils` to do at least one operation (aggregation, re-projecting to a different CRS, exporting geoparquet, etc)\n",
" * aggregation: `portfolio_utils.aggregate_by_geography`\n",
" * exporting geoparquet: `calitp_data_analysis.utils.geoparquet_gcs_export`"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion starter_kit/basics_07.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"* spatial join vs overlay [explanation](https://groups.google.com/g/geopandas/c/H_qzH2T5cCE)\n",
"* `geopandas` tutorials by package creator: https://github.com/jorisvandenbossche/geopandas-tutorial\n",
"* `geopandas` concepts, explanations, but datasets use Hebrew: https://geobgu.xyz/py/geopandas2.html\n",
"* Advanced spatial modeling concepts: https://geographicdata.science/book/notebooks/01_geo_thinking.html"
"* Advanced spatial modeling concepts: https://geographicdata.science/book/notebooks/01_geo_thinking.html\n",
"* [PyGIS](https://pygis.io/docs/a_intro.html) Geospatial Tutorials (focus on ch 1-3)\n",
"* 7 crucial geoprocessing [tools](https://gisgeography.com/geoprocessing-tools/)"
]
},
{
Expand Down

0 comments on commit 2773998

Please sign in to comment.