def get_colormap(ptype, units="mm/h", colorscale="pysteps"):
    """
    Function to generate a colormap (cmap) and norm.

    Parameters
    ----------
    ptype : {'intensity', 'depth', 'prob'}, optional
        Type of the map to plot: 'intensity' = precipitation intensity field,
        'depth' = precipitation depth (accumulation) field,
        'prob' = exceedance probability field.
    units : {'mm/h', 'mm', 'dBZ'}, optional
        Units of the input array. If ptype is 'prob', this specifies the unit of
        the intensity threshold.
    colorscale : {'pysteps', 'STEPS-BE', 'STEPS-NL', 'BOM-RF3'}, optional
        Which colorscale to use. Applicable if units is 'mm/h', 'mm' or 'dBZ'.

    Returns
    -------
    cmap : Colormap instance
        colormap
    norm : colors.Normalize object
        Colors norm
    clevs: list(float)
        List of precipitation values defining the color limits.
    clevs_str: list(str)
        List of precipitation values defining the color limits (with correct
        number of decimals).
    """
    if ptype in ["intensity", "depth"]:
        # Get list of colors
        color_list, clevs, clevs_str = _get_colorlist(units, colorscale)

        cmap = colors.LinearSegmentedColormap.from_list(
            "cmap", color_list, len(clevs) - 1
        )

        if colorscale == "BOM-RF3":
            cmap.set_over("black", 1)
        if colorscale == "pysteps":
            cmap.set_over("darkred", 1)
        if colorscale == "STEPS-NL":
            cmap.set_over("darkmagenta", 1)
        if colorscale == "STEPS-BE":
            cmap.set_over("black", 1)
        norm = colors.BoundaryNorm(clevs, cmap.N)

        cmap.set_bad("gray", alpha=0.5)
        cmap.set_under("none")

        return cmap, norm, clevs, clevs_str

    if ptype == "prob":
        cmap = copy.copy(plt.get_cmap("OrRd", 10))
        cmap.set_bad("gray", alpha=0.5)
        cmap.set_under("none")
        clevs = np.linspace(0, 1, 11)
        clevs[0] = 1e-3  # to set zeros to transparent
        norm = colors.BoundaryNorm(clevs, cmap.N)
        clevs_str = [f"{clev:.1f}" for clev in clevs]
        return cmap, norm, clevs, clevs_str

    return pyplot.get_cmap("jet"), colors.Normalize(), None, None
Function to generate a colormap (cmap) and norm.

Parameters
----------
ptype : {'intensity', 'depth', 'prob'}, optional
Type of the map to plot: 'intensity' = precipitation intensity field,
'depth' = precipitation depth (accumulation) field,
'prob' = exceedance probability field.
units : {'mm/h', 'mm', 'dBZ'}, optional
Units of the input array. If ptype is 'prob', this specifies the unit of
the intensity threshold.
colorscale : {'pysteps', 'STEPS-BE', 'STEPS-NL', 'BOM-RF3'}, optional
Which colorscale to use. Applicable if units is 'mm/h', 'mm' or 'dBZ'.

Returns
-------
cmap : Colormap instance
colormap
norm : colors.Normalize object
Colors norm
clevs: list(float)
List of precipitation values defining the color limits.
clevs_str: list(str)
List of precipitation values defining the color limits (with correct
number of decimals).
pysteps/visualization/precipfields.py