iris.palette#
Load, configure and register color map palettes and initialise color map meta-data mappings.
In this module:
- iris.palette.auto_palette(func)[source]#
Decorator wrapper function to control the default behaviour of the matplotlib cmap and norm keyword arguments.
Args:
- func (callable):
Callable function to be wrapped by the decorator.
- Returns
Closure wrapper function.
- iris.palette.cmap_norm(cube)[source]#
Determine the default
matplotlib.colors.LinearSegmentedColormap
andiris.palette.SymmetricNormalize
instances associated with the cube.Args:
- cube (
iris.cube.Cube
): Source cube to generate default palette from.
- cube (
- Returns
Tuple of
matplotlib.colors.LinearSegmentedColormap
andiris.palette.SymmetricNormalize
Notes
This function maintains laziness when called; it does not realise data. See more at Real and Lazy Data.
- iris.palette.is_brewer(cmap)[source]#
Determine whether the color map is a Cynthia Brewer color map.
Args:
- cmap:
The color map instance.
- Returns
Boolean.
Provides a symmetric normalization class around a given pivot point.
- class iris.palette.SymmetricNormalize(pivot, *args, **kwargs)[source]#
Provides a symmetric normalization class around a given pivot point.
- __call__(value, clip=None)#
Normalize value data in the
[vmin, vmax]
interval into the[0.0, 1.0]
interval and return it.
- Parameters
value – Data to normalize.
clip (bool, optional) – If
None
, defaults toself.clip
(which defaults toFalse
).Notes
If not already initialized,
self.vmin
andself.vmax
are initialized usingself.autoscale_None(value)
.
- autoscale(A)#
Set vmin, vmax to min, max of A.
- autoscale_None(A)#
If vmin or vmax are not set, use the min/max of A to set them.
- inverse(value)#
- static process_value(value)#
Homogenize the input value for easy and efficient normalization.
value can be a scalar or sequence.
- Returns
result (masked array) – Masked array with the same shape as value.
is_scalar (bool) – Whether value is a scalar.
Notes
Float dtypes are preserved; integer types with two bytes or smaller are converted to np.float32, and larger types are converted to np.float64. Preserving float32 when possible, and using in-place operations, greatly improves speed for large arrays.
- scaled()#
Return whether vmin and vmax are set.
- property clip#
- property vmax#
- property vmin#