def printECodeFlickr(code, printFlickrLink):
    if printFlickrLink:
        return ahref(flickrLink(code),
                     ecoInfo.getEcoregion(code)) + ' ' + ahref(
                         wwfLink(code), '(WWF full report)') + '<br>'
    else:
        return ahref(wwfLink(code), ecoInfo.getEcoregion(code)) + '<br>'
def flickrLink(eCode):
    eTag = ecoInfo.getEcoregion(eCode).replace(' ',
                                               '').replace('-', '').replace(
                                                   '.', '').replace(',', '')
    prefix = 'http://www.flickr.com/search/groups/?m=pool&w=1334707%40N21&s=int&q='
    link = prefix + eTag
    return link
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
    photoXml = getPhoto(photoId)
Example #4
0
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
    photoXml = getPhoto(photoId)
Example #5
0
def printECodeFlickr(code, printFlickrLink):
    if printFlickrLink:
         return ahref(flickrLink(code), ecoInfo.getEcoregion(code)) + ' ' + ahref(wwfLink(code), '(WWF full report)') + '<br>'
    else:
         return ahref(wwfLink(code), ecoInfo.getEcoregion(code)) + '<br>'
Example #6
0
def flickrLink(eCode):
    eTag = ecoInfo.getEcoregion(eCode).replace(' ','').replace('-','').replace('.','').replace(',','')
    prefix = 'http://www.flickr.com/search/groups/?m=pool&w=1334707%40N21&s=int&q='
    link = prefix + eTag
    return link
Example #7
0
def getEcoregionWiki(x):
    ecoregion = ecoInfo.getEcoregion(x)
    if ecoregion == 'Chaco':
        return 'Chaco (WWF ecoregion)'
    else:
        return ecoregion
Example #8
0
def getEcoregionWiki(x):
    ecoregion = ecoInfo.getEcoregion(x)
    if ecoregion == 'Chaco':
        return 'Chaco (WWF ecoregion)'
    else:
        return ecoregion