cf.Bounds.clip

Bounds.clip(*args, **kwargs)[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.

inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Use the inplace parameter instead.

Returns
Bounds or None

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')