nc5ng.gmt GMT Wrapper API

PyPi Package: nc5ng-common

GMT Wrapper Library and Convenience Methods for nc5ng

GMT Options

GMTOptions form a loose wrapper on the GMT command line arguments and GMT/Python shorthands

It is a subtype of dict but has additional properties for creating appropirate GMT arguments

class nc5ng.gmt.GMTOptions(projection='M10.0i', region=[240, 190, 30, 80], frame=True, insert=None, border=None, scale=None, dir_rose=None, mag_rose=None, logo=False, area_thresh=None, lakes=None, resolution='c', land=None, rivers=None, borders=None, water=None, shorelines=1, linear_lines=False, cpt=None, offset=None, errors=None, color=None, symbol=None, pen=None, basemap=None, coast=None, plot=None, **kwargs)[source]

GMTOptions are decorated dictionaries to wrap GMT/Python Keyword options

GMTOptions takes keywords or other dictionary to construct gmt plot options for basemap, coast, plot via properties GMTOptions.basemap, .coast .plot

GMT Options can be combined (copy-combine) by calling one with the other

p1 = GMTOptions(lakes=0) p2 = GMTOptions(**PLOT_OPTS[‘default’])

p3 = p2(p1) # override default by turning off lakes


GMTOptions do not track single letter GMT Arguments, because ambiguous double-mappings exist (e.g. -A means different things to coast vs plot).

Instead, single letter options can be overriden as keyword arguments to GMTPlotter

GMT Plotter

GMTPlotter forms a loose wrapper around gmt.Figure object, that constructs plots from embedded gmt options inside nc5ng objects (meta-api, object.gmt_meta)

class nc5ng.gmt.plotter.GMTPlotter(base_plot_options={'__class__': <class 'nc5ng.gmt.options.GMTOptions'>, 'area_thresh': 1200, 'basemap': None, 'border': None, 'borders': ['1', '2'], 'coast': None, 'color': None, 'cpt': None, 'dir_rose': None, 'errors': None, 'frame': True, 'insert': None, 'kwargs': {}, 'lakes': None, 'land': None, 'linear_lines': False, 'logo': False, 'mag_rose': None, 'offset': None, 'pen': None, 'plot': None, 'projection': 'M10.0i', 'region': [240, 190, 30, 80], 'resolution': 'fine', 'rivers': None, 'scale': None, 'self': {'pen': None, 'self': {...}, 'projection': 'M10.0i', 'plot': None, '__class__': <class 'nc5ng.gmt.options.GMTOptions'>, 'shorelines': 1, 'lakes': None, 'scale': None, 'logo': False, 'insert': None, 'offset': None, 'kwargs': {}, 'frame': True, 'cpt': None, 'rivers': None, 'borders': ['1', '2'], 'border': None, 'symbol': None, 'basemap': None, 'color': None, 'linear_lines': False, 'area_thresh': 1200, 'water': 'lightblue', 'coast': None, 'resolution': 'fine', 'errors': None, 'dir_rose': None, 'region': [240, 190, 30, 80], 'land': None, 'mag_rose': None}, 'shorelines': 1, 'symbol': None, 'water': 'lightblue'})[source]

Wrapper for GMT/Python Plotter

static plot_conversion(conversion, coverage='all', vector='all', plotter=None, **kwargs)[source]

Static Method to Plot an nc5ng.nc5data.Conversion

Plotting options are Applied in the order

  1. GMTPlotter configured or default options
  2. Conversion configured options Conversion.gmt_meta
  3. Data Set Options PointData.gmt_meta
  4. Keyword overrides (full option name)
  5. Keyowrd overrides (single letter GMT Style arguments)
  • conversion – Conversion data
  • coverage – Coverage files (no file extension), to plot. Can be list of names (coverage = ['cvacdlat','cvacdlon',]), single file name (coverage = 'cvacdlat'), None, or 'all'
  • vector – Vector files (no file extension) to plot. Can be list of names, single file name, None, or 'all'.
  • plotter – plotter to use, if None one will be created and returned