Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sentinel-1 Tutorial #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions book/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ parts:
- file: tutorials/index
sections:
- file: tutorials/example/tutorial-notebook
sections:
- file: tutorials/sentinel-1/tutorial-notebook
- caption: Projects
chapters:
- file: projects/list_of_projects
Expand Down
247 changes: 247 additions & 0 deletions book/tutorials/sentinel1/snentinel1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "suffering-union",
"metadata": {},
"source": [
"# Sentinel-1 Draft\n",
"\n",
"```{admonition} Learning Objectives\n",
"**This is an example tutorial notebook for UW hackweeks**\n",
"- introduce people to Sentinel-1 satellite radar\n",
"```\n",
"☝️ This formatting is a Jupyter Book [admonition](https://jupyterbook.org/content/content-blocks.html#notes-warnings-and-other-admonitions), that uses a custom version of Markdown called {term}`MyST`"
]
},
{
"cell_type": "markdown",
"id": "649d863c-5ad1-4b9f-9fa0-416ff04396a4",
"metadata": {},
"source": [
"## Computing environment\n",
"\n",
"We'll be using the following open source Python libraries in this notebook:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "2a5720d5-d805-4c24-a92e-a2238805cdbf",
"metadata": {},
"outputs": [],
"source": [
"import ipyleaflet\n",
"from ipyleaflet import Map, Rectangle, basemaps, basemap_to_tiles, TileLayer, SplitMapControl, Polygon\n",
"\n",
"import ipywidgets\n",
"import datetime\n",
"import re"
]
},
{
"cell_type": "markdown",
"id": "d73344a2-f797-4218-a99f-a9db0338f002",
"metadata": {},
"source": [
"## Data\n",
"\n",
"We will examine raster images from the [MODIS instrument](https://modis.gsfc.nasa.gov/data/). \"MODIS\" stands for \"MODerate Resolution SpectroRadiometer\". Moderate resolution refers to the fact that MODIS data has at best a 250 meter pixel posting, but single images cover hundreds of kilometers, enabling [daily views of the entire globe](https://worldview.earthdata.nasa.gov/):\n",
"\n",
"\n",
":::{figure-md} modis\n",
"<img src=\"https://eoimages.gsfc.nasa.gov/images/imagerecords/0/687/world_2000_110_rgb143.jpg\" alt=\"modis day 1\" width=\"800px\">\n",
"\n",
"Mosaic MODIS image from the first complete day of coverage, June 30, 2000\n",
":::\n",
"\n",
"☝️ This formatting is a Jupyter Book [markdown figure](https://jupyterbook.org/content/figures.html#markdown-figures)\n",
"\n",
"Note there are two identical MODIS instruments on separate satellites\n",
"\n",
"| Satellite | Launch date |\n",
"| - | -|\n",
"| Terra | December 18, 1999 | \n",
"| Aqua | May 4, 2002 | "
]
},
{
"cell_type": "markdown",
"id": "5b99d916-deb8-4af0-9fce-1e38e5c18d87",
"metadata": {},
"source": [
"## Interactive visualization\n",
"\n",
"The ipyleaflet library allows us to create interactive map visualizations. Below we define a geographic bounding box for our area of interest, and plot it on an interactive \"slippy map\"."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "equipped-qualification",
"metadata": {},
"outputs": [],
"source": [
"bbox = [-108.3, 39.2, -107.8, 38.8]\n",
"west, north, east, south = bbox\n",
"bbox_ctr = [0.5*(north+south), 0.5*(west+east)]"
]
},
{
"cell_type": "markdown",
"id": "stylish-wildlife",
"metadata": {},
"source": [
"Display the bounding box on an interactive basemap for context. All the available basemaps can be found in the [ipyleaflet documentation](https://ipyleaflet.readthedocs.io/en/latest/api_reference/basemaps.html)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "durable-strength",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "264808a4c863448cbba51e98bf310a92",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[39.0, -108.05], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_…"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = Map(center=bbox_ctr, zoom=10)\n",
"rectangle = Rectangle(bounds=((south, west), (north, east))) #SW and NE corners of the rectangle (lat, lon)\n",
"m.add_layer(rectangle)\n",
"m"
]
},
{
"cell_type": "markdown",
"id": "handy-watch",
"metadata": {},
"source": [
"### NASA GIBS basemap\n",
"\n",
"NASA's [Global Imagery Browse Services (GIBS)](https://earthdata.nasa.gov/eosdis/science-system-description/eosdis-components/gibs) is a great Web Map Tile Service (WMTS) to visualize NASA data as pre-rendered tiled raster images. The NASA [Worldview](https://worldview.earthdata.nasa.gov) web application is a way to explore all GIBS datasets. We can also use ipyleaflet to explore GIBS datasets, like MODIS truecolor images, within a Jupyter Notebook. Use the slider in the image below to reveal the image from 2019-04-25:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "stylish-cincinnati",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9a8f9a8d88bb4ed7b0cb3de21611497f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[39.0, -108.05], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_…"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = Map(center=bbox_ctr, zoom=6)\n",
"\n",
"right_layer = basemap_to_tiles(basemaps.NASAGIBS.ModisTerraTrueColorCR, \"2019-04-25\")\n",
"left_layer = TileLayer()\n",
"control = SplitMapControl(left_layer=left_layer, right_layer=right_layer)\n",
"m.add_control(control)\n",
"\n",
"m.add_layer(rectangle)\n",
"\n",
"m"
]
},
{
"cell_type": "markdown",
"id": "40bb26cf-5651-4424-bab0-89bdc0b69ff1",
"metadata": {},
"source": [
"### Exercise 1\n",
"\n",
"Re-create the map above using different tile layers for both the right and left columns. Label a single point of interest with a marker, such as the city of Grand Junction, Colorado."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "21ccf31e-1919-45c2-9796-26f7bac25520",
"metadata": {},
"outputs": [],
"source": [
"# Add your solution for exercise 1 here!"
]
},
{
"cell_type": "markdown",
"id": "surrounded-amateur",
"metadata": {},
"source": [
"## Summary\n",
"\n",
" 🎉 Congratulations! You've completely this tutorial and have seen how we can add notebook can be formatted, and how to create interactive map visualization with ipyleaflet.\n",
" \n",
"\n",
"```{note}\n",
"You may have noticed Jupyter Book adds some extra formatting features that do not necessarily render as you might expect when *executing* a noteook in Jupyter Lab. This \"admonition\" note is one such example.\n",
"```\n",
"\n",
":::{warning}\n",
"Jupyter Book is very particular about [Markdown header ordering](https://jupyterbook.org/structure/sections-headers.html?highlight=headers#how-headers-and-sections-map-onto-to-book-structure) to automatically create table of contents on the website. In this tutorial we are careful to use a single main header (#) and sequential subheaders (#, ##, ###, etc.)\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "749f5c79-19d7-48ac-9421-852c3c83cc5f",
"metadata": {},
"source": [
"## References\n",
"\n",
"To further explore the topics of this tutorial see the following detailed documentation:\n",
"\n",
"* [Jupyter Book rendering of .ipynb notebooks](https://jupyterbook.org/file-types/notebooks.html)\n",
"* [Jupyter Book guide on writing narrative content](https://jupyterbook.org/content/index.html)\n",
"* [ipyleaflet documentation](https://ipyleaflet.readthedocs.io)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading