Skip to content

Commit

Permalink
Standardize frontmatter across Tutorials (#29)
Browse files Browse the repository at this point in the history
* Make frontmatter consistent

* Shorten links | Clear cells

* Make title consistent

* Fix emojis

* Fix emojis

* Fix typos | Add links

* Add note for reporting errors

* Fix bold font

* Make headings consistent

* Make headings consistent

* Format header for animations as a note

---------

Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com>
  • Loading branch information
yvonnefroehlich and maxrjones authored Dec 5, 2024
1 parent 5eaa158 commit 45705b7
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 130 deletions.
8 changes: 4 additions & 4 deletions book/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tutorials for making maps 🗺️ and animations 🎦
::::{grid} 1 1 1 1
:gutter: 1

:::{grid-item-card} Tutorial 1 - First figure + Subplots / layout
:::{grid-item-card} Tutorial 1 - First figure 🚀 and Subplots / layout
:img-top: _images/fd70248f75b8b37ee54b3135f77705f98c6d8489eb18b6910184b447d0f0638d.png
:link: ./tut01_firstfigure.html
by [Jing-Hui Tong](https://orcid.org/0009-0002-7195-3071)
Expand All @@ -28,7 +28,7 @@ by [Jing-Hui Tong](https://orcid.org/0009-0002-7195-3071)
{bdg-secondary-line}`earth_age`
:::

:::{grid-item-card} Tutorial 2 - Integration with the scientific Python ecosystem: pandas / GeoPandas
:::{grid-item-card} Tutorial 2 - Integration with the scientific Python ecosystem 🐍: pandas and GeoPandas (tabular data 🗒️)
:img-top: _images/7f18327908c8dd210197cc51845e45a933f356b9fd12bd029a4a8cbda080eb2b.png
:link: ./tut02_spe_pd_gpd.html
by [Yvonne Fröhlich](https://orcid.org/0000-0002-8566-0619)
Expand All @@ -52,7 +52,7 @@ by [Yvonne Fröhlich](https://orcid.org/0000-0002-8566-0619)
::::{grid} 1 1 1 1
:gutter: 1

:::{grid-item-card} Tutorial 3 - Integration with the scientific Python ecosystem: Xarray (grids)
:::{grid-item-card} Tutorial 3 - Integration with the scientific Python ecosystem 🐍: Xarray (gridded data 🌐)
:img-top: _images/a18fcb026fb0d0c83360f2b8382a360e552dd50db6aa2db5311259bf5223d3a2.png
:link: ./tut03_spe_xarray.html
by [Max Jones](https://orcid.org/0000-0003-0180-8928)
Expand All @@ -67,7 +67,7 @@ by [Max Jones](https://orcid.org/0000-0003-0180-8928)
{bdg-success-line}`CMIP6`
:::

:::{grid-item-card} Tutorial 4 - Geophysics (Seismology)
:::{grid-item-card} Tutorial 4 - Geophysics (Seismology) 🌎🌏🌍
:img-top: https://github.com/user-attachments/assets/37d94581-b9e9-4dec-a021-07c1b58c132a
:link: ./tut04_geophysics.html
by [Jing-Hui Tong](https://orcid.org/0009-0002-7195-3071)
Expand Down
93 changes: 58 additions & 35 deletions book/tut01_firstfigure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "eb4b43cc-dc76-45d1-a370-7266bd943910",
"id": "123cc524-73bd-40e5-b727-ebef5b3b1f0b",
"metadata": {
"panel-layout": {
"height": 218.611,
Expand All @@ -11,27 +11,49 @@
}
},
"source": [
"# **Tutorial 1** - First figure and subplot \n",
"\n",
"This tutorial will cover the fundamental concepts behind making figures with PyGMT: \n",
"- drawing coastlines\n",
"- drawing a map frame\n",
"- choosing a projection\n",
"- downloading remote dataset\n",
"- imaging Earth's relief\n",
"- creating colorbar\n",
"- subplot in a figure\n",
"\n",
"-----\n",
"This tutorial is part of the AGU2024 annual meeting GMT/PyGMT pre-conference workshop (PREWS9) **Mastering Geospatial Visualizations with GMT/PyGMT**\n",
"- Conference: https://agu.confex.com/agu/agu24/meetingapp.cgi/Session/226736\n",
"- GitHub: https://github.com/GenericMappingTools/agu24workshop\n",
"# **Tutorial 1** - First figure 🚀 and Subplots / layout \n",
"\n",
"This tutorial will cover the fundamental concepts behind making figures with PyGMT:\n",
"\n",
"- Drawing coastlines\n",
"- Drawing a map frame\n",
"- Choosing a projection\n",
"- Downloading remote dataset\n",
"- Imaging Earth's relief\n",
"- Creating colorbar\n",
"- Subplot in a figure"
]
},
{
"cell_type": "markdown",
"id": "dfa0db02-962e-4031-a35c-4eaf4bf7d4f2",
"metadata": {
"panel-layout": {
"height": 218.611,
"visible": true,
"width": 100
}
},
"source": [
":::{note}\n",
"\n",
"This tutorial is part of the AGU24 annual meeting GMT/PyGMT pre-conference workshop (PREWS9) **Mastering Geospatial Visualizations with GMT/PyGMT**\n",
"- Website: https://www.generic-mapping-tools.org/agu24workshop\n",
"- Recommended version: PyGMT v0.13.0 with GMT 6.5.0\n",
"----\n",
"References:\n",
"- GitHub: https://github.com/GenericMappingTools/agu24workshop\n",
"- Conference: https://agu.confex.com/agu/agu24/meetingapp.cgi/Session/226736\n",
"\n",
"History\n",
"- Author: [Jing-Hui Tong](https://orcid.org/0009-0002-7195-3071)\n",
"- Created: November-December 2024\n",
"- Recommended versions: [PyGMT v0.13.0](https://www.pygmt.org/v0.13.0) with [GMT 6.5.0](https://docs.generic-mapping-tools.org/6.5)\n",
"\n",
"References\n",
"- Liam Toney, [2021 IRIS ROSES unit05](https://github.com/roseseismo/roses2021/blob/main/unit05/roses_mapping_lecture.ipynb)\n",
"- Chih-Ming Lin, GMT courses for 2019 NTNUES summer program"
"- Chih-Ming Lin, GMT courses for 2019 NTNUES summer program\n",
"\n",
"Fee free to play around with these code examples 🚀. In case you found any kind of error, just report it by [opening an issue](https://github.com/GenericMappingTools/agu24workshop/issues) or [provide a fix via a pull request](https://github.com/GenericMappingTools/agu24workshop/pulls). Please use the [GMT forum](https://forum.generic-mapping-tools.org/) to ask questions.\n",
"\n",
":::"
]
},
{
Expand Down Expand Up @@ -66,7 +88,7 @@
}
},
"source": [
"## Importing \n",
"## 0️⃣ Importing \n",
"\n",
"First thing to do is load PyGMT (`import`) so that we can access its functionality. \n",
"\n",
Expand All @@ -88,8 +110,8 @@
"id": "ce622686-4279-4ab3-b00a-a9f3e7dc8cd4",
"metadata": {},
"source": [
"## Starting your first figure -- [`pygmt.Figure`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.html)\n",
"Every figure must start with the creation of a pygmt.Figure"
"## 1️⃣ Starting your first figure -- [`pygmt.Figure`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.html)\n",
"Every figure must start with the creation of a pygmt.Figure()"
]
},
{
Expand All @@ -115,7 +137,7 @@
"id": "03827f08-f6f5-4056-b73b-2071c90d8f0e",
"metadata": {},
"source": [
"## Drawing coastline -- [`pygmt.Figure.coast`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.coast.html)\n",
"### 1.1 Drawing coastline -- [`pygmt.Figure.coast`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.coast.html)\n",
"Before plotting, you need to define \n",
"1. `region`: Controlling the geographic or Cartesian extent of the figure. Regions are specified as lists of `[xmin, xmax, ymin, ymax]`. Another shortcut, `region=\"g\"`, which specifies a **global** domain.\n",
"2. `projection`: Controlling the map projection. GMT (and therefore PyGMT) supports 31 different map projections, from basic Cartesian axes to [arbitrary vertical perspectives](https://docs.generic-mapping-tools.org/6.5/gallery/ex26.html).\n",
Expand Down Expand Up @@ -158,7 +180,9 @@
"id": "e28639db-0e21-4c12-91b7-2a96f6158160",
"metadata": {},
"source": [
"::::{seealso} If the image size is too small, the default annotation fonts may appear disproportionately large, impacting the overall visual balance and readability."
"::::{seealso}\n",
"If the image size is too small, the default annotation fonts may appear disproportionately large, impacting the overall visual balance and readability.\n",
"::::"
]
},
{
Expand All @@ -167,7 +191,7 @@
"id": "bc713bc7-6c8b-4709-b683-e7908b4a91ef",
"metadata": {},
"source": [
"#### Coloring and add map element (frame and ticks)\n",
"### 1.2 Coloring and add map element (frame and ticks)\n",
"1. axis labels `WSne`: If an upper-case letter (W, S, N, E) is passed, the axis is plotted with tick marks and annotations. The lower-case version (w, s, n, e) plots the axis only with tick marks. To only plot the axis pass (l, b, t, r).\n",
"\n",
"2. annotations `a`: tick labels\n",
Expand Down Expand Up @@ -199,7 +223,7 @@
"id": "c9b6acaa-ffea-4c8a-bf2a-91b73070d06c",
"metadata": {},
"source": [
"#### NOTE\n",
"### 1.3 Stacking approach of GMT / PyGMT\n",
"1. In GMT/PyGMT, plotting is achieved by layering new elements, meaning that each new element is stacked on top of the previous layers. \n",
"Therefore, if you draw a black line in an earlier layer and then add a new layer (such as color filling), these new layers might cover the original black line, making it invisible.\n",
"2. In a **same figure**, once you define region/projection before, you don't need to define again. "
Expand All @@ -211,8 +235,7 @@
"id": "244b61fe-c349-41ce-9dca-6eefb35d9393",
"metadata": {},
"source": [
"## Downloading global dataset -- [`pygmt.datasets`](https://www.pygmt.org/v0.13.0/api/index.html#datasets)\n",
"\n",
"## 2️⃣ Downloading global dataset -- [`pygmt.datasets`](https://www.pygmt.org/v0.13.0/api/index.html#datasets)\n",
"\n",
"Before you access remote dataset from PyGMT, you need to define \n",
"1. `region`: Region of interest, format is [xmin, xmax, ymin, ymax]\n",
Expand Down Expand Up @@ -261,7 +284,7 @@
"id": "79fb24e7-fefe-45b4-b952-29f60172b76b",
"metadata": {},
"source": [
"## Visualizing grid -- [`pygmt.Figure.grdimage`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.grdimage.html)\n",
"## 3️⃣ Visualizing grid -- [`pygmt.Figure.grdimage`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.grdimage.html)\n",
"Project and plot grids or images\n",
"\n",
"Now, we start with a new canvas. So you need to set up region/projection again!\n",
Expand Down Expand Up @@ -294,7 +317,7 @@
"id": "2a1567c3-5ccd-4c17-bc2f-92fe33d4a398",
"metadata": {},
"source": [
"## Customizing colorbar -- [`pygmt.makecpt`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.makecpt.html)\n",
"### 3.1 Customizing colorbar -- [`pygmt.makecpt`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.makecpt.html)\n",
"Making GMT color palette tables (CPT).\n",
"\n",
"You need to define:\n",
Expand Down Expand Up @@ -326,7 +349,7 @@
"metadata": {},
"source": [
"Now, re-plot the figure with new colormap and ...\n",
"## Adding [`pygmt.Figure.colorbar`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.colorbar.html)\n",
"### 3.2 Adding [`pygmt.Figure.colorbar`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.colorbar.html)\n",
"Plot a gray or color scale-bar on maps.\n",
"\n",
"You need to define,\n",
Expand Down Expand Up @@ -381,7 +404,7 @@
"id": "d11eff82-e03c-4a89-9480-2860aa033ff6",
"metadata": {},
"source": [
"## Creating multi-panel figures in a canvas -- [`pygmt.Figure.subplot`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.subplot.html#pygmt.Figure.subplot) and [`pygmt.Figure.set_panel`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.set_panel.html#pygmt.Figure.set_panel)\n",
"## 4️⃣ Creating multi-panel figures in a canvas -- [`pygmt.Figure.subplot`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.subplot.html#pygmt.Figure.subplot) and [`pygmt.Figure.set_panel`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.set_panel.html#pygmt.Figure.set_panel)\n",
"\n",
"\n",
"You need to define the figure layout with figure.subplot:\n",
Expand Down Expand Up @@ -445,7 +468,7 @@
"id": "25aeb001-48ed-417b-94dc-637c3fad15c1",
"metadata": {},
"source": [
"### Basic projection types: \n",
"## 5️⃣ Basic projection types: \n",
"\n",
"<img src=\"_static/tut01_projection.jpg\" alt=\"position\" />\n",
"By default, PyGMT will use an equidistant cylindrical projection if the region seems to be geographic longitude and latitude.\n",
Expand Down Expand Up @@ -492,7 +515,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"version": "3.12.7"
},
"panel-cell-order": [
"eb4b43cc-dc76-45d1-a370-7266bd943910",
Expand Down
47 changes: 31 additions & 16 deletions book/tut02_spe_pd_gpd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,46 @@
"cells": [
{
"cell_type": "markdown",
"id": "315a335b-1325-4319-aa06-cb1b239616b8",
"id": "ef4bd355-d444-4afd-8f27-b0a2f7d97a76",
"metadata": {},
"source": [
"# **Tutorial 2** - scientific Python ecosystem: `pandas` and `GeoPandas`\n",
"# **Tutorial 2** - scientific Python ecosystem 🐍: `pandas` and `GeoPandas` (tabular data 🗒️)\n",
"\n",
"In this tutorial we will learn using\n",
" 1. [**pandas**](https://pandas.pydata.org/docs/): **tabular data** stored in ``pandas.DataFrame``s\n",
" 2. [**GeoPandas**](https://geopandas.org/en/stable/docs.html): **spatial data** (points, lines, polygons) stored in ``geopandas.GeoDataFrame``s\n",
"\n",
"within [`PyGMT`](https://www.pygmt.org) to create histograms and different maps.\n",
"within [`PyGMT`](https://www.pygmt.org) to create histograms and different maps."
]
},
{
"cell_type": "markdown",
"id": "06acf2fb-08b1-48b0-bfc7-5e7c46b27ffa",
"metadata": {},
"source": [
":::{note}\n",
"\n",
"-----\n",
"This tutorial is part of the AGU2024 annual meeting GMT/PyGMT pre-conference workshop (PREWS9) **Mastering Geospatial Visualizations with GMT/PyGMT**\n",
"- Conference: https://agu.confex.com/agu/agu24/meetingapp.cgi/Session/226736\n",
"- GitHub: https://github.com/GenericMappingTools/agu24workshop\n",
"This tutorial is part of the AGU24 annual meeting GMT/PyGMT pre-conference workshop (PREWS9) **Mastering Geospatial Visualizations with GMT/PyGMT**\n",
"- Website: https://www.generic-mapping-tools.org/agu24workshop\n",
"- Recommended version: PyGMT v0.13.0 with GMT 6.5.0"
"- GitHub: https://github.com/GenericMappingTools/agu24workshop\n",
"- Conference: https://agu.confex.com/agu/agu24/meetingapp.cgi/Session/226736\n",
"\n",
"History\n",
"- Author: [Yvonne Fröhlich](https://orcid.org/0000-0002-8566-0619)\n",
"- Created: November-December 2024\n",
"- Recommended versions: [PyGMT v0.13.0](https://www.pygmt.org/v0.13.0) with [GMT 6.5.0](https://docs.generic-mapping-tools.org/6.5)\n",
"\n",
"Fee free to play around with these code examples 🚀. In case you found any kind of error, just report it by [opening an issue](https://github.com/GenericMappingTools/agu24workshop/issues) or [provide a fix via a pull request](https://github.com/GenericMappingTools/agu24workshop/pulls). Please use the [GMT forum](https://forum.generic-mapping-tools.org/) to ask questions.\n",
"\n",
":::"
]
},
{
"cell_type": "markdown",
"id": "f56cbd63-a1bd-4e53-837c-13473e0db0d0",
"metadata": {},
"source": [
"## 0. General stuff"
"## 0️⃣ General stuff"
]
},
{
Expand Down Expand Up @@ -58,7 +73,7 @@
"id": "22e12c23-d01b-4c9f-91ca-0d9d1ed07409",
"metadata": {},
"source": [
"## 1. `pandas`"
"## 1️⃣ `pandas`"
]
},
{
Expand Down Expand Up @@ -204,7 +219,7 @@
"id": "0b238bef-3018-4bdc-92f8-9caa888a2c32",
"metadata": {},
"source": [
"## 2. `GeoPandas`"
"## 2️⃣ `GeoPandas`"
]
},
{
Expand All @@ -224,7 +239,7 @@
"source": [
"#### 2.1.1 Spatial Data - `geopandas.GeoDataFrame` with line geometry\n",
"\n",
"First we download some data into in a `geopandas.GeoDataFrame`. This dataset contains European rivers with its length and name."
"First we download some data into in a [`geopandas.GeoDataFrame`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html). This dataset contains European rivers with their lengths and names."
]
},
{
Expand Down Expand Up @@ -378,8 +393,8 @@
"source": [
"#### 2.2.1 Spatial Data - `geopandas.GeoDataFrame` with polygon geometry\n",
"\n",
"Again we download some data into in a `geopandas.GeoDataFrame`. This dataset contains information regarding airbnb rentals, socioeconomics, and crime in Chicagos.\n",
"This time we are lucky and the data is directly provided in the geographic coordinate reference system (longitude/latitude) and no further coordinate transformation is needed."
"Again we download some data into in a [`geopandas.GeoDataFrame`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html). This dataset contains information regarding airbnb rentals, socioeconomics, and crime in Chicagos.\n",
"This time we are lucky and the data is directly provided in the geographic coordinate reference system (longitude/latitude) and no coordinate transformation is needed."
]
},
{
Expand Down Expand Up @@ -450,7 +465,7 @@
"id": "03516fe8-5013-4acb-89d1-a1ebdbc1d426",
"metadata": {},
"source": [
"## 3. Additional comments\n",
"## 3️⃣ Additional comments\n",
"\n",
"Some helpful and interesting aspects:\n",
"\n",
Expand All @@ -466,7 +481,7 @@
"id": "9e7abfa1-13ac-4bed-896d-4e55438f1f94",
"metadata": {},
"source": [
"## 4. Orientation / suggestion for \"2.1.4 Plot the rivers with color-coding for the river length\"\n",
"## 4️⃣ Orientation / suggestion for \"2.1.4 Plot the rivers with color-coding for the river length\"\n",
"\n",
"Below you find a rough code shipset for plotting the rives with color-coding in section 2.1.4."
]
Expand Down
Loading

0 comments on commit 45705b7

Please sign in to comment.