公告:所有在
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。数组的形状由轴的长度决定。轴的长度是沿轴的轴心位置数。数组大小(即数组中的元素总数)等于轴长度的乘积。由于目前不支持稀疏或不规则数组,因此每个轴上的每个位置的每个值都必须是有效数字。数组的元素类型表示每个元素是什么类型的数字;数组的所有元素都将具有相同的类型。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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."]]