cf.Field.clip¶

Field.
clip
(a_min, a_max, units=None, 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 ofa_min
anda_max
may beNone
. a_max:
Maximum value. If
None
, clipping is not performed on upper interval edge. Not more than one ofa_min
anda_max
may beNone
. units:
str
orUnits
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 inplace and return
None
. i: deprecated at version 3.0.0
Use inplace parameter instead.
Returns: The construct with clipped data. If the operation was inplace then
None
is returned.Examples:
>>> g = f.clip(90, 90) >>> g = f.clip(90, 90, 'degrees_north')