Skip to content

Commit

Permalink
updated file
Browse files Browse the repository at this point in the history
  • Loading branch information
zyang91 committed May 30, 2024
1 parent fbc2802 commit dd04e36
Show file tree
Hide file tree
Showing 5 changed files with 1,225 additions and 0 deletions.
338 changes: 338 additions & 0 deletions lab/final/geog-414-final.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "Dtex9L6CV_aV"
},
"source": [
"# GEOG-414 Final Exam\n",
"\n",
"\n",
"**Exam Structure**\n",
"\n",
"The final exam accounts for 20% of the total grade, equivalent to 200 points. The exam consists of five questions, with each question carrying a weight of 40 points. There are four questions about Earth Engine and one question about DuckDB. While it is an open-book exam, it is essential that you complete it independently, without collaborating with others. You are allowed to utilize online resources to find solutions. The exam must be completed within 120 minutes and is due at precisely 12:30 pm. However, please note that for each 10-minute interval of late submission, a penalty of 10% will be deducted from your score.\n",
"\n",
"**Submission Requirements**\n",
"\n",
"1. **Screenshots:** For each question, upload a screenshot of your map/chart. Ensure the screenshot includes your name on it.\n",
"2. **HTML file:** Submit an HTML version of your notebook. Ensure all code outputs are visible. (Export via VS Code: Notebook > Export > HTML).\n",
"3. **Colab ink:** Provide a link to your notebook hosted on Google Colab for interactive review."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "WeQJFQdtV_aZ"
},
"source": [
"## Question 1\n",
"\n",
"Create annual cloud-free Landsat composite (**2015-2023**) of the state of Tennessee and display them on the map using false color composite.\n",
"\n",
"Relevant datasets:\n",
"\n",
"* [TIGER: US Census States](https://developers.google.com/earth-engine/datasets/catalog/TIGER_2018_States): `ee.FeatureCollection(\"TIGER/2018/States\")`\n",
"* [USGS Landsat 8 Level 2, Collection 2, Tier 1](https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC08_C02_T1_L2): `ee.ImageCollection(\"LANDSAT/LC08/C02/T1_L2\")`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "o3XSVJk_V_aZ"
},
"outputs": [],
"source": [
"import ee\n",
"import geemap\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HXBWkQjUV_aa"
},
"source": [
"![](https://i.imgur.com/UKQUi85.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "OQAa0h0AV_ab"
},
"source": [
"## Question 2\n",
"\n",
"Based on Question 1, extract annual water areas (**2015-2023**) for the state of Tennessee based on the [Normalized Difference Water Index (NDWI)](https://en.wikipedia.org/wiki/Normalized_difference_water_index) and display them on the m. See [this example](https://developers.google.com/earth-engine/guides/image_visualization#color-palettes).\n",
"\n",
"Relevant datasets:\n",
"\n",
"* [TIGER: US Census States](https://developers.google.com/earth-engine/datasets/catalog/TIGER_2018_States): `ee.FeatureCollection(\"TIGER/2018/States\")`\n",
"* [USGS Landsat 8 Level 2, Collection 2, Tier 1](https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC08_C02_T1_L2): `ee.ImageCollection(\"LANDSAT/LC08/C02/T1_L2\")`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "m31x7mzgV_ab"
},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "KYPJXB7wV_ab"
},
"source": [
"![](https://i.imgur.com/GSfICAZ.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Z6et2IKwV_ac"
},
"source": [
"## Question 3\n",
"\n",
"Based on Question 2, create the maximum water extent (**2015-2023**) for the state of Tennessee. Each pixel in the maximum water extent indicates that the pixel has been detected as water at lease once since 2015. Also extract surface water extent for the state of Tennessee based on the [JRC Global Surface Water Mapping Layers](https://developers.google.com/earth-engine/datasets/catalog/JRC_GSW1_4_GlobalSurfaceWater) (select the `occurrence` band). Create a split map to visually compare the water areas extracted from two different methods (i.e., NDWI and JRC).\n",
"\n",
"**Hints:** use the sum() function on the ImageCollection and then convert it to a binary image to get the maximum water extent.\n",
"\n",
"Relevant datasets:\n",
"\n",
"* [TIGER: US Census States](https://developers.google.com/earth-engine/datasets/catalog/TIGER_2018_States): `ee.FeatureCollection(\"TIGER/2018/States\")`\n",
"* [USGS Landsat 8 Level 2, Collection 2, Tier 1](https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LC08_C02_T1_L2): `ee.ImageCollection(\"LANDSAT/LC08/C02/T1_L2\")`\n",
"* [JRC Global Surface Water Mapping Layers](https://developers.google.com/earth-engine/datasets/catalog/JRC_GSW1_4_GlobalSurfaceWater): `ee.Image(\"JRC/GSW1_4/GlobalSurfaceWater\").select('occurrence')`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "fcDdTv5DV_ac"
},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xX340vLdV_ac"
},
"source": [
"![](https://i.imgur.com/lHtlpB4.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "PCvund6KV_ad"
},
"source": [
"## Question 4\n",
"\n",
"Create annual composite of 4-band(RGBN) NAIP imagery and Normalized Difference Vegetation Index (NDVI) for Knox County, Tennessee and display them on the m.\n",
"\n",
"Relevant datasets:\n",
"* [TIGER: US Census Counties](https://developers.google.com/earth-engine/datasets/catalog/TIGER_2018_Counties): `ee.FeatureCollection(\"TIGER/2018/Counties\")`\n",
"* [NAIP: National Agriculture Imagery Program](https://developers.google.com/earth-engine/datasets/catalog/USDA_NAIP_DOQQ): `ee.ImageCollection(\"USDA/NAIP/DOQQ\")`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "N1UcWhM9V_ad"
},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "15ZdwXi0V_ad"
},
"source": [
"![](https://i.imgur.com/yWkyENq.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "tvT-MKqZV_ad"
},
"source": [
"## Question 5\n",
"\n",
"Analyzing the NYC crime data from 2003 to 2011 using DuckDB. The database `nyc_data.db` is available for download from [here](https://github.com/opengeos/data/raw/main/duckdb/nyc_data.db.zip). The database contains two tables: `nyc_homicides` and `nyc_neighborhoods`. The `nyc_homicides` table contains the homicide data from 2003 to 2011, and the `nyc_neighborhoods` table contains the neighborhood boundaries of New York City. Use these two tables to answer the following questions:\n",
"\n",
"1. What is the total number of homicides in New York City from 2003 to 2011?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Wa3WC0UCV_ad"
},
"outputs": [],
"source": [
"# add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "v6Jq7PmbV_ad"
},
"source": [
"2. Find out the top 10 neighborhoods with the highest number of homicides in New York City from 2003 to 2011."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "FP-2koBjV_ae"
},
"source": [
"3. Create a bar chart to visualize the number of homicides in New York City by year from 2003 to 2011. The bar chart title should contain your name."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "lSW3Ny67V_ae"
},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "HNnw6p9vV_ae"
},
"source": [
"![](https://i.imgur.com/HUwUYkY.png)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "ueJr7W4pV_ae"
},
"source": [
"4. Create a pie chart to visualize the number of homicides in New York City by borough from 2003 to 2011. The pie chart title should contain your name."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "uLSq0K2hV_ae"
},
"outputs": [],
"source": [
"# Add your code here"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "glA429T3V_ae"
},
"source": [
"![](https://i.imgur.com/px7UYTF.png)"
]
}
],
"metadata": {
"colab": {
"provenance": []
},
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"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.12.0"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit dd04e36

Please sign in to comment.