In [5]:
"""ee_utils"""

# Import key packages
import ee

from IPython.display import Image

%matplotlib inline

from __future__ import print_function # For py 2.7 compat
import datetime
import IPython
from IPython.html import widgets
from IPython.display import display
from IPython.utils import traitlets
from IPython.core.display import Javascript


# Authenticate into the Earth Engine API and Initialize
def initialize_api():
    try:
        ee.Initialize()
        print("Authentication successful!")
    except:
        print('Authentication failed')

        
        
# Generate a test image to see if the authentication worked
def test_api():
    """
    This script will test to make sure you are 
    in the Earth Engine API by printing a small 
    map inline in your IPython notebook.
    """

    # Call an global elevation image from Earth Engine
    image = ee.Image('srtm90_v4')
    print("Get psyched! You have entered the Python Earth Engine Playground")
    return Image(url=image.getThumbUrl({'min':0, 'max': 3000}))