xarray icon indicating copy to clipboard operation
xarray copied to clipboard

Fill gaps limited 7665

Open Ockenfuss opened this issue 6 months ago • 7 comments

Improve gap filling

  • Closes #7665
  • Combine current gap limiting in xarray (max_gap) with capabilities of pandas (limit_direction, limit_area) regarding filling of missing values
  • Provide a common function fill_gaps() to control gap length for all filling functions (ffill/bfill/interpolate_na/fillna)

This PR involves a full implementation, documentation and corresponding tests. As discussed in #7665, a new API function fill_gaps was introduced, to avoid breaking changes of existing code and keep the argument inflation of the filling functions to a minimum.

  • [x] Closes #7665 (also #9392 )
  • [x] Tests added

TBD if accepted:

  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [ ] New functions/methods are listed in api.rst
  • [ ] Add Example in Documentation

Deprecations

  • Using limit in interpolate_na now requires numbagg or bottleneck. So far, limit worked without bottleneck, max_gap required it (not documented). Reason: max_gap and limit now share the same codebase using ffill. Since no one ever complained about the missing documentation and the error message is pretty clear and easy to resolve ("No module named 'bottleneck"), I hope this might be acceptable.

Ockenfuss avatar Aug 23 '24 16:08 Ockenfuss