-
Notifications
You must be signed in to change notification settings - Fork 235
Description
Plotting of projected images using xarray and/or pyshtools
It would be desirable to add a method such as plot_gmt() or gmt.plot() to xarray DataArrays and pyshtools SHGrids (the latter of which are easily converted to DataArrays). Through a single command, it would thus be possible to create a publication quality projected image. Such a built in method would have a set of default plotting parameters defined, and would require only minimal modifications on the part of the user.
pyshtools implementation
I have just made a pull request at pyshtools SHTOOLS/SHTOOLS#203 which is a first attempt of plotting global grids. This method implements all global and hemispherical projects, and latter will be updated to work with non-global projections. By simply calling plot_gmt() a global mollweide projected image is created.
This method defines a large number of human-readable parameters that differ from the standard gmt syntax (which is only understandable by an expert), but also differs in places by what pygmt uses. Ideally, it would be useful if we could try to standardize the syntax among the various gmt-related projects. Here is what I am currently using, but I could be easily convinced to change these:
projection: The name of a global or hemispherical projection (see Notes). Only the first three characters are necessary to identify the projection.region: The map region, consisting of a list [West, East, South, North] in degrees. The default 'g' specifies the entire sphere.width: The wdith of the projected image.unit: The measurement unit of the figure width and shift_origin: 'i' for inches or 'c' for cm.longitude: The central meridian or center of the projection.latitude: The center of the projection for some hemispheric projections.grid: If True, plot grid lines.grid_interval: Grid line interval [latitude, longitude] in degrees.annotate: If True, plot annotation labels on axes.annotate_interval: Annotation label interval [latitude, longitude] in degrees.ticks: If True, plot ticks on axes.tick_interval: Tick interval [latitude, longitude] in degrees.axes: Specify which plot axes should be drawn and annotated. Capital letters draw the axes, ticks, and annotations, whereas small letters draw only the axes and ticks.title: The title to be displayed above the plot.cmap: The color map to use when plotting the data and colorbar.cmap_reverse: Set to True to reverse the sense of the color progression in the color table.continuous: If True, create a continuous colormap. Default behavior is to use contant colors for each interval.limits: A list containing the lower and upper limits of the data to be used with the color map, and optionally an interval.colorbar: If True, plot a colorbar.cb_orientation: Orientation of the colorbar; either 'h' or 'v' for horizontal or vertical, respectively.cb_triangles: Add triangles to the edges of the colorbar for background 'b' and/or foreground 'f' colors.cb_label: Text label for the colorbar.cb_ylabel: Text label for the y axis of the colorbarcb_annotate: If True, plot annotation labels on the colorbar.cb_annotate_interval: Annotation interval on the colorbar.cb_ticks: If True, plot ticks on the colorbar.cb_tick_interval: Colorbar tick interval.shift_origin: Offset of the plot in the x and y directions from the origin.fname: If present, save the image to the specified file.