def removeFromMosaics(data):
    base = os.path.basename(data)
    print("Removing existing mosaics from: " + str(base))
    try:
        if base == "OperationalData":
            arcpy.RemoveRastersFromMosaicDataset_management(data,
                                                            "OBJECTID >=0",
                                                            "NO_BOUNDARY",
                                                            "NO_MARK_OVERVIEW_ITEMS",
                                                            "NO_DELETE_OVERVIEW_IMAGES",
                                                            "NO_DELETE_ITEM_CACHE",
                                                            "REMOVE_MOSAICDATASET_ITEMS",
                                                            "NO_CELL_SIZES")
            return True
        elif base == "OperationalWind":
            arcpy.RemoveRastersFromMosaicDataset_management(data,
                                                            "OBJECTID >= 0",
                                                            "UPDATE_BOUNDARY",
                                                            "MARK_OVERVIEW_ITEMS",
                                                            "DELETE_OVERVIEW_IMAGES",
                                                            "DELETE_ITEM_CACHE",
                                                            "REMOVE_MOSAICDATASET_ITEMS",
                                                            "UPDATE_CELL_SIZES")
            return True
        else:
            return False
    except NAMDownloadException as e:
        print("Error in removeFromMosaics: \n" + str(e.tb))
remove rasters from mosaic dataset
dataset/ETHPy150Open Esri/solutions-geoprocessing-toolbox/suitability/toolboxes/scripts/NAMDownload.py/removeFromMosaics