How to use the trollimage.colormap function in trollimage

To help you get started, we’ve selected a few trollimage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pytroll / satpy / satpy / enhancements / __init__.py View on Github external
colors = palette.get('colors', None)
    if isinstance(colors, (tuple, list)):
        cmap = []
        values = palette.get('values', None)
        for idx, color in enumerate(colors):
            if values is not None:
                value = values[idx]
            else:
                value = idx / float(len(colors) - 1)
            cmap.append((value, tuple(color)))
        return Colormap(*cmap)

    if isinstance(colors, str):
        from trollimage import colormap
        import copy
        return copy.copy(getattr(colormap, colors))

    return None