1212from .common import _contains_datetime_like_objects , ones_like
1313from .computation import apply_ufunc
1414from .duck_array_ops import datetime_to_numeric , push , timedelta_to_numeric
15- from .options import _get_keep_attrs
15+ from .options import OPTIONS , _get_keep_attrs
1616from .pycompat import dask_version , is_duck_dask_array
1717from .utils import OrderedSet , is_scalar
1818from .variable import Variable , broadcast_variables
@@ -405,6 +405,12 @@ def _bfill(arr, n=None, axis=-1):
405405
406406def ffill (arr , dim = None , limit = None ):
407407 """forward fill missing values"""
408+ if not OPTIONS ["use_bottleneck" ]:
409+ raise RuntimeError (
410+ "ffill requires bottleneck to be enabled."
411+ " Call `xr.set_options(use_bottleneck=True)` to enable it."
412+ )
413+
408414 axis = arr .get_axis_num (dim )
409415
410416 # work around for bottleneck 178
@@ -422,6 +428,12 @@ def ffill(arr, dim=None, limit=None):
422428
423429def bfill (arr , dim = None , limit = None ):
424430 """backfill missing values"""
431+ if not OPTIONS ["use_bottleneck" ]:
432+ raise RuntimeError (
433+ "bfill requires bottleneck to be enabled."
434+ " Call `xr.set_options(use_bottleneck=True)` to enable it."
435+ )
436+
425437 axis = arr .get_axis_num (dim )
426438
427439 # work around for bottleneck 178
0 commit comments