Skip to content

Commit cb600ee

Browse files
committed
Merge pull request #558 from clarkfitzg/cartopy_example
cartopy example using real data
2 parents 276592c + 79423a3 commit cb600ee

File tree

5 files changed

+19
-27
lines changed

5 files changed

+19
-27
lines changed

doc/examples/atlantic_noise.png

-91.6 KB
Binary file not shown.

doc/examples/cartopy_atlantic.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

doc/examples/cartopy_example.png

91.5 KB
Loading

doc/examples/cartopy_example.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import xray
2+
import matplotlib.pyplot as plt
3+
import cartopy.crs as ccrs
4+
5+
6+
air = (xray.tutorial
7+
.load_dataset('air_temperature')
8+
.air
9+
.isel(time=0))
10+
11+
ax = plt.axes(projection=ccrs.Orthographic(-80, 35))
12+
ax.set_global()
13+
air.plot.contourf(ax=ax, transform=ccrs.PlateCarree())
14+
ax.coastlines()
15+
16+
plt.savefig('cartopy_example.png')

doc/plotting.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,15 @@ since levels are chosen automatically).
309309
Maps
310310
----
311311

312-
TODO - Update this example to use the tutorial data.
313-
314312
To follow this section you'll need to have Cartopy installed and working.
315313

316-
This script will plot an image over the Atlantic ocean.
314+
This script will plot the air temperature on a map.
317315

318-
.. literalinclude:: examples/cartopy_atlantic.py
316+
.. literalinclude:: examples/cartopy_example.py
319317

320318
Here is the resulting image:
321319

322-
.. image:: examples/atlantic_noise.png
320+
.. image:: examples/cartopy_example.png
323321

324322
Details
325323
-------

0 commit comments

Comments
 (0)