def getMissingECodes(eCodes): eCodesSet = set(eCodes) result = set() for e in ecoInfo.getAllECodes(): if not e in eCodesSet: result.add(e) return result
def getMissingECodes(eCodes): eCodesSet = set(eCodes) result = set() for e in ecoInfo.getAllECodes(): if not e in eCodesSet: result.add(e) return result
def picklePhotoIds(photoIds): pickle.dump(photoIds, open(pickleFile, "wb")) def isEcoregion(tag): return normalizeEcoregion(tag) in normalizedEcoregions def ecoregionsInTags(tags): return filter(isEcoregion, tags) def getECodes(ecoregions): return [normalizedEcoregions[normalizeEcoregion(e)] for e in ecoregions] normalizedEcoregions = dict() for c in ecoInfo.getAllECodes(): ecoregion = ecoInfo.getEcoregion(c) normalizedEcoregions[normalizeEcoregion(ecoregion)] = c photoIds= getPhotosIdsFromApi() badPhotos = list() eCodes = set() count = 1 max = 10000 for photoId in photoIds: print "processing photo " + str(count) + " of " + str(len(photoIds)) count = count + 1 if (count >= max): break
def isEcoregion(tag): return normalizeEcoregion(tag) in normalizedEcoregions def ecoregionsInTags(tags): return filter(isEcoregion, tags) def getECodes(ecoregions): return [normalizedEcoregions[normalizeEcoregion(e)] for e in ecoregions] normalizedEcoregions = dict() for c in ecoInfo.getAllECodes(): ecoregion = ecoInfo.getEcoregion(c) normalizedEcoregions[normalizeEcoregion(ecoregion)] = c photoIds = getPhotosIdsFromApi() badPhotos = list() eCodes = set() count = 1 max = 10000 for photoId in photoIds: print "processing photo " + str(count) + " of " + str(len(photoIds)) count = count + 1 if (count >= max): break