salem.Map

class salem.Map(grid, nx=500, ny=None, countries=True, **kwargs)

Plotting georeferenced data.

A Map is an implementation of DataLevels that wraps imshow(), by adding all kinds of geoinformation on the plot. It’s primary purpose is to add country borders or topographical shading. Another purpose is to be able to plot all kind of georeferenced data on an existing map while being sure that the plot is accurate.

In short: the Map is a higher-level, less wordy and less flexible version of cartopy or basemap. It’s usefulness is best shown by the examples in the doc.

For worldwide maps or very flexible plots you’d better use cartopy, because Salem’s Map is constrained by it’s primary objective: plotting regional maps.

__init__(grid, nx=500, ny=None, countries=True, **kwargs)

Make a new map.

Parameters:

grid: a salem.Grid instance defining the map

nx: x resolution (in pixels) of the map

ny: y resolution (in pixels) of the map (ignored if nx is set)

countries: automatically add country borders to the map (you can do

it later with a call to set_shapefile)

kwards: all keywords accepted by DataLevels

Methods

__init__(grid[, nx, ny, countries]) Make a new map.
append_colorbar(ax[, position, size, pad]) Appends a colorbar to existing axes
colorbarbase(cax, **kwargs) Returns a ColorbarBase to add to the cax axis.
plot(ax) Add the map plot to an axis.
set_cmap([cm]) Set a colormap.
set_contour([data, crs, interp]) Adds data to contour on the map.
set_contourf([data, crs, interp]) Adds data to contourfill on the map.
set_data([data, crs, interp, overplot]) Adds data to the plot.
set_extend([extend]) Colorbar extensions: ‘neither’ | ‘both’ | ‘min’ | ‘max’
set_geometry([geometry, crs, text, ...]) Adds any Shapely geometry to the map.
set_levels([levels]) Levels you define.
set_lonlat_contours([interval, xinterval, ...]) Add longitude and latitude contours to the map.
set_nlevels([nlevels]) Automatic N levels.
set_plot_params([levels, nlevels, vmin, ...]) Shortcut to all parameters related to the plot.
set_points(x, y, **kwargs) Shortcut for set_geometry() accepting coordinates as input.
set_rgb([img, crs, interp, natural_earth]) Manually force to a rgb img
set_shapefile([shape, countries, oceans, rivers]) Add a shapefile to the plot.
set_text([x, y, text, crs]) Add a text to the map.
set_topography([topo, crs, relief_factor]) Add topographical shading to the map.
set_vmax([val]) Maximum level value.
set_vmin([val]) Mininum level value.
to_rgb() Transform the data to a RGB image and add topographical shading.
update(d) Update the properties of DataLevels from the dictionary d.
visualize([ax, title, orientation, ...]) Quick plot, useful for debugging.

Attributes

extend Clever getter.
levels Clever getter.
nlevels Clever getter.
norm Clever getter.
vmax Clever getter.
vmin Clever getter.