pygmt.clib.Session.put_matrix
- Session.put_matrix(dataset, matrix, pad=0)[source]
Attach a numpy 2D array to a GMT dataset.
Use this function to attach numpy array data to a GMT dataset and pass it to GMT modules. Wraps
GMT_Put_Matrix
.The dataset must be created by
pygmt.clib.Session.create_data
first. Use|GMT_VIA_MATRIX'
in the family.Not all numpy dtypes are supported, only: int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32 and float64.
Warning
The numpy array must be C contiguous in memory. 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 aGMT_Dataset
. Create it withpygmt.clib.Session.create_data
.matrix (numpy 2d-array) – The array that will be attached to the dataset. Must be a 2d C contiguous array.
pad (int) – The amount of padding that should be added to the matrix. Use when creating grids for modules that require padding.
- Raises
GMTCLibError – If given invalid input or
GMT_Put_Matrix
exits with status != 0.