ee.Dictionary.toArray

מחזירה ערכים מספריים של מילון כמערך. אם לא מציינים מפתחות, כל הערכים מוחזרים בסדר הטבעי של המפתחות במילון. ערך ברירת המחדל של 'axis' הוא 0.

שימושהחזרות
Dictionary.toArray(keys, axis)מערך
ארגומנטסוגפרטים
זה: dictionaryמילון
keysרשימה, ברירת מחדל: null
axisמספר שלם, ברירת מחדל: 0

דוגמאות

עורך הקוד (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

מידע על Python API ועל שימוש ב-geemap לפיתוח אינטראקטיבי מופיע בדף Python Environment.

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