pygmt.clib.Session.put_strings
- Session.put_strings(dataset, family, strings)[source]
Attach a 1-D numpy 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 (
c_void_p
) – The ctypes void pointer to aGMT_VECTOR
/GMT_MATRIX
data container. Create it withpygmt.clib.Session.create_data
.family (
str
) – The family type of the dataset. Can be eitherGMT_IS_VECTOR
orGMT_IS_MATRIX
.strings (
ndarray
) – 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 a non-zero status.