Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

But so far, my attempts to use this to plot data that wraps around the dateline has resulted in garbage.

pyNGL has a similar capability, but fill styles seem to be a little more limited (or maybe just not as well documented). Setting sfXarray and sfYArray instead of sfXCellBounds and sfYCellBounds, and choosing a fill other than CellFill will force pyNGL to do a similar triangulation. The different fill options available are AreaFill and RasterFill. RasterFill with a low resolution grid produces a similar result to the dual grid methods above, with a solid fill around each GLL node:

...

There is an option to “smooth” using RasterFill by setting cnRasterSmoothingOn = True. From the NCL documentation:

If cnRasterSmoothingOn is set True, the level (and hence the color) assigned to each cell is determined by interpolating the values of neighboring points in the data grid. If cnRasterSmoothingOn is False, ContourPlot creates a discrete raster plot: any raster cell whose center lies within the rectangular area bounded by lines halfway between each grid point (in data space) is given the color assigned to the level representing the grid point datum.

By default, setting this to True gives the appearance of a contour plot rather than a smoothed raster plot:

...

We can get back to something closer to the “gouraud” fill that mpl uses by significantly increasing the number of “contour” levels by adjusting res.cnLevelSpacingF (and also res.lbLabelStride in order to make sure labels are not on top of each other). In this case, we’ve adjusted res.cnLevelSpacingF = 0.0001 and res.lbLabelStride = 10:

...