公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
陣列總覽
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Earth Engine 會使用 ee.Array
類型表示 1 維向量、2 維矩陣、3 維立方體和更高維度的超立方體。陣列是彈性的資料結構,但為了換取其提供的強大功能,其擴充能力不如 Earth Engine 中的其他資料結構。如果問題可以不使用陣列來解決,結果的運算速度和效率會更快。不過,如果問題需要更高維度的模型、彈性線性代數或任何陣列特別適合的情況,您可以使用 Array
類別。
陣列維度、形狀和大小
陣列的維度是指沿著軸線變化底層資料的軸線數量。舉例來說,0 維陣列是標量數字、1 維陣列是向量、2 維陣列是矩陣、3 維陣列是立方體,而 3 維陣列以上則是超立方體。對於 N 維陣列,有 N 個軸,從 0 到 N-1。陣列的形狀取決於軸的長度。軸的長度是沿著軸的位數。陣列大小 (或陣列中的總元素數量) 等於軸長的乘積。每個軸上的每個位置都必須有有效的數字,因為系統目前不支援稀疏或不規則的陣列。陣列的元素類型會指出每個元素的數字類型;陣列的所有元素都會具有相同的類型。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eEarth Engine utilizes the \u003ccode\u003eee.Array\u003c/code\u003e type to represent vectors, matrices, cubes, and higher-dimensional hypercubes, offering a flexible but potentially less scalable data structure compared to other options.\u003c/p\u003e\n"],["\u003cp\u003eThe dimension of an array signifies the number of axes, with 0-D representing scalars, 1-D vectors, 2-D matrices, 3-D cubes, and beyond 3-D hypercubes.\u003c/p\u003e\n"],["\u003cp\u003eAn array's shape is defined by the lengths of its axes, while the total size is the product of these lengths, with each position containing a valid number due to the lack of support for sparse or ragged arrays.\u003c/p\u003e\n"]]],[],null,["Earth Engine represents 1-D vectors, 2-D matrices, 3-D cubes, and higher dimensional\nhypercubes with the `ee.Array` type. Arrays are a flexible data structure, but\nin exchange for the power they offer, they do not scale as well as other data structures\nin Earth Engine. If the problem can be solved without using arrays, the result will be\ncomputed faster and more efficiently. But if the problem requires a higher dimension model,\nflexible linear algebra, or anything else arrays are uniquely suited to, you can use\nthe `Array` class.\n\nArray dimension, shape and size\n\nThe dimension of an array refers to the number of axes along which the underlying data\nvaries. For example, 0-D arrays are scalar numbers, 1-D arrays are vectors, 2-D arrays\nare matrices, 3-D arrays are cubes, and \\\u003e3-D arrays are hyper-cubes. For an\nN-dimensional array, there are N axes from 0 to N-1. The shape of the array is\ndetermined by the lengths of the axes. The length of an axis is the number of positions\nalong it. The array size, or number of total elements in the array, equals the product\nof the axis lengths. Each value at every position on every axis must have a valid number,\nsince sparse or ragged arrays are not currently supported. The array's element type\nindicates what kind of number each element is; all elements of the array will have the\nsame type."]]