cf.Field.clip¶
-
Field.
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 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 in-place and return
None
.- i: deprecated at version 3.0.0
Use the inplace parameter instead.
- Returns
Examples
>>> g = f.clip(-90, 90) >>> g = f.clip(-90, 90, 'degrees_north')