diff --git a/xarray/core/utils.py b/xarray/core/utils.py index 9b527622e40..b61249716ae 100644 --- a/xarray/core/utils.py +++ b/xarray/core/utils.py @@ -1109,7 +1109,7 @@ def find_stack_level(test_mode=False) -> int: def emit_user_level_warning(message, category=None): """Emit a warning at the user level by inspecting the stack trace.""" stacklevel = find_stack_level() - warnings.warn(message, category=category, stacklevel=stacklevel) + return warnings.warn(message, category=category, stacklevel=stacklevel) def consolidate_dask_from_array_kwargs(