# xarray.Dataset.clip

#### Dataset.clip(min=None, max=None, , keep_attrs=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/common.py#L469-L510)

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

* **Parameters:**
  * **min** ([`None`](https://docs.python.org/3/builtins/constants.html#None) or `Hashable`, *optional*) – Minimum value. If None, no lower clipping is performed.
  * **max** ([`None`](https://docs.python.org/3/builtins/constants.html#None) or `Hashable`, *optional*) – Maximum value. If None, no upper clipping is performed.
  * **keep_attrs** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool) or [`None`](https://docs.python.org/3/builtins/constants.html#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`](https://numpy.org/doc/stable/reference/generated/numpy.clip.html#numpy.clip)
: equivalent function
