Introduction to Cartopy for Map-making

Summary

Cartopy is a mapping and imaging package originating from the Met. Office in the UK. The home page for the package is http://scitools.org.uk/cartopy/. Like many python packages, the documentation is patchy and the best way to learn is to try to do things and ask other people who have figured out this and that.

We are going to work through a number of the examples and try to extend them to do the kinds of things you might find interesting and useful in the future. The examples are in the form of a gallery

You might also want to look at the list of map projections from time to time. Not all maps can be plotted in every projection (sometimes because of bugs and sometimes because they are not supposed to work for the data you have) but you can try them and see what happens.

Cartopy is built on top of a lot of the matplotlib graphing tools. It works by introducing a series of projections associated with the axes of a graph. On top of that there is a big toolkit for reading in images, finding data from standard web feeds, and manipulating geographical objects. Many, many libraries are involved and sometimes things break. Luckily the installation that is built for this course is about as reliable as we can ever get. I’m just warning you, though, that it can be quite tough if you want to put this on your laptop from scratch.

Let’s get started

We have a number of imports that we will need almost every time.

If we are going to plot anything then we need to include matplotlib.

The simplest plot: global map using the default image built into the package and adding coastlines

Try changing the projection - look at the list in the link I gave you above to see what ccrs has available. In the notebook, many of the projections will time out because they are so computationally intensive but these work: EckartI, EckartV, Stereographic, Orthographic, LambertConformal, Miller, `Mollweide.

Here is how you can plot a region instead of the globe: