In [1]:
import ee
ee.Initialize()
In [2]:
from geetools import tools
In [3]:
col = ee.ImageCollection('COPERNICUS/S2').select(['B1', 'B2', 'B3']).limit(10)
helper function to print values for the centroid of the first image of a collection
In [4]:
def print_center(collection):
first = ee.Image(collection.first())
p = first.geometry().centroid()
return tools.image.getValue(first, p, scale=10, side='client')
In [5]:
newcol = col.map(lambda i: tools.image.addConstantBands(i, 0, "a", "b", "c"))
In [6]:
print_center(newcol)
Out[6]:
In [7]:
newcolCK = col.map(lambda i: tools.image.addConstantBands(i, a=0, b=1, c=2))
In [8]:
print_center(newcolCK)
Out[8]:
In [9]:
newcolCC = col.map(lambda i:tools.image.addConstantBands(i, 0, "a", "b", "c", d=1, e=2))
In [10]:
print_center(newcolCC)
Out[10]:
In [ ]: