pygmt.clib.Session.create

Session.create(name)[source]

Create a new GMT C API session.

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

Warning

Usage of pygmt.clib.Session as a context manager in a with block is preferred over calling pygmt.clib.Session.create and pygmt.clib.Session.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.

Parameters:

name (str) – A name for this session. Doesn’t really affect the outcome.