easyclimate.plot.mpas.cell_contour

Contour plots for MPAS cell data.

Functions

plot_cell_contourf(ds, da, *[, ax, lon_min, lon_max, ...])

Draw filled contour for MPAS cell-centered scalar field.

plot_cell_contour(ds, da, *[, ax, lon_min, lon_max, ...])

Draw contour lines for MPAS cell-centered scalar field.

Module Contents

easyclimate.plot.mpas.cell_contour.plot_cell_contourf(ds, da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, auto_extent=True, extent_margin=0.05, contour_margin=0.05, global_plot=False, center_lon=None, levels=10, cmap=None, vmin=None, vmax=None, symmetric=False, percentile=98, extend=None, max_triangle_edge=None, input_radians=True, transform=None, add_colorbar=True, cbar_kwargs=None, title=None, lon_name_cell='lonCell', lat_name_cell='latCell', lon_name_vertex='lonVertex', lat_name_vertex='latVertex', use_triangulation_cache=True)

Draw filled contour for MPAS cell-centered scalar field.

The scalar values are drawn from MPAS cell centers using matplotlib.tri.Triangulation.

Parameters

dsxarray.Dataset

MPAS dataset containing cell and vertex coordinate variables.

daxarray.DataArray or numpy.ndarray

Cell-centered scalar values. The data must be one-dimensional on nCells after any time or vertical-level selection.

axmatplotlib.axes.Axes, optional

Axes on which to draw. By default, use the current axes.

lon_min, lon_max, lat_min, lat_maxfloat, optional

Plot extent in degrees. Cross-dateline longitude windows are supported.

auto_extentbool, default: True

If True and no explicit extent is supplied, infer the extent from valid cell centers.

extent_marginfloat, default: 0.05

Fractional margin added to the automatically inferred extent.

contour_marginfloat, default: 0.05

Fractional padding used when selecting source cells for contouring.

global_plotbool, default: False

If True, draw a global extent centered on center_lon.

center_lonfloat, optional

Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.

levelsint or array-like, default: 10

Number of contour levels, or explicit level values.

cmapstr or matplotlib.colors.Colormap, optional

Colormap used for filled contours.

vmin, vmaxfloat, optional

Color/data limits used by contour levels and color mapping. If one side is omitted, infer it from selected finite values.

symmetricbool, default: False

If True, infer symmetric limits around zero when vmin or vmax is omitted.

percentilefloat, default: 98

Percentile used for automatic color-limit inference.

extend{“neither”, “both”, “min”, “max”}, optional

Colorbar extension mode. If None, infer it from data and levels.

max_triangle_edgefloat, optional

Maximum accepted edge length for triangles. Longer triangles are masked.

input_radiansbool, default: True

If True, MPAS longitude and latitude variables are interpreted as radians and converted to degrees.

transformcartopy.crs.CRS, optional

Coordinate reference system of the input coordinates for Cartopy axes.

add_colorbarbool, default: True

If True, add a colorbar for the filled contour set.

cbar_kwargsdict, optional

Keyword arguments passed to Figure.colorbar.

titlestr, optional

Axes title. If None, use the data long name.

lon_name_cell, lat_name_cell, lon_name_vertex, lat_name_vertexstr

MPAS coordinate variable names.

use_triangulation_cachebool, default: True

If True, cache the triangulation for repeated calls on the same mesh and extent.

Returns

matplotlib.contour.QuadContourSet

Filled contour set returned by Axes.tricontourf.

MPAS Cell-centered contour plots

MPAS Cell-centered contour plots
easyclimate.plot.mpas.cell_contour.plot_cell_contour(ds, da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, auto_extent=True, extent_margin=0.05, contour_margin=0.05, global_plot=False, center_lon=None, levels=10, colors=None, linewidths=0.8, linestyles=None, cmap=None, vmin=None, vmax=None, symmetric=False, percentile=98, extend=None, max_triangle_edge=None, input_radians=True, transform=None, title=None, lon_name_cell='lonCell', lat_name_cell='latCell', lon_name_vertex='lonVertex', lat_name_vertex='latVertex', use_triangulation_cache=True)

Draw contour lines for MPAS cell-centered scalar field.

Labels are not added automatically. Add them outside this function with ax.clabel(cs, inline=True, fontsize=8, fmt="%g").

Parameters

dsxarray.Dataset

MPAS dataset containing cell and vertex coordinate variables.

daxarray.DataArray or numpy.ndarray

Cell-centered scalar values. The data must be one-dimensional on nCells after any time or vertical-level selection.

axmatplotlib.axes.Axes, optional

Axes on which to draw. By default, use the current axes.

lon_min, lon_max, lat_min, lat_maxfloat, optional

Plot extent in degrees. Cross-dateline longitude windows are supported.

auto_extentbool, default: True

If True and no explicit extent is supplied, infer the extent from valid cell centers.

extent_marginfloat, default: 0.05

Fractional margin added to the automatically inferred extent.

contour_marginfloat, default: 0.05

Fractional padding used when selecting source cells for contouring.

global_plotbool, default: False

If True, draw a global extent centered on center_lon.

center_lonfloat, optional

Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.

levelsint or array-like, default: 10

Number of contour levels, or explicit level values.

colorscolor or collections.abc.Sequence of colors, optional

Fixed line colors passed to Axes.tricontour. If omitted, use cmap.

linewidths, linestyles

Contour line style options passed to Axes.tricontour.

cmapstr or matplotlib.colors.Colormap, optional

Colormap used when colors is not supplied.

vmin, vmaxfloat, optional

Data limits used by contour levels and color mapping.

symmetricbool, default: False

If True, infer symmetric limits around zero when vmin or vmax is omitted.

percentilefloat, default: 98

Percentile used for automatic data-limit inference.

extend{“neither”, “both”, “min”, “max”}, optional

Contour extension mode. If None, infer it from data and levels.

max_triangle_edgefloat, optional

Maximum accepted edge length for triangles. Longer triangles are masked.

input_radiansbool, default: True

If True, MPAS longitude and latitude variables are interpreted as radians and converted to degrees.

transformcartopy.crs.CRS, optional

Coordinate reference system of the input coordinates for Cartopy axes.

titlestr, optional

Axes title. If None, use the data long name.

lon_name_cell, lat_name_cell, lon_name_vertex, lat_name_vertexstr

MPAS coordinate variable names.

use_triangulation_cachebool, default: True

If True, cache the triangulation for repeated calls on the same mesh and extent.

Returns

matplotlib.contour.QuadContourSet

Contour set returned by Axes.tricontour.

MPAS Cell-centered contour plots

MPAS Cell-centered contour plots