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_data first with family="GMT_IS_DATASET|GMT_VIA_VECTOR".

Not all numpy dtypes are supported, only: int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, str_, and datetime64.

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 (c_void_p) – The ctypes void pointer to a GMT_VECTOR data container. Create it with pygmt.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_Vector exits with a non-zero status.