def category_map(*args):
    """Create a category map from multiple binary cubes

    Args:
        *args: Any number of :py:class:`iris.cube.Cube`'s with a 0/1 mapping

    Returns:
        iris.cube.Cube: A single cube with data 0-N, where N is the number of
        cubes input. The data then represents the cube number which is True at
        that location. A `names` attribute, which is a dictionary mapping of
        numbers to cube names, is also added to the cube.
    """
    names = {}

    # Copy the shape and coordinates from one of the cubes
    mapping = args[0].copy()
    mapping.data[:] = 0

    # For each cube set a number for it's mapping
    for n, cube in enumerate(args):
        names[n] = cube.name()
        mapping.data += n * cube.data

    # Save the key mapping numbers to names
    mapping.attributes['names'] = names

    return mapping