|
16 | 16 | import numpy as np
|
17 | 17 | import pandas as pd
|
18 | 18 | import xarray as xr
|
19 |
| -from pygmt._typing import StringArrayTypes |
20 | 19 | from pygmt.clib.conversion import (
|
21 | 20 | array_to_datetime,
|
22 | 21 | dataarray_to_matrix,
|
@@ -1000,40 +999,39 @@ def put_vector(self, dataset: ctp.c_void_p, column: int, vector: np.ndarray):
|
1000 | 999 | )
|
1001 | 1000 | raise GMTCLibError(msg)
|
1002 | 1001 |
|
1003 |
| - def put_strings( |
1004 |
| - self, dataset: ctp.c_void_p, family: str, strings: StringArrayTypes |
1005 |
| - ): |
| 1002 | + def put_strings(self, dataset: ctp.c_void_p, family: str, strings: np.ndarray): |
1006 | 1003 | """
|
1007 |
| - Attach a 1-D numpy array of dtype str or pyarrow.StringArray as a column on a |
1008 |
| - GMT dataset. |
| 1004 | + Attach a numpy 1-D array of dtype str as a column on a GMT dataset. |
1009 | 1005 |
|
1010 |
| - Use this function to attach string type numpy array data to a GMT dataset and |
1011 |
| - pass it to GMT modules. Wraps ``GMT_Put_Strings``. |
| 1006 | + Use this function to attach string type numpy array data to a GMT |
| 1007 | + dataset and pass it to GMT modules. Wraps ``GMT_Put_Strings``. |
1012 | 1008 |
|
1013 |
| - The dataset must be created by :meth:`pygmt.clib.Session.create_data` first. |
| 1009 | + The dataset must be created by :meth:`pygmt.clib.Session.create_data` |
| 1010 | + first. |
1014 | 1011 |
|
1015 | 1012 | .. warning::
|
1016 |
| - The numpy array must be C contiguous in memory. If it comes from a column |
1017 |
| - slice of a 2-D array, for example, you will have to make a copy. Use |
1018 |
| - :func:`numpy.ascontiguousarray` to make sure your vector is contiguous (it |
1019 |
| - won't copy if it already is). |
| 1013 | + The numpy array must be C contiguous in memory. If it comes from a |
| 1014 | + column slice of a 2-D array, for example, you will have to make a |
| 1015 | + copy. Use :func:`numpy.ascontiguousarray` to make sure your vector |
| 1016 | + is contiguous (it won't copy if it already is). |
1020 | 1017 |
|
1021 | 1018 | Parameters
|
1022 | 1019 | ----------
|
1023 |
| - dataset |
1024 |
| - The ctypes void pointer to a ``GMT_VECTOR``/``GMT_MATRIX`` data container. |
1025 |
| - Create it with :meth:`pygmt.clib.Session.create_data`. |
1026 |
| - family |
| 1020 | + dataset : :class:`ctypes.c_void_p` |
| 1021 | + The ctypes void pointer to a ``GMT_Dataset``. Create it with |
| 1022 | + :meth:`pygmt.clib.Session.create_data`. |
| 1023 | + family : str |
1027 | 1024 | The family type of the dataset. Can be either ``GMT_IS_VECTOR`` or
|
1028 | 1025 | ``GMT_IS_MATRIX``.
|
1029 |
| - strings |
1030 |
| - The array that will be attached to the dataset. Must be a 1-D C contiguous |
1031 |
| - array. |
| 1026 | + strings : numpy 1-D array |
| 1027 | + The array that will be attached to the dataset. Must be a 1-D C |
| 1028 | + contiguous array. |
1032 | 1029 |
|
1033 | 1030 | Raises
|
1034 | 1031 | ------
|
1035 | 1032 | GMTCLibError
|
1036 |
| - If given invalid input or ``GMT_Put_Strings`` exits with a non-zero status. |
| 1033 | + If given invalid input or ``GMT_Put_Strings`` exits with |
| 1034 | + status != 0. |
1037 | 1035 | """
|
1038 | 1036 | c_put_strings = self.get_libgmt_func(
|
1039 | 1037 | "GMT_Put_Strings",
|
|
0 commit comments