pygmt.clib.Session.put_vector
- Session.put_vector(dataset, column, vector)[source]
Attach a 1-D numpy array as a column on a GMT dataset.
Use this function to attach numpy array data to a GMT dataset and pass it to GMT modules. Wraps
GMT_Put_Vector.The dataset must be created by
pygmt.clib.Session.create_datafirst withfamily="GMT_IS_DATASET|GMT_VIA_VECTOR".Not all numpy dtypes are supported, only: int8, int16, int32, int64, longlong, uint8, uint16, uint32, uint64, ulonglong, float32, float64, str_, datetime64, and timedelta64.
Warning
The numpy array must be C contiguous in memory. Use
numpy.ascontiguousarrayto 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_VECTORdata container. Create it withpygmt.clib.Session.create_data.column (
int) – The column number of this vector in the dataset (starting from 0).vector (
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_Vectorexits with a non-zero status.- Return type: