Skip to content

Commit 6083058

Browse files
committed
Use data.to_numpy(na_value=np.nan).astype(dtype=dtype) for float16
1 parent 923ae8e commit 6083058

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pygmt/clib/conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _to_numpy(data: Any) -> np.ndarray:
188188
# Integer dtypes with missing values are cast to NumPy float dtypes and NaN
189189
# is used as missing value indicator.
190190
dtype = np.float64 if data.dtype.kind in "iu" else data.dtype.numpy_dtype
191-
data = data.to_numpy(dtype=dtype, na_value=np.nan)
191+
data = data.to_numpy(na_value=np.nan).astype(dtype=dtype)
192192

193193
vec_dtype = str(getattr(data, "dtype", ""))
194194
array = np.ascontiguousarray(data, dtype=dtypes.get(vec_dtype))

0 commit comments

Comments
 (0)