geetools.Dictionary#

Extra methods for the ee.Dictionary class.

Package Contents#

Classes#

DictionaryAccessor

Toolbox for the ee.Dictionary class.

class geetools.Dictionary.DictionaryAccessor(obj)[source]#

Toolbox for the ee.Dictionary class.

Initialize the Dictionary class.

Parameters:

obj (ee.Dictionary) –

fromPairs(list)[source]#

Create a dictionary from a list of [[key, value], …]] pairs.

Parameters:

list (geetools.types.ee_list) – A list of pairs (key, value).

Returns:

A dictionary using the pairs.

Return type:

ee.Dictionary

Examples

import ee, geetools

ee.Initialize()

d = ee.Dictionary.geetools.fromPairs([["foo", 1], ["bar", 2]])
d.getInfo()
getMany(list)[source]#

Extract values from a list of keys.

Parameters:

list (geetools.types.ee_list) – A list of keys.

Returns:

A list of values.

Return type:

ee.List

Examples

import ee, geetools

ee.Initialize()

d = ee.Dictionary({"foo": 1, "bar": 2, "baz": 3})
d.geetools.getMany(["foo", "bar"]).getInfo()
sort()[source]#

Sort the dictionary by keys in ascending order.

Returns:

The sorted dictionary.

Return type:

ee.Dictionary

Examples

import ee, geetools

ee.Initialize()

d = ee.Dictionary({"foo": 1, "bar": 2}).geetools.sort()
d.getInfo()