ee.Image.arrayProject

यह फ़ंक्शन, हर पिक्सल में मौजूद कलेक्शन को कम डाइमेंशन वाली जगह पर प्रोजेक्ट करता है. इसके लिए, उन ऐक्सिस को तय किया जाता है जिन्हें बनाए रखना है. हटाए गए ऐक्सिस की लंबाई ज़्यादा से ज़्यादा 1 होनी चाहिए.

इस्तेमालरिटर्न
Image.arrayProject(axes)इमेज
आर्ग्यूमेंटटाइपविवरण
यह: inputइमेजइनपुट इमेज.
axesसूचीवे ऐक्सिस जिन्हें बनाए रखना है. अन्य ऐक्सिस को खारिज कर दिया जाएगा. इनकी लंबाई ज़्यादा से ज़्यादा 1 होनी चाहिए.

उदाहरण

कोड एडिटर (JavaScript)

// A function to print arrays for a selected pixel in the following examples.
function sampArrImg(arrImg) {
  var point = ee.Geometry.Point([-121, 42]);
  return arrImg.sample(point, 500).first().get('array');
}

// Create a 2D array image with the 0-axis having length 6 and the 1-axis
// having length 1.
var arrayImg2D = ee.Image([0, 1, 2, 3, 4, 5]).toArray().toArray(1);
print('2D array image (pixel)', sampArrImg(arrayImg2D));
// [[0],
//  [1],
//  [2],
//  [3],
//  [4],
//  [5]]

// Project the 2D array to a 1D array, retain the 0-axis (concatenate elements
// from the 1-axis into the 0-axis).
var arrayImg2Dto1D = arrayImg2D.arrayProject([0]);
print('2D array image (pixel)', sampArrImg(arrayImg2Dto1D));
// [0, 1, 2, 3, 4, 5]

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# A function to print arrays for a selected pixel in the following examples.
def samp_arr_img(arr_img):
  point = ee.Geometry.Point([-121, 42])
  return arr_img.sample(point, 500).first().get('array')

# Create a 2D array image with the 0-axis having length 6 and the 1-axis
# having length 1.
array_img_2d = ee.Image([0, 1, 2, 3, 4, 5]).toArray().toArray(1)
print('2D array image (pixel):', samp_arr_img(array_img_2d).getInfo())
# [[0],
#  [1],
#  [2],
#  [3],
#  [4],
#  [5]]

# Project the 2D array to a 1D array, retain the 0-axis (concatenate elements
# from the 1-axis into the 0-axis).
array_img_2d_to_1d = array_img_2d.arrayProject([0])
print('2D array image (pixel):', samp_arr_img(array_img_2d_to_1d).getInfo())
# [0, 1, 2, 3, 4, 5]