Skip to content

Commit 1c07b35

Browse files
committed
Add markdown narrative cells to GRIB example
1 parent d03f056 commit 1c07b35

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

doc/examples/ERA5-GRIB-example.ipynb

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# GRIB Data Example "
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"GRIB format is commonly used to disemminate atmospheric model data. With Xarray and the cfgrib engine, GRIB data can easily be analyzed and visualized."
15+
]
16+
},
317
{
418
"cell_type": "code",
519
"execution_count": null,
@@ -10,6 +24,13 @@
1024
"import matplotlib.pyplot as plt"
1125
]
1226
},
27+
{
28+
"cell_type": "markdown",
29+
"metadata": {},
30+
"source": [
31+
"To read GRIB data, you can use `xarray.load_dataset`. The only extra code you need is to specify the engine as `cfgrib`."
32+
]
33+
},
1334
{
1435
"cell_type": "code",
1536
"execution_count": null,
@@ -19,6 +40,13 @@
1940
"ds = xr.load_dataset('data/era5-2mt-2019-03-uk.grib', engine='cfgrib')"
2041
]
2142
},
43+
{
44+
"cell_type": "markdown",
45+
"metadata": {},
46+
"source": [
47+
"Let's create a simple plot of 2-m air temperature in degrees Celsius:"
48+
]
49+
},
2250
{
2351
"cell_type": "code",
2452
"execution_count": null,
@@ -29,6 +57,13 @@
2957
"ds.t2m[0].plot(cmap=plt.cm.coolwarm)"
3058
]
3159
},
60+
{
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"With CartoPy, we can create a more detailed plot, using built-in shapefiles to help provide geographic context:"
65+
]
66+
},
3267
{
3368
"cell_type": "code",
3469
"execution_count": null,
@@ -45,21 +80,21 @@
4580
]
4681
},
4782
{
48-
"cell_type": "code",
49-
"execution_count": null,
83+
"cell_type": "markdown",
5084
"metadata": {},
51-
"outputs": [],
5285
"source": [
53-
"ds.t2m.sel(longitude=0,latitude=51.5).plot()\n",
54-
"plt.title('ERA5 - London 2m temperature March 2019')"
86+
"Finally, we can also pull out a time series for a given location easily:"
5587
]
5688
},
5789
{
5890
"cell_type": "code",
5991
"execution_count": null,
6092
"metadata": {},
6193
"outputs": [],
62-
"source": []
94+
"source": [
95+
"ds.t2m.sel(longitude=0,latitude=51.5).plot()\n",
96+
"plt.title('ERA5 - London 2m temperature March 2019')"
97+
]
6398
}
6499
],
65100
"metadata": {

0 commit comments

Comments
 (0)