# cf.DomainAncillary.clip¶

DomainAncillary.clip(a_min, a_max, units=None, bounds=True, inplace=False, i=False)[source]

Limit the values in the data.

Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1.

Parameters: a_min: Minimum value. If None, clipping is not performed on lower interval edge. Not more than one of a_min and a_max may be None. a_max: Maximum value. If None, clipping is not performed on upper interval edge. Not more than one of a_min and a_max may be None. units: str or Units Specify the units of a_min and a_max. By default the same units as the data are assumed. bounds: bool, optional If False then do not alter any bounds. By default any bounds are also altered. inplace: bool, optional If True then do the operation in-place and return None. i: deprecated at version 3.0.0 Use inplace parameter instead. The construct with clipped data. If the operation was in-place then None is returned.

Examples:

>>> g = f.clip(-90, 90)
>>> g = f.clip(-90, 90, 'degrees_north')