Skip to content

Commit a2258a5

Browse files
committed
Switch back to using np.asarray, but use dtype 'object' in test
1 parent f70db5f commit a2258a5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pygmt/clib/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def _check_dtype_and_dim(self, array, ndim):
720720
if array.dtype.type not in DTYPES:
721721
try:
722722
# Try to convert any unknown numpy data types to np.datetime64
723-
array = np.datetime64(array)
723+
array = np.asarray(array, dtype=np.datetime64)
724724
except ValueError:
725725
raise GMTInvalidInput(
726726
"Unsupported numpy data type '{}'.".format(array.dtype.type)

pygmt/tests/test_clib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def test_put_vector_invalid_dtype():
349349
mode="GMT_CONTAINER_ONLY",
350350
dim=[2, 3, 1, 0], # columns, rows, layers, dtype
351351
)
352-
data = np.array([37, 12, 556], dtype="complex128")
352+
data = np.array([37, 12, 556], dtype="object")
353353
with pytest.raises(GMTInvalidInput):
354354
lib.put_vector(dataset, column=1, vector=data)
355355

0 commit comments

Comments
 (0)