Skip to content

Commit 07b95ed

Browse files
committed
Remove column argument from put_strings function
1 parent fccedae commit 07b95ed

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

pygmt/clib/session.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def put_vector(self, dataset, column, vector):
792792
)
793793
)
794794

795-
def put_strings(self, dataset, column, strings):
795+
def put_strings(self, dataset, strings):
796796
"""
797797
Attach a numpy 1D array of dtype str as a column on a GMT dataset.
798798
@@ -813,8 +813,6 @@ def put_strings(self, dataset, column, strings):
813813
dataset : :class:`ctypes.c_void_p`
814814
The ctypes void pointer to a ``GMT_Dataset``. Create it with
815815
:meth:`~gmt.clib.Session.create_data`.
816-
column : int
817-
The column number of this vector in the dataset (starting from 0).
818816
strings : numpy 1d-array
819817
The array that will be attached to the dataset. Must be a 1d C
820818
contiguous array.
@@ -828,19 +826,16 @@ def put_strings(self, dataset, column, strings):
828826
"""
829827
c_put_strings = self.get_libgmt_func(
830828
"GMT_Put_Strings",
831-
argtypes=[ctp.c_void_p, ctp.c_uint, ctp.c_void_p, ctp.c_uint],
829+
argtypes=[ctp.c_void_p, ctp.c_uint, ctp.c_void_p, ctp.c_void_p],
832830
restype=ctp.c_int,
833831
)
834832

835833
gmt_type = self._check_dtype_and_dim(strings, ndim=1)
836834
strings_pointer = strings.ctypes.data_as(ctp.c_void_p)
837-
status = c_put_strings(
838-
self.session_pointer, dataset, column, gmt_type, strings_pointer
839-
)
835+
status = c_put_strings(self.session_pointer, dataset, gmt_type, strings_pointer)
840836
if status != 0:
841837
raise GMTCLibError(
842-
f"Failed to put strings of type {strings.dtype}",
843-
f"in column {column} of dataset.",
838+
f"Failed to put strings of type {strings.dtype} into dataset"
844839
)
845840

846841
def put_matrix(self, dataset, matrix, pad=0):

pygmt/tests/test_clib_put.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_put_strings():
2121
dim=[1, 5, 1, 0], # columns, rows, layers, dtype
2222
)
2323
s = np.array(["a", "b", "c", "d", "e"], dtype=np.str)
24-
lib.put_strings(dataset, column=lib["GMT_TEXT"], strings=s)
24+
lib.put_strings(dataset, strings=s)
2525
# Turns out wesn doesn't matter for Datasets
2626
wesn = [0] * 6
2727
# Save the data to a file to see if it's being accessed correctly

0 commit comments

Comments
 (0)