ee.Dictionary.toArray

Restituisce i valori numerici di un dizionario come array. Se non vengono specificate chiavi, tutti i valori vengono restituiti nell'ordinamento naturale delle chiavi del dizionario. L'asse predefinito è 0.

UtilizzoResi
Dictionary.toArray(keys, axis)Array
ArgomentoTipoDettagli
questo: dictionaryDizionario
keysElenco, valore predefinito: null
axisNumero intero, valore predefinito: 0

Esempi

Editor di codice (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());

Configurazione di Python

Consulta la pagina Ambiente Python per informazioni sull'API Python e sull'utilizzo di geemap per lo sviluppo interattivo.

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())