mpas_analysis.shared.plot.plot_vertical_section_comparison

mpas_analysis.shared.plot.plot_vertical_section_comparison(config, modelArray, refArray, diffArray, colorMapSectionName, xCoords=None, zCoord=None, triangulation_args=None, xOutlineModel=None, zOutlineModel=None, xOutlineRef=None, zOutlineRef=None, xOutlineDiff=None, zOutlineDiff=None, colorbarLabel=None, xlabels=None, ylabel=None, title=None, modelTitle='Model', refTitle='Observations', diffTitle='Model-Observations', titleFontSize=None, defaultFontSize=None, plotTitleFontSize=None, axisFontSize=None, figsize=None, dpi=None, lineWidth=2, lineStyle='solid', lineColor='black', backgroundColor='grey', invalidColor='white', outlineValid=True, xLim=None, yLim=None, numUpperTicks=None, upperXAxisTickLabelPrecision=None, invertYAxis=True, xCoordIsTime=False, movingAveragePoints=None, firstYearXTicks=None, yearStrideXTicks=None, maxXTicks=20, calendar='gregorian', compareAsContours=False, comparisonContourLineStyle=None, comparisonContourLineColor=None, labelContours=False, contourLabelPrecision=1, resultSuffix='Result', diffSuffix='Difference', maxTitleLength=70)[source]

Plots vertical section plots in a three-panel format, comparing model data (in modelArray) to some reference dataset (in refArray), which can be either observations or an alternative model, and also presenting the difference plot of the two. If refArray is None, then only one panel is plotted, displaying the model data.

If compareAsContours is true, the contours of modelArray and refArray are plotted on a single plot.

Parameters
  • config (instance of ConfigParser) – the configuration, containing a [plot] section with options that control plotting

  • modelArray (xarray.DataArray) – model and observational or control run data sets

  • refArray (xarray.DataArray) – model and observational or control run data sets

  • diffArray (float array) – difference between modelArray and refArray

  • xCoords (xarray.DataArray or list of xarray.DataArray, optional) – The x coordinate(s) for the model, ref and diff arrays. Optional second and third entries will be used for a second and third x axis above the plot. The typical use for the second and third axis is for transects, for which the primary x axis represents distance along a transect, and the second and third x axes are used to display the corresponding latitudes and longitudes.

  • zCoord (xarray.DataArray, optional) – The z coordinates for the model, ref and diff arrays

  • triangulation_args (dict, optional) – A dict of arguments to create a matplotlib.tri.Triangulation of the transect that does not rely on it being on a logically rectangular grid. The arguments rather than the triangulation itself are passed because multiple triangulations with different masks are needed internally and there is not an obvious mechanism for copying an existing triangulation. If this option is provided, xCoords is only used for tick marks if more than one x axis is requested, and zCoord will be ignored.

  • xOutlineModel (numpy.ndarray, optional) – pairs of points defining line segments that are used to outline the valid region of the mesh for the model panel if outlineValid = True and triangulation_args is not None

  • zOutlineModel (numpy.ndarray, optional) – pairs of points defining line segments that are used to outline the valid region of the mesh for the model panel if outlineValid = True and triangulation_args is not None

  • xOutlineRef (numpy.ndarray, optional) – Same as xOutlineModel and zOutlineModel but for the reference panel

  • zOutlineRef (numpy.ndarray, optional) – Same as xOutlineModel and zOutlineModel but for the reference panel

  • xOutlineDiff (numpy.ndarray, optional) – Same as xOutlineModel and zOutlineModel but for the difference panel

  • zOutlineDiff (numpy.ndarray, optional) – Same as xOutlineModel and zOutlineModel but for the difference panel

  • colorMapSectionName (str) – section name in config where color map info can be found.

  • colorbarLabel (str, optional) – the label for the colorbar. If compareAsContours and labelContours are both True, colorbarLabel is used as follows (typically in order to indicate the units that are associated with the contour labels): if refArray is None, the colorbarLabel string is parenthetically appended to the plot title; if refArray is not None, it is parenthetically appended to the legend entries of the contour comparison plot.

  • xlabels (str or list of str, optional) – labels of x-axes. Labels correspond to entries in xCoords.

  • ylabel (str, optional) – label of y-axis

  • title (str, optional) – the subtitle of the plot

  • modelTitle (str, optional) – title of the model panel

  • refTitle (str, optional) – title of the observations or control run panel

  • diffTitle (str, optional) – title of the difference (bias) panel

  • titleFontSize (int, optional) – size of the title font

  • defaultFontSize (int, optional) – the size of text other than the title

  • plotTitleFontSize (int, optional) – size of the title font for the individual plots

  • axisFontSize (int, optional) – size of the axis font

  • figsize (tuple of float, optional) – the size of the figure in inches

  • dpi (int, optional) – the number of dots per inch of the figure, taken from section plot option dpi in the config file by default

  • lineWidth (int, optional) – the line width of contour lines (if specified)

  • lineStyle (str, optional) – the line style of contour lines (if specified); this applies to the contour lines on heatmaps and to the contour lines of the model field on contour comparison plots (the line style of the contour lines of the reference field on contour comparison plots is set using the contourComparisonLineStyle argument).

  • lineColor (str, optional) – the color of contour lines (if specified); this applies to the contour lines on heatmaps and to the contour lines of the model field on contour comparison plots (the line color of the contour lines of the reference field on contour comparison plots is set using the contourComparisonLineColor argument).

  • backgroundColor (str, optional) – the background color for the plot outside the limits of xCoord and zCoord.

  • invalidColor (str, optional) – the color for invalid values (NaNs and masked areas will be shown in this color)

  • outlineValid (bool, optional) – whether to outline the boundary between the valid an invalid regions with a black contour

  • xLim (float array, optional) – x range of plot

  • yLim (float array, optional) – y range of plot

  • numUpperTicks (the approximate number of ticks to use on the upper x axis) – or axes (these are the second and third x axes, which are placed above the plot if they have been requested by specifying the secondXAxisData or thirdXAxisData arrays above)

  • upperXAxisTickLabelPrecision (the number of decimal places (to the right) – of the decimal point) to use for values at upper axis ticks. This value can be adjusted (in concert with numUpperTicks) to avoid problems with overlapping numbers along the upper axis.

  • invertYAxis (logical, optional) – if True, invert Y axis

  • xCoordIsTime (logical, optional) – if True, format the x axis for time (this applies only to the primary x axis, not to the optional second or third x axes)

  • movingAveragePoints (int, optional) – the number of points over which to perform a moving average NOTE: this option is mostly intended for use when xCoordIsTime is True, although it will work with other data as well. Also, the moving average calculation is based on number of points, not actual x axis values, so for best results, the values in the xArray should be equally spaced.

  • firstYearXTicks (int, optional) – The year of the first tick on the x axis. By default, the first time entry is the first tick.

  • yearStrideXTicks (int, optional) – The number of years between x ticks. By default, the stride is chosen automatically to have maxXTicks tick marks or fewer.

  • maxXTicks (int, optional) – the maximum number of tick marks that will be allowed along the primary x axis. This may need to be adjusted depending on the figure size and aspect ratio. NOTE: maxXTicks is only used if xCoordIsTime is True

  • calendar (str, optional) – the calendar to use for formatting the time axis NOTE: calendar is only used if xCoordIsTime is True

  • compareAsContours (bool, optional) – if compareAsContours is True, instead of creating a three panel plot showing modelArray, refArray, and their difference, the function will plot the contours of modelArray and refArray on a single plot (unless refArray is None, in which case only the contours of modelArray will be plotted on the single panel plot).

  • comparisonContourLineStyle (str, optional) – the line style of contour lines of the reference field on a contour comparison plot

  • comparisonContourLineColor (str, optional) – the line color of contour lines of the reference field on a contour comparison plot

  • labelContours (bool, optional) – whether or not to label contour lines (if specified) with their values

  • contourLabelPrecision (int, optional) – the precision (in terms of number of figures to the right of the decimal point) of contour labels

  • resultSuffix (str, optional) – a suffix added to the config options related to colormap information for the main and control fields

  • diffSuffix (str, optional) – a suffix added to the config options related to colormap information for the difference field

  • maxTitleLength (int, optional) – the maximum number of characters in the title, beyond which it is truncated with a trailing ellipsis

Returns

  • fig (matplotlib.figure.Figure) – The figure that was plotted

  • axes (list of matplotlib.axes.Axes) – The subplots

  • suptitle (matplotlib.text.Text) – The super-title