example Template#

github colab

Set up environement#

Install all the required libs if necessary and perform the import statements upstream.

[ ]:
# uncomment if installation of libs is necessary
# !pip install earthengine-api geetools
[ ]:
import ee
import geetools #noqa: F401
[ ]:
# uncomment if authetication to GEE is needed
# ee.Authenticate()
[ ]:
# uncomment if initialization is required
# ee.Initialize()

Truncate a number#

This template is demonstrating how to truncate a EE number to a given number of decimal places.

[ ]:
# initialize your GEE object
pi = 3.14159265359
ee_pi = ee.Number(pi)
ee_pi.getInfo()
[ ]:
# truncate the number to 3 decimals directly in GEE
ee_pi_truncated = ee_pi.geetools.truncate(3)
ee_pi_truncated.getInfo()