From 14fb9d767a2806badd647ae99c966aff8e67787b Mon Sep 17 00:00:00 2001 From: Todd Jennings Date: Wed, 18 Mar 2020 18:30:37 -0400 Subject: [PATCH] drop numpy 1.12 compat code that can hide other errors --- xarray/core/duck_array_ops.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/xarray/core/duck_array_ops.py b/xarray/core/duck_array_ops.py index 4047a1e68e1..1340b456cf2 100644 --- a/xarray/core/duck_array_ops.py +++ b/xarray/core/duck_array_ops.py @@ -303,19 +303,15 @@ def f(values, axis=None, skipna=None, **kwargs): try: return func(values, axis=axis, **kwargs) except AttributeError: - if isinstance(values, dask_array_type): - try: # dask/dask#3133 dask sometimes needs dtype argument - # if func does not accept dtype, then raises TypeError - return func(values, axis=axis, dtype=values.dtype, **kwargs) - except (AttributeError, TypeError): - msg = "%s is not yet implemented on dask arrays" % name - else: - msg = ( - "%s is not available with skipna=False with the " - "installed version of numpy; upgrade to numpy 1.12 " - "or newer to use skipna=True or skipna=None" % name + if not isinstance(values, dask_array_type): + raise + try: # dask/dask#3133 dask sometimes needs dtype argument + # if func does not accept dtype, then raises TypeError + return func(values, axis=axis, dtype=values.dtype, **kwargs) + except (AttributeError, TypeError): + raise NotImplementedError( + f"{name} is not yet implemented on dask arrays" ) - raise NotImplementedError(msg) f.__name__ = name return f