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.

  • 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.


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

See also


equivalent function