Skip to content

Commit cb910a1

Browse files
committed
Initial support for passing strings to GMT via GMT_Put_Vectors
1 parent 30728fd commit cb910a1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pygmt/clib/session.py

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
np.uint64: "GMT_ULONG",
6060
np.uint32: "GMT_UINT",
6161
np.datetime64: "GMT_DATETIME",
62+
np.str_: "GMT_TEXT",
6263
}
6364

6465

@@ -781,6 +782,9 @@ def put_vector(self, dataset, column, vector):
781782
vector_pointer[:] = np.char.encode(
782783
np.datetime_as_string(array_to_datetime(vector))
783784
)
785+
elif gmt_type == self["GMT_TEXT"]:
786+
vector_pointer = (ctp.c_char_p * len(vector))()
787+
vector_pointer[:] = np.char.encode(vector)
784788
else:
785789
vector_pointer = vector.ctypes.data_as(ctp.c_void_p)
786790
status = c_put_vector(

0 commit comments

Comments
 (0)