casadoj / EFAS_skill

Assessment of the skill of EFAS (Europen Flood Awareness System) formal flood notifications.
0 stars 0 forks source link

Function `combine_cmaps` #16

Closed casadoj closed 8 months ago

casadoj commented 8 months ago

Create a function that creates a new colour map as the combination of two colour maps:

# define colour map for the skill metrics
def combine_cmaps(cmap1, cmap2, vmin, vmax, name=None):
  top = cm.get_cmap(cmap1, 128)
  bottom = cm.get_cmap(cmap2, 128)
  newcolors = np.vstack((top(np.linspace(0.2, .8, 128)),
                         bottom(np.linspace(0.2, .8, 128))))
  return ListedColormap(newcolors, name=name)
casadoj commented 8 months ago

Done