pyku.colormaps#

Reference implementation of DWD color maps

pyku.colormaps.get_cmap(name, kind='original', nbins=None)[source]#

Get cmap

Parameters:
  • name (str) – name of the colormap

  • kind (str) – Defaults to linear. One of {original, linear, segmented}

  • nbins (int) – Number of bins for segmented color maps

Returns:

The colormap.

Return type:

matplotlib.colors.Colormap

Example

In [1]: import pyku.colormaps as colormaps
   ...: cmap = colormaps.get_cmap('temp_ano')
   ...: 
pyku.colormaps.get_cmap_colors(name, kind='original', nbins=None, encoding='hex')[source]#

Get cmap colors

Parameters:
  • name (str) – name of the colormap

  • kind (str) – Defaults to linear. One of {original, segmented}

  • nbins (int) – Number of bins for segmented color maps

  • encoding (str) – Encoding. Default to ‘hex’. One of {‘hex’, ‘rgb’}

Returns:

If encoding is ‘rgb’, return a list of red, green and blue

tuples. If encoding is ‘rgb’, return a list of hex.

Return type:

List

Example

In [1]: import pyku.colormaps as colormaps
   ...: colormaps.get_cmap_colors(
   ...:     'temp_ano',
   ...:     kind='segmented',
   ...:     nbins=10,
   ...:     encoding='hex'
   ...:  )
   ...: 
Out[1]: 
['#053061',
 '#2d6390',
 '#5595be',
 '#8ebbd6',
 '#cbdbe4',
 '#e7d1cd',
 '#e09f94',
 '#cd6a60',
 '#9a3540',
 '#67001f']
pyku.colormaps.get_colormaps_names()[source]#

Get the name of all available colormaps

Returns:

List of the names of all available colormaps

Return type:

List[str]

Example

In [1]: import pyku.colormaps as colormaps
   ...: colormaps.get_colormaps_names()
   ...: 
Out[1]: 
['temp_abs',
 'temp_ano',
 'temp_anp_abs',
 'temp_anp_ano',
 'temp_nnp',
 'temp_nnp_cat',
 'precip_abs',
 'precip_ano',
 'precip_anp_abs',
 'precip_anp_ano',
 'precipKV_ano',
 'precipKV_nnp',
 'precipKV_nnp_cat',
 'sun_abs',
 'sun_ano',
 'sun_anp_abs',
 'sun_anp_ano',
 'sun_nnp_cat',
 'radg_abs',
 'radg_ano',
 'dayscold_abs',
 'dayscold_ano',
 'dayscold_nnp',
 'dayscold_nnp_cat',
 'dayscold_ice_anp_abs',
 'dayscold_ice_anp_ano',
 'dayscold_frost_anp_abs',
 'dayscold_frost_anp_ano',
 'dayswarm_abs',
 'dayswarm_ano',
 'dayswarm_nnp',
 'dayswarm_nnp_cat',
 'dayswarm_summer_anp_abs',
 'dayswarm_summer_anp_ano',
 'dayswarm_hot_anp_abs',
 'dayswarm_hot_anp_ano',
 'dayswarm_tropical_anp_abs',
 'dayswarm_tropical_anp_ano',
 'pressure_abs',
 'pressure_ano',
 'relhum_abs',
 'relhum_ano',
 'HZ_abs',
 'HZ_ano',
 'WHZ_abs',
 'WHZ_ano',
 'KV_skill',
 'snow_abs',
 'snow_ano',
 'wind_ano',
 'wind_abs']
pyku.colormaps.plot_colormaps(kind='linear', nbins=None)[source]#

Plot all available colormaps

Parameters:
  • kind (str) – Defaults to linear. One of {original, linear, segmented}

  • nbins (int) – Number of bins for segmented color maps

Example

In [1]: import pyku.colormaps as colormaps
   ...: 
   ...: colormaps.plot_colormaps(kind='original')
   ...: 
_images/plot_colormaps.png