plots.styles.levels =================== .. py:module:: plots.styles.levels Classes ------- .. autoapisummary:: plots.styles.levels.Levels Functions --------- .. autoapisummary:: plots.styles.levels.auto_range plots.styles.levels.categorical_range plots.styles.levels.step_range Module Contents --------------- .. py:class:: Levels(levels=None, step=None, reference=None, divergence_point=None, categorical=False) Class defining levels to use with a mapping style. :param levels: A static list of levels to always use, no matter the input data. :type levels: list, optional :param step: The step/difference between each level in the desired level range. :type step: float, optional :param reference: The reference point around which to calibrate the level range. For example, if a `step` of 4 is used and a `reference` of 2 is used, then the generated levels will be generated as steps of 4 above and below the number 2. :type reference: float, optional :param divergence_point: If provided, force the levels to be centred on this point. This is mostly useful for parameters which use diverging colors in their style, such as anomalies. :type divergence_point: float, optional .. py:method:: apply(data) Generate levels specific to some data. :param data: The data for which to generate a list of levels. :type data: numpy.ndarray or xarray.DataArray or earthkit.data.core.Base :rtype: list .. py:method:: from_config(config) :classmethod: .. py:function:: auto_range(data, divergence_point=None, n_levels=schema.default_style_levels) Generate a suitable range of levels for arbitrary input data. :param data: The data for which to generate a list of levels. :type data: numpy.ndarray or xarray.DataArray or earthkit.data.core.Base :param divergence_point: If provided, force the levels to be centered on this point. Useful for parameters that use diverging colors in their style, such as anomalies. :type divergence_point: float, optional :param n_levels: The target number of levels to generate (default is 10). :type n_levels: int, optional :returns: A list of levels spaced across the data range with easy-to-interpret intervals. :rtype: list .. py:function:: categorical_range(values) Generate a range of levels for categorical data. This can be necessary to make sure that categorical data falls inside the correct bins, as values at the edge of a bin may not be included in the bin. :param values: The data for which to generate a list of levels. :type values: numpy.ndarray or xarray.DataArray or earthkit.data.core.Base :rtype: list .. py:function:: step_range(data, step, reference=None) Generate a range of levels for some data based on a level step and multiple. :param data: The data for which to generate a list of levels. :type data: numpy.ndarray or xarray.DataArray or earthkit.data.core.Base :param step: The step/difference between each level in the desired level range. :type step: float :param reference: The reference point around which to calibrate the level range. For example, if a `step` of 4 is used and a `reference` of 2 is used, then the generated levels will be generated as steps of 4 above and below the number 2. :type reference: float, optional :rtype: list