Set colors for extended colorbar

Dear CDS-Team,

during my plot of a geomap I was looking for a solution to plot values higher/lower than the colorbar range in a different color.

In this example the color for lower values (<5) should be grey and for higher values (>20) black.

My research ended with the result that there is a "set_under" and "set_over" feature to set the colors. Unfortunately my tries to include them weren't successful and Im not sure where to place them.

Or should I otherwise try to create a own colormap or somehow adjust the "YlGnBu" colormap?

Thanks and cheers,


import cdstoolbox as ct


def application():
precipitation = ct.catalogue.retrieve(
‘product_type’: ‘monthly_averaged_reanalysis’,
‘variable’: ‘total_precipitation’,
‘year’: ‘2003’,
‘month’: ‘01’,
‘time’: ‘00:00’,
figure = ct.cdsplot.geomap(precipitation,
‘cmap’: ‘YlGnBu’,
‘vmin’: 5,
‘vmax’: 20,
‘orientation’: ‘vertical’,
‘shrink’: 0.67,
‘levels’: 11,

return figure

I have also encountered this issue and I would be interested to know the answer to Tims question as well.