polaris.viz.plot_global_mpas_field

polaris.viz.plot_global_mpas_field(da, out_filename, config, colormap_section, mesh_filename=None, title=None, dpi=None, plot_land=True, colorbar_label='', central_longitude=0.0, fig_width=None, fig_height=None, patch_edge_color=None, descriptor=None, projection_name='PlateCarree', cell_indices=None, ds_transect=None, enforce_aspect_ratio=False, extent=None, circular_boundary=False, mesh_ds=None)[source]

Plots a data set as a longitude-latitude map

Parameters:
  • mesh_filename (str, optional) – A filename containing the MPAS mesh, with MPAS dimension and variable names. Give mesh_ds instead for a mesh that needs to be read in some other way.

  • da (xarray.DataArray) – The horizontal field to plot

  • out_filename (str) – The image file name to be written

  • config (polaris.config.PolarisConfigParser) – The config options to use for colormap settings

  • colormap_section (str) –

    The name of a section in the config options. Options must include:

    colormap_name

    The name of the colormap

    norm_type

    The norm: {‘linear’, ‘log’}

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

  • plot_land (bool) – Whether to plot continents over the data

  • colorbar_label (str, optional) – Label on the colorbar

  • central_longitude (float, optional) – The longitude of the center of the plot

  • fig_width (float, optional) – The width of the figure in inches. The height is whatever leaves no empty canvas above and below the map, which depends on the projection, the extent and the title. Defaults to 8 if neither fig_width nor fig_height is given.

  • fig_height (float, optional) – The height of the figure in inches, as an alternative to fig_width. The width is then whatever leaves no empty canvas to either side of the map and its colorbar.

  • dpi (int, optional) – Dots per inch for the output plot

  • patch_edge_color (str, optional) – The color of patch edges (if not the same as the face)

  • descriptor (mosaic.Descriptor, optional) – Descriptor from a previous call to plot_global_mpas_field(). It is only valid for the mesh, cell_indices, projection_name and central_longitude it was made with.

  • projection_name (str, optional) – Name of the projection supported by mosaic

  • cell_indices (integer array, optional) – Indices corresponding to which cells in the array to plot

  • ds_transect (xr.Dataset, optional) – Transect dataset produced by mpas_tools which will be traced on the global field

  • enforce_aspect_ratio (logical, optional) – Whether to enforce the aspect ratio of the figure according to lat, lon bounds. The bounds come from the mesh, so mesh_filename or mesh_ds is needed even if descriptor is given

  • extent (tuple of float, optional) – The (lon_min, lon_max, lat_min, lat_max) the map covers, in degrees. The map is scaled to the data being plotted if this is not given.

  • circular_boundary (bool, optional) – Whether to clip the map to a circle inscribed in the axes, which is how a polar stereographic map of everything poleward of some latitude is drawn. Meaningless without extent

  • mesh_ds (xarray.Dataset, optional) – The MPAS mesh, as an alternative to mesh_filename. It must use MPAS dimension and variable names, so a component whose model writes its own names must map them before passing the mesh in.

Returns:

descriptor (mosaic.Descriptor) – For reuse with future plots. Patches are cached, so the Descriptor only needs to be created once per mesh file.