🍾 Xarray is now 10 years old! πŸŽ‰

xarray.Dataset.clip

Contents

xarray.Dataset.clip#

Dataset.clip(min=None, max=None, *, keep_attrs=None)[source]#

Return an array whose values are limited to [min, max]. At least one of max or min must be given.

Parameters:
  • min (None or Hashable, optional) – Minimum value. If None, no lower clipping is performed.

  • max (None or Hashable, optional) – Maximum value. If None, no upper clipping is performed.

  • keep_attrs (bool or None, optional) – If True, the attributes (attrs) will be copied from the original object to the new one. If False, the new object will be returned without attributes.

Returns:

clipped (same type as caller) – This object, but with with values < min are replaced with min, and those > max with max.

See also

numpy.clip

equivalent function