pycsa.plotting.cart_plot

Contains functions for regional limited-area plots.

Requires the cartopy package.

Functions

error_delaunay(topo, tri[, fs, label_idxs, ...])

Plots the Delaunay triangulation of a lat-lon domain with the correponding errors.

lat_lon(topo[, fs, int, colorbar_margins])

Does a simple Plate-Carre projection of a lat-lon topography data.

lat_lon_delaunay(topo, tri, levels[, fs, ...])

Plots a Plate-Carrée projection of the topography with a Delunay triangulated grid.

lat_lon_icon(topo, triangles[, fs, ...])

Plots the topography given an ICON grid.

pycsa.plotting.cart_plot.lat_lon(topo, fs=(10, 6), int=1, colorbar_margins=None)

Does a simple Plate-Carre projection of a lat-lon topography data.

Parameters:
  • topo (topo object exposing lon_grid/lat_grid/topo) – topography container; lon_grid and lat_grid hold the coordinate grids and topo holds the 2D elevation array

  • fs (tuple, optional) – figure size, by default (10,6)

  • int (int, optional) – for high-resolution datasets, do we only plot every int pixel? By default 1, i.e., everything is plotted.

  • colorbar_margins (list, optional) – [left, bottom, width, height] axes rectangle for the colorbar, passed to matplotlib.figure.Figure.add_axes(). By default None, in which case [0.99, 0.22, 0.025, 0.55] is used.

pycsa.plotting.cart_plot.lat_lon_delaunay(topo, tri, levels, fs=(8, 4), label_idxs=False, highlight_indices=[44, 45, 88, 89, 16, 17], fn='../output/delaunay.pdf', output_fig=False, int=1, raster=False)

Plots a Plate-Carrée projection of the topography with a Delunay triangulated grid.

Parameters:
  • topo (topo object exposing lon_grid/lat_grid/topo) – topography container; lon_grid and lat_grid hold the coordinate grids and topo holds the 2D elevation array

  • tri (scipy.spatial.Delaunay) – instance of the scipy Delaunay triangulation object containing tuples of the three vertice coordinates of a triangle

  • levels (list) – user-defined elevation levels for the plot

  • fs (tuple, optional) – figure size, by default (8,4)

  • label_idxs (bool, optional) – toggles triangle index labels, by default False

  • highlight_indices (list, optional) – triangle indices to highlight (drawn bold in red) when label_idxs is True, by default [44, 45, 88, 89, 16, 17]

  • fn (str, optional) – path to write the output figure, by default “../output/delaunay.pdf”

  • output_fig (bool, optional) – toggles writing of the output figure, by default False

  • int (int, optional) – plot only every int pixel of the topography, by default 1 (full resolution)

  • raster (bool, optional) – rasterize the filled-contour topography for smaller vector output, by default False

pycsa.plotting.cart_plot.error_delaunay(topo, tri, fs=(8, 4), label_idxs=False, highlight_indices=[44, 45, 88, 89, 16, 17], fn='../output/delaunay.pdf', output_fig=False, iint=1, errors=None, alpha_max=0.5, v_extent=[-25.0, 25.0], raster=True, fontsize=12)

Plots the Delaunay triangulation of a lat-lon domain with the correponding errors.

Parameters:
  • topo (topo object exposing lon_grid/lat_grid/topo) – topography container; lon_grid and lat_grid hold the coordinate grids and topo holds the 2D elevation array

  • tri (scipy.spatial.Delaunay object) – instance of the scipy Delaunay triangulation object containing tuples of the three vertice coordinates of a triangle

  • fs (tuple, optional) – figure size, by default (8,4)

  • label_idxs (bool, optional) – toggles index labels, by default False

  • highlight_indices (list, optional) – toggles highlighting of given indices, by default [44,45, 88,89, 16,17]

  • fn (str, optional) – output file name, by default ‘../output/delaunay.pdf’

  • output_fig (bool, optional) – toggles writing of output figure, by default False

  • iint (int, optional) – how many data points to skip in plotting the topography, by default 1, i.e., the full resolution is used.

  • errors (list, optional) – list of errors computed within each triangle, by default None

  • alpha_max (float, optional) – alpha of the error overlay, by default 0.5

  • v_extent (list, optional) – vertical extent of the error, by default [-25.0, 25.0]

  • raster (bool, optional) – toggles vector or raster output, by default True

  • fontsize (int, optional) – fontsize, by default 12

pycsa.plotting.cart_plot.lat_lon_icon(topo, triangles, fs=(10, 6), annotate_idxs=True, title='', set_global=False, fn='../output/icon_lam.pdf', output_fig=False, **kwargs)

Plots the topography given an ICON grid.

Parameters:
  • topo (topo object exposing lon_grid/lat_grid/topo) – topography container; lon_grid and lat_grid hold the coordinate grids and topo holds the 2D elevation array

  • triangles (list) – list containing tuples of the three vertice coordinates of a triangle

  • fs (tuple, optional) – figure size, by default (10, 6)

  • annotate_idxs (bool, optional) – annotate each cell with its index; requires ncells, clon and clat to be supplied via **kwargs, by default True

  • title (str, optional) – figure title, by default “”

  • set_global (bool, optional) – set the axes to span the whole globe, by default False

  • fn (str, optional) – path to write the output figure, by default “../output/icon_lam.pdf”

  • output_fig (bool, optional) – toggles writing of the output figure, by default False

  • **kwargs (dict, optional) – extra keyword arguments. When annotate_idxs is True, the following are required: ncells (int, number of cells), clon (array-like, cell-center longitudes) and clat (array-like, cell-center latitudes).