ee.Dictionary.toArray

Gibt numerische Werte eines Dictionary als Array zurück. Wenn keine Schlüssel angegeben sind, werden alle Werte in der natürlichen Reihenfolge der Schlüssel des Dictionarys zurückgegeben. Der Standardwert für „axis“ ist 0.

NutzungAusgabe
Dictionary.toArray(keys, axis)Array
ArgumentTypDetails
So gehts: dictionaryWörterbuch
keysListe, Standard: null
axisGanzzahl, Standardwert: 0

Beispiele

Code-Editor (JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

print('Values for selected keys converted to ee.Array',
      dict.toArray(['B1', 'B2']));
print('Values for all keys converted to ee.Array',
      dict.toArray());

Python einrichten

Informationen zur Python API und zur Verwendung von geemap für die interaktive Entwicklung finden Sie auf der Seite Python-Umgebung.

import ee
import geemap.core as geemap

Colab (Python)

# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
    'B1': 182,
    'B2': 219,
    'B3': 443
})

print('Values for selected keys converted to ee.Array:',
      dic.toArray(['B1', 'B2']).getInfo())
print('Values for all keys converted to ee.Array:',
      dic.toArray().getInfo())