Session.create(self, name)[source]

Create a new GMT C API session.

This is required before most other methods of pygmt.clib.Session can be called.


Usage of Session as a context manager in a with block is preferred over calling create and destroy manually.

Calls GMT_Create_Session and generates a new GMTAPI_CTRL struct, which is a ctypes.c_void_p pointer. Sets the session_pointer attribute to this pointer.

Remember to terminate the current session using pygmt.clib.Session.destroy before creating a new one.

name : str

A name for this session. Doesn’t really affect the outcome.