diff --git a/yt/funcs.py b/yt/funcs.py index 79a467f2e2b..3bc520abae9 100644 --- a/yt/funcs.py +++ b/yt/funcs.py @@ -86,15 +86,7 @@ def ensure_numpy_array(obj): This function ensures that *obj* is a numpy array. Typically used to convert scalar, list or tuple argument passed to functions using Cython. """ - if isinstance(obj, np.ndarray): - if obj.shape == (): - return np.array([obj]) - # We cast to ndarray to catch ndarray subclasses - return np.array(obj) - elif isinstance(obj, (list, tuple)): - return np.asarray(obj) - else: - return np.asarray([obj]) + return np.atleast_1d(np.array(obj)) def read_struct(f, fmt):