pygmt.clib.Session.call_module

Session.call_module(module, args)[source]

Call a GMT module with the given arguments.

Wraps GMT_Call_Module.

The GMT_Call_Module API function supports passing module arguments in three different ways:

  1. Pass a single string that contains whitespace-separated module arguments.

  2. Pass a list of strings and each string contains a module argument.

  3. Pass a list of GMT_OPTION data structure.

Both options 1 and 2 are implemented in this function, but option 2 is preferred because it can correctly handle special characters like whitespaces and quotation marks in module arguments.

Parameters:
  • module (str) – The GMT module name to be called ("coast", "basemap", etc).

  • args (str | list[str]) – Module arguments that will be passed to the GMT module. It can be either a single string (e.g., "-R0/5/0/10 -JX10c -BWSen+t'My Title'") or a list of strings (e.g., ["-R0/5/0/10", "-JX10c", "-BWSEN+tMy Title"]).

Raises:
  • GMTInvalidInput – If the args argument is not a string or a list of strings.

  • GMTCLibError – If the returned status code of the function is non-zero.