pygmt.clib.Session.put_vector

Session.put_vector(dataset, column, vector)[source]

Attach a numpy 1D 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 create_data first. Use family='GMT_IS_DATASET|GMT_VIA_VECTOR'.

Not at all numpy dtypes are supported, only: float64, float32, int64, int32, uint64, and uint32.

Warning

The numpy array must be C contiguous in memory. If it comes from a column slice of a 2d 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 create_data.

  • column (int) – The column number of this vector in the dataset (starting from 0).

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

Raises

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