本文整理汇总了Python中ee.Dictionary方法的典型用法代码示例。如果您正苦于以下问题:Python ee.Dictionary方法的具体用法?Python ee.Dictionary怎么用?Python ee.Dictionary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ee
的用法示例。
在下文中一共展示了ee.Dictionary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iterate
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def iterate(image1,image2,niter,first):
# simulated iteration of MAD for debugging
# result = iterate(image1,image2,niter,first)
for i in range(1,niter+1):
result = ee.Dictionary(imad(i,first))
allrhos = ee.List(result.get('allrhos'))
chi2 = ee.Image(result.get('chi2'))
MAD = ee.Image(result.get('MAD'))
first = ee.Dictionary({'image':image1.addBands(image2),
'allrhos':allrhos,
'chi2':chi2,
'MAD':MAD})
return result
#------------------
# helper functions
#------------------
示例2: testDictionary
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def testDictionary(self):
"""Verifies basic behavior of ee.Dictionary."""
src = {'a': 1, 'b': 2, 'c': 'three'}
dictionary = ee.Dictionary(src)
self.assertEquals({'type': 'Dictionary', 'value': src},
ee.Serializer(False)._encode(dictionary))
f = ee.Feature(None, {'properties': src})
computed = ee.Dictionary(f.get('properties'))
self.assertTrue(isinstance(computed, ee.Dictionary))
# The 4 types of arguments we expect
cons = (ee.Dictionary(src),
ee.Dictionary(f.get('properties')),
ee.Dictionary(),
ee.Dictionary(('one', 1)))
for d in cons:
self.assertTrue(isinstance(d, ee.ComputedObject))
示例3: filter_j
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def filter_j(current,prev):
P = ee.Image(current)
prev = ee.Dictionary(prev)
ell = ee.Number(prev.get('ell'))
cmap = ee.Image(prev.get('cmap'))
smap = ee.Image(prev.get('smap'))
fmap = ee.Image(prev.get('fmap'))
bmap = ee.Image(prev.get('bmap'))
threshold = ee.Image(prev.get('threshold'))
j = ee.Number(prev.get('j'))
cmapj = cmap.multiply(0).add(ell.add(j).subtract(1))
cmap1 = cmap.multiply(0).add(1)
tst = P.gt(threshold).And(cmap.eq(ell.subtract(1)))
cmap = cmap.where(tst,cmapj)
fmap = fmap.where(tst,fmap.add(1))
smap = ee.Algorithms.If(ell.eq(1),smap.where(tst,cmapj),smap)
idx = ell.add(j).subtract(2)
tmp = bmap.select(idx)
bname = bmap.bandNames().get(idx)
tmp = tmp.where(tst,cmap1)
tmp = tmp.rename([bname])
bmap = bmap.addBands(tmp,[bname],True)
return ee.Dictionary({'ell':ell,'j':j.add(1),'threshold':threshold,'cmap':cmap,'smap':smap,'fmap':fmap,'bmap':bmap})
示例4: omnibus
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def omnibus(imList,significance=0.0001,median=False):
'''return change maps for sequential omnibus change algorithm'''
imList = ee.List(imList).map(multbyenl)
p = ee.Image(imList.get(0)).bandNames().length()
k = imList.length()
# pre-calculate p-value array
ells = ee.List.sequence(1,k.subtract(1))
first = ee.Dictionary({'k':k,'p':p,'median':median,'imList':imList,'pv_arr':ee.List([])})
pv_arr = ee.List(ee.Dictionary(ells.iterate(ells_iter,first)).get('pv_arr'))
# filter p-values to generate cmap, smap, fmap and bmap
cmap = ee.Image(imList.get(0)).select(0).multiply(0.0)
smap = ee.Image(imList.get(0)).select(0).multiply(0.0)
fmap = ee.Image(imList.get(0)).select(0).multiply(0.0)
bmap = ee.Image.constant(ee.List.repeat(0,k.subtract(1)))
threshold = ee.Image.constant(1-significance)
first = ee.Dictionary({'ell':1,'threshold':threshold,'cmap':cmap,'smap':smap,'fmap':fmap,'bmap':bmap})
return ee.Dictionary(pv_arr.iterate(filter_ell,first))
示例5: _add_suffix_prefix
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def _add_suffix_prefix(image, value, option, bands=None):
""" Internal function to handle addPrefix and addSuffix """
if bands:
bands = ee.List(bands)
addon = ee.String(value)
allbands = image.bandNames()
bands_ = ee.List(ee.Algorithms.If(bands, bands, allbands))
def over_bands(band, first):
all = ee.List(first)
options = ee.Dictionary({
'suffix': ee.String(band).cat(addon),
'prefix': addon.cat(ee.String(band))
})
return all.replace(band, ee.String(options.get(option)))
newbands = bands_.iterate(over_bands, allbands)
newbands = ee.List(newbands)
return image.select(allbands, newbands)
示例6: getFromDict
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def getFromDict(eelist, values):
""" Get a list of Dict's values from a list object. Keys must be unique
:param values: dict to get the values for list's keys
:type values: ee.Dictionary
:return: a list of values
:rtype: ee.List
"""
values = ee.Dictionary(values) if isinstance(values, dict) else values
empty = ee.List([])
def wrap(el, first):
f = ee.List(first)
cond = values.contains(el)
return ee.Algorithms.If(cond, f.add(values.get(el)), f)
values = ee.List(eelist.iterate(wrap, empty))
return values
示例7: addStyle
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def addStyle(pt):
size = ee.Number(pt.get('capacitymw')).sqrt().divide(10).add(2)
color = fuelColor.get(pt.get('fuel1'))
return pt.set('styleProperty', ee.Dictionary({'pointSize': size, 'color': color}))
# Make a FeatureCollection out of the power plant data table
示例8: createFeature
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def createFeature(transition_class_stats):
transition_class_stats = ee.Dictionary(transition_class_stats)
class_number = transition_class_stats.get('transition_class_value')
result = {
'transition_class_number': class_number,
'transition_class_''name': lookup_names.get(class_number),
'transition_class_''palette': lookup_palette.get(class_number),
'area_m2': transition_class_stats.get('sum')
}
return ee.Feature({}, result) # Creates a feature without a geometry.
# Create a JSON dictionary that defines piechart colors based on the
# transition class palette.
# https:#developers.google.com/chart/interactive/docs/gallery/piechart
示例9: anglestats
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def anglestats(current,prev):
''' get dictionary of incident angle statistics of current image and append to list '''
prev = ee.Dictionary(prev)
rect = ee.Geometry(prev.get('rect'))
stats = ee.List(prev.get('stats'))
current = ee.Image(current).select('angle')
meana = current.reduceRegion(ee.Reducer.mean(),geometry=rect,maxPixels= 1e9).get('angle')
mina = current.reduceRegion(ee.Reducer.min(),geometry=rect,maxPixels= 1e9).get('angle')
maxa = current.reduceRegion(ee.Reducer.max(),geometry=rect,maxPixels= 1e9).get('angle')
stats = stats.add(ee.Dictionary({'mina':mina,'meana':meana,'maxa':maxa}))
return ee.Dictionary({'stats':stats,'rect':rect})
示例10: clipList
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def clipList(current,prev):
''' clip a list of images '''
imlist = ee.List(ee.Dictionary(prev).get('imlist'))
rect = ee.Dictionary(prev).get('rect')
imlist = imlist.add(ee.Image(current).clip(rect))
return ee.Dictionary({'imlist':imlist,'rect':rect})
示例11: testInternals
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def testInternals(self):
"""Test eq(), ne() and hash()."""
a = ee.Dictionary({'one': 1})
b = ee.Dictionary({'two': 2})
c = ee.Dictionary({'one': 1})
self.assertEquals(a, a)
self.assertNotEquals(a, b)
self.assertEquals(a, c)
self.assertNotEquals(b, c)
self.assertNotEquals(hash(a), hash(b))
示例12: js_iter
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def js_iter(current,prev):
j = ee.Number(current)
prev = ee.Dictionary(prev)
median = prev.get('median')
p = prev.get('p')
imList = prev.get('imList')
pvs = ee.List(prev.get('pvs'))
return ee.Dictionary({'median':median,'p':p,'imList':imList,'pvs':pvs.add(pv(imList,p,median,j))})
示例13: ells_iter
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def ells_iter(current,prev):
ell = ee.Number(current)
prev = ee.Dictionary(prev)
pv_arr = ee.List(prev.get('pv_arr'))
k = ee.Number(prev.get('k'))
median = prev.get('median')
p = prev.get('p')
imList = ee.List(prev.get('imList'))
imList_ell = imList.slice(ell.subtract(1))
js = ee.List.sequence(2,k.subtract(ell).add(1))
first = ee.Dictionary({'median':median,'p':p,'imList':imList_ell,'pvs':ee.List([])})
# list of P-values for R_ell,j, j = 2...k-ell+1
pvs = ee.List(ee.Dictionary(js.iterate(js_iter,first)).get('pvs'))
return ee.Dictionary({'k':k,'p':p,'median':median,'imList':imList,'pv_arr':pv_arr.add(pvs)})
示例14: filter_ell
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def filter_ell(current,prev):
pvs = ee.List(current)
prev = ee.Dictionary(prev)
ell = ee.Number(prev.get('ell'))
threshold = ee.Image(prev.get('threshold'))
cmap = prev.get('cmap')
smap = prev.get('smap')
fmap = prev.get('fmap')
bmap = prev.get('bmap')
first = ee.Dictionary({'ell':ell,'j':1, 'threshold':threshold,'cmap':cmap,'smap':smap,'fmap':fmap,'bmap':bmap})
result = ee.Dictionary(ee.List(pvs).iterate(filter_j,first))
return ee.Dictionary({'ell':ell.add(1),'threshold':threshold,'cmap':result.get('cmap'),
'smap':result.get('smap'),
'fmap':result.get('fmap'),
'bmap':result.get('bmap')})
示例15: clipList
# 需要导入模块: import ee [as 别名]
# 或者: from ee import Dictionary [as 别名]
def clipList(current,prev):
imlist = ee.List(ee.Dictionary(prev).get('imlist'))
rect = ee.Dictionary(prev).get('rect')
imlist = imlist.add(ee.Image(current).clip(rect))
return ee.Dictionary({'imlist':imlist,'rect':rect})