Meteorographica.background

A weather-map should show the weather with as little distraction as possible. We need a map background to show where we are in the world, and also to indicate the local orography, which can be important, but it should be as unobtrusive as posible.

This package two features to add background to plots. A function to draw a lat:lon grid, and a custom background image derived from Natural Earth data.

The grid takes a cartopy.mpl.geoaxes.GeoAxes to draw into

Meteorographica.background.add_grid(geoaxes,**options)

The image is applied using an existing GeoAxes function:

ax.background_img(name='GreyT', resolution='low')

But we do have to make it - this should be done during installation.

See examples of use.


Meteorographica.background.add_grid(ax, **kwargs)[source]

Add a lat-lon grid to the map.

Actually plots two grids, a minor grid at a narrow spacing with thin lines, and a major grid at a wider spacing with thicker lines. Note that the grids only cover the latitude range -85 to 85, because the line spacings become too small very close to the poles on a rotated grid.

Parameters:

ax (cartopy.mpl.geoaxes.GeoAxes) – Axes on which to draw.

Keyword Arguments:
 
  • linestyle (str) – See matplotlib.lines.Line2D.set_linestyle(). Defaults to ‘-‘.
  • linewidth_minor (float) – Line width for minor grid. Defaults to 0.2.
  • linewidth_major (float) – Line width for major grid. Defaults to 0.5.
  • color (see matplotlib.colors) – Grid colour. Defaults to (0,0.30,0,0.3).
  • sep_minor (float) – Separation, in degrees, of the minor grid lines. Defaults to 0.5.
  • sep_major (float) – Separation, in degrees, of the major grid lines. Defaults to 2.0.
  • zorder (float) – Standard matplotlib parameter determining which things are plotted on top (high zorder), and which underneath (low zorder), Defaults to 0 - at the bottom.
Returns:

Nothing - adds the grid to the plot as a side effect.


Meteorographica.scripts.fetch_backgrounds.fetch_backgrounds()[source]

Fetch plot background data from Natural Earth.

Cartopy uses background images from Natural Earth for things like continent outlines on world maps - Meteorographica folows it in this. This function downloads some Natural Earth data (continent backgrounds) and modifies it to make ocean regions transparent for easy use in map plots.

You should only have to run this function once as part of the set-up of this module.

Requires three utility functions to be available: wget, unzip, and imagemagick convert. It will create map background files in the directory specified by the CARTOPY_USER_BACKGROUNDS environment variable which should have been set during the installation of Cartopy.

Raises:StandardError – Environment variable ‘CARTOPY_USER_BACKGROUNDS’ is not set