maps.styles.levels

Module Contents

Classes

Levels

Class defining levels to use with a mapping style.

Functions

auto_range(data[, divergence_point, n_levels])

Attempt to generate a suitable range of levels for arbitrary input data.

step_range(data, step[, reference])

Generate a range of levels for some data based on a level step and multiple.

class maps.styles.levels.Levels(levels=None, step=None, reference=None, divergence_point=None)

Class defining levels to use with a mapping style.

Parameters:
  • levels (list, optional) – A static list of levels to always use, no matter the input data.

  • step (float, optional) – The step/difference between each level in the desired level range.

  • reference (float, optional) – 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.

  • divergence_point (float, optional) – 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.

apply(data)

Generate levels specific to some data.

Parameters:

data (numpy.ndarray or xarray.DataArray or earthkit.data.core.Base) – The data for which to generate a list of levels.

Return type:

list

classmethod from_config(config)
maps.styles.levels.auto_range(data, divergence_point=None, n_levels=8)

Attempt to generate a suitable range of levels for arbitrary input data.

NOTE: Experimental!

Parameters:
  • data (numpy.ndarray or xarray.DataArray or earthkit.data.core.Base) – The data for which to generate a list of levels.

  • divergence_point (float, optional) – 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.

  • n_levels (int, optional) – The number of levels to generate.

Return type:

list

maps.styles.levels.step_range(data, step, reference=None)

Generate a range of levels for some data based on a level step and multiple.

Parameters:
  • data (numpy.ndarray or xarray.DataArray or earthkit.data.core.Base) – The data for which to generate a list of levels.

  • step (float) – The step/difference between each level in the desired level range.

  • reference (float, optional) – 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.

Return type:

list