# Path: geetools/tools/image.py
# def getValue(image, point, scale=None, side="server"):
#     """ Return the value of all bands of the image in the specified point
# 
#     :param img: Image to get the info from
#     :type img: ee.Image
#     :param point: Point from where to get the info
#     :type point: ee.Geometry.Point
#     :param scale: The scale to use in the reducer. It defaults to 10 due to the
#         minimum scale available in EE (Sentinel 10m)
#     :type scale: int
#     :param side: 'server' or 'client' side
#     :type side: str
#     :return: Values of all bands in the ponit
#     :rtype: ee.Dictionary or dict
#     """
#     if scale:
#         scale = int(scale)
#     else:
#         scale = 1
# 
#     type = point.getInfo()["type"]
#     if type != "Point":
#         raise ValueError("Point must be ee.Geometry.Point")
# 
#     result = image.reduceRegion(ee.Reducer.first(), point, scale)
# 
#     if side == 'server':
#         return result
#     elif side == 'client':
#         return result.getInfo()
#     else:
#         raise ValueError("side parameter must be 'server' or 'client'")


import ee
from geetools.tools.image import getValue
    from geetools import expressions
# coding=utf-8

ee.Initialize()


l8SR = ee.Image("LANDSAT/LC8_SR/LC82310772014043")
p_l8SR_no_cloud = ee.Geometry.Point([-66.0306, -24.9338])

def test_expressions():
    generator = expressions.Expression()
    exp_max = generator.max("b('B1')", "b('B2')")
    exp_min = generator.min("b('B1')", "b('B2')")

    img_max = l8SR.expression(exp_max).select([0], ["max"])
    img_min = l8SR.expression(exp_min).select([0], ["min"])

    vals_max = getValue(img_max, p_l8SR_no_cloud, 30, 'client')

# Path: geetools/tools/image.py
# def getValue(image, point, scale=None, side="server"):
#     """ Return the value of all bands of the image in the specified point
# 
#     :param img: Image to get the info from
#     :type img: ee.Image
#     :param point: Point from where to get the info
#     :type point: ee.Geometry.Point
#     :param scale: The scale to use in the reducer. It defaults to 10 due to the
#         minimum scale available in EE (Sentinel 10m)
#     :type scale: int
#     :param side: 'server' or 'client' side
#     :type side: str
#     :return: Values of all bands in the ponit
#     :rtype: ee.Dictionary or dict
#     """
#     if scale:
#         scale = int(scale)
#     else:
#         scale = 1
# 
#     type = point.getInfo()["type"]
#     if type != "Point":
#         raise ValueError("Point must be ee.Geometry.Point")
# 
#     result = image.reduceRegion(ee.Reducer.first(), point, scale)
# 
#     if side == 'server':
#         return result
#     elif side == 'client':
#         return result.getInfo()
#     else:
#         raise ValueError("side parameter must be 'server' or 'client'")


# Path: tests/test_expressions.py
import ee
from geetools.tools.image import getValue
    from geetools import expressions

# coding=utf-8

ee.Initialize()


l8SR = ee.Image("LANDSAT/LC8_SR/LC82310772014043")
p_l8SR_no_cloud = ee.Geometry.Point([-66.0306, -24.9338])

def test_expressions():
    generator = expressions.Expression()
    exp_max = generator.max("b('B1')", "b('B2')")
    exp_min = generator.min("b('B1')", "b('B2')")

    img_max = l8SR.expression(exp_max).select([0], ["max"])
    img_min = l8SR.expression(exp_min).select([0], ["min"])

    vals_max = getValue(img_max, p_l8SR_no_cloud, 30, 'client')

    vals_min = getValue(img_min, p_l8SR_no_cloud, 30, 'client')