# Path: pyEOM/log.py
# LOGGER = logging.getLogger(__name__)
# DEBUG_MSG_FORMAT = '[%(asctime)s] [%(levelname)s] file=%(pathname)s \
# line=%(lineno)s module=%(module)s function=%(funcName)s msg=%(message)s'
# ERROR_MSG_FORMAT = DEBUG_MSG_FORMAT
# INFO_MSG_FORMAT = '[%(asctime)s] Message: %(message)s'
# TIME_FORMAT = '%a, %d %b %Y %H:%M:%S'
# LOGLEVELS = {
#     'CRITICAL': logging.CRITICAL,
#     'ERROR': logging.ERROR,
#     'WARNING': logging.WARNING,
#     'INFO': logging.INFO,
#     'DEBUG': logging.DEBUG,
#     'NOTSET': logging.NOTSET,
# }
# LOGFORMATS = {
#     'CRITICAL': ERROR_MSG_FORMAT,
#     'ERROR': ERROR_MSG_FORMAT,
#     'WARNING': DEBUG_MSG_FORMAT,
#     'INFO': INFO_MSG_FORMAT,
#     'DEBUG': DEBUG_MSG_FORMAT,
#     'NOTSET': '%(message)s',
# }
# def setup_logger(config=None):
#     def __init__(self, fmt="%(levelno)s: %(msg)s"):
#     def format(self, record):
# class MyFormatter(logging.Formatter):


import pyEOM.gee_init as gee
    import ee
import sys
import ogr
import urllib, urllib2
import re
import os
    import ftplib
    from ee import oauth
            from oauth2client.service_account import ServiceAccountCredentials
from bs4 import BeautifulSoup
from pyEOM import log
        if isinstance(image, ee.Image):
            urls.append(image.getDownloadUrl())
        elif isinstance(image, ee.ImageCollection):
            for item in image:
                urls.append(item.getDownloadUrl())
        else:
            raise Exception('Wrong object type for image parameter')
            sys.exit(1)

        localFiles = []
        filepath = path+'/'+url.split('/')[-1]
        for url in urls:
            LOGGER.info('Download '+url)
            download = urllib.urlretrieve(url, filepath)
            localFiles.append(download[0])
        return localFiles

    def extractZIP(self, zipfile):
        pass

    def listScenes(self, dataset, eeGeometry, start, end):
        collection = ee.ImageCollection(dataset).filterDate(start, end).filterBounds(eeGeometry).getInfo()
        images = []
        for image in collection['features']:
            images.append(image['id'])

        return images




# Path: pyEOM/log.py
# LOGGER = logging.getLogger(__name__)
# DEBUG_MSG_FORMAT = '[%(asctime)s] [%(levelname)s] file=%(pathname)s \
# line=%(lineno)s module=%(module)s function=%(funcName)s msg=%(message)s'
# ERROR_MSG_FORMAT = DEBUG_MSG_FORMAT
# INFO_MSG_FORMAT = '[%(asctime)s] Message: %(message)s'
# TIME_FORMAT = '%a, %d %b %Y %H:%M:%S'
# LOGLEVELS = {
#     'CRITICAL': logging.CRITICAL,
#     'ERROR': logging.ERROR,
#     'WARNING': logging.WARNING,
#     'INFO': logging.INFO,
#     'DEBUG': logging.DEBUG,
#     'NOTSET': logging.NOTSET,
# }
# LOGFORMATS = {
#     'CRITICAL': ERROR_MSG_FORMAT,
#     'ERROR': ERROR_MSG_FORMAT,
#     'WARNING': DEBUG_MSG_FORMAT,
#     'INFO': INFO_MSG_FORMAT,
#     'DEBUG': DEBUG_MSG_FORMAT,
#     'NOTSET': '%(message)s',
# }
# def setup_logger(config=None):
#     def __init__(self, fmt="%(levelno)s: %(msg)s"):
#     def format(self, record):
# class MyFormatter(logging.Formatter):


# Path: pyEOM/sources.py
import pyEOM.gee_init as gee
    import ee
import sys
import ogr
import urllib, urllib2
import re
import os
    import ftplib
    from ee import oauth
            from oauth2client.service_account import ServiceAccountCredentials
from bs4 import BeautifulSoup
from pyEOM import log

        if isinstance(image, ee.Image):
            urls.append(image.getDownloadUrl())
        elif isinstance(image, ee.ImageCollection):
            for item in image:
                urls.append(item.getDownloadUrl())
        else:
            raise Exception('Wrong object type for image parameter')
            sys.exit(1)

        localFiles = []
        filepath = path+'/'+url.split('/')[-1]
        for url in urls:
            LOGGER.info('Download '+url)
            download = urllib.urlretrieve(url, filepath)
            localFiles.append(download[0])
        return localFiles

    def extractZIP(self, zipfile):
        pass

    def listScenes(self, dataset, eeGeometry, start, end):
        collection = ee.ImageCollection(dataset).filterDate(start, end).filterBounds(eeGeometry).getInfo()
        images = []
        for image in collection['features']:
            images.append(image['id'])

        return images




LOGGER = log.LOGGER