pygmt.clib.Session.put_strings

Session.put_strings(dataset, family, strings)[source]

Attach a numpy 1-D array of dtype str as a column on a GMT dataset.

Use this function to attach string type numpy array data to a GMT dataset and pass it to GMT modules. Wraps GMT_Put_Strings.

The dataset must be created by pygmt.clib.Session.create_data first.

Warning

The numpy array must be C contiguous in memory. If it comes from a column slice of a 2-D array, for example, you will have to make a copy. Use numpy.ascontiguousarray to make sure your vector is contiguous (it won’t copy if it already is).

Parameters:
  • dataset (ctypes.c_void_p) – The ctypes void pointer to a GMT_Dataset. Create it with pygmt.clib.Session.create_data.

  • family (str) – The family type of the dataset. Can be either GMT_IS_VECTOR or GMT_IS_MATRIX.

  • strings (numpy 1-D array) – The array that will be attached to the dataset. Must be a 1-D C contiguous array.

Raises:

GMTCLibError – If given invalid input or GMT_Put_Strings exits with status != 0.