Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,7 @@ def virtualfile_from_vectors(self, *vectors):
if len(string_arrays) == 1:
strings = string_arrays[0]
elif len(string_arrays) > 1:
strings = np.apply_along_axis(
func1d=" ".join, axis=0, arr=string_arrays
)
strings = np.array([" ".join(vals) for vals in zip(*string_arrays)])
strings = np.asanyarray(a=strings, dtype=str)
self.put_strings(
dataset, family="GMT_IS_VECTOR|GMT_IS_DUPLICATE", strings=strings
Expand Down
3 changes: 2 additions & 1 deletion pygmt/tests/test_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ def test_virtualfile_from_vectors_two_string_or_object_columns(dtype):
size = 5
x = np.arange(size, dtype=np.int32)
y = np.arange(size, size * 2, 1, dtype=np.int32)
strings1 = np.array(["a", "bc", "def", "ghij", "klmno"], dtype=dtype)
# Catch bug in https://github.com/GenericMappingTools/pygmt/pull/2719
strings1 = np.array(["a", "bc", "def", "ghij", "klmnolooong"], dtype=dtype)
strings2 = np.array(["pqrst", "uvwx", "yz!", "@#", "$"], dtype=dtype)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(x, y, strings1, strings2) as vfile:
Expand Down