公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.List.sequence
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
生成从 start 到 end(含)的数字序列,增量为 step,或以 count 个等间距增量生成。如果未指定 end,则会根据 start + step * count 计算 end,因此必须指定 end 和 count 中的至少一个。
用法 | 返回 |
---|
ee.List.sequence(start, end, step, count) | 列表 |
参数 | 类型 | 详细信息 |
---|
start | 数字 | 起始编号。 |
end | 数字,默认值:null | 结束编号。 |
step | 数字,默认值:1 | 增量。 |
count | 整数,默认值:null | 增量数。 |
示例
代码编辑器 (JavaScript)
print(ee.List.sequence(0, 5)); // [0,1,2,3,4,5]
print(ee.List.sequence(0, 10, 2)); // [0,2,4,6,8,10]
print(ee.List.sequence(0, null, 2, 6)); // [0,2,4,6,8,10]
print(ee.List.sequence(0, null, -2, 6)); // [0,-2,-4,-6,-8,-10]
// Step ignored when present along with count.
print(ee.List.sequence(0, 10, 2, 999)); // 999 elements
print(ee.List.sequence(0, 10, 2, 3)); // [0,5,10]
// Using a dictionary for arguments.
print(ee.List.sequence({start:10, count:3})); // [10,11,12]
print(ee.List.sequence({start:3, step:2, end:6})); // [3,5]
// [-1000000000,0,1000000000]
print(ee.List.sequence({start:-1e9, end:1e9, count:3}));
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
print(ee.List.sequence(0, 5).getInfo()) # [0, 1, 2, 3, 4, 5]
print(ee.List.sequence(0, 10, 2).getInfo()) # [0, 2, 4, 6, 8, 10]
print(ee.List.sequence(0, None, 2, 6).getInfo()) # [0, 2, 4, 6, 8, 10]
print(ee.List.sequence(0, None, -2, 6).getInfo()) # [0, -2, -4, -6, -8, -10]
# Step ignored when present along with count.
print(ee.List.sequence(0, 10, 2, 999).getInfo()) # 999 elements
print(ee.List.sequence(0, 10, 2, 3).getInfo()) # [0, 5, 10]
# Using a dictionary for arguments.
print(ee.List.sequence(start=10, count=3).getInfo()) # [10, 11, 12]
print(ee.List.sequence(start=3, step=2, end=6).getInfo()) # [3, 5]
# [-1000000000, 0, 1000000000]
print(ee.List.sequence(start=-1e9, end=1e9, count=3).getInfo())
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eee.List.sequence\u003c/code\u003e generates a list of numbers within a specified range, determined by \u003ccode\u003estart\u003c/code\u003e, \u003ccode\u003eend\u003c/code\u003e, \u003ccode\u003estep\u003c/code\u003e, and \u003ccode\u003ecount\u003c/code\u003e parameters.\u003c/p\u003e\n"],["\u003cp\u003eYou must define either the \u003ccode\u003eend\u003c/code\u003e or \u003ccode\u003ecount\u003c/code\u003e parameter alongside the \u003ccode\u003estart\u003c/code\u003e parameter to determine the sequence range.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003estep\u003c/code\u003e parameter defines the increment between numbers in the sequence and defaults to 1 if not specified.\u003c/p\u003e\n"],["\u003cp\u003eWhen both \u003ccode\u003estep\u003c/code\u003e and \u003ccode\u003ecount\u003c/code\u003e are specified, \u003ccode\u003estep\u003c/code\u003e is ignored and the sequence is divided into equally spaced increments based on \u003ccode\u003ecount\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can provide arguments as a dictionary using keys like \u003ccode\u003estart\u003c/code\u003e, \u003ccode\u003eend\u003c/code\u003e, \u003ccode\u003estep\u003c/code\u003e, and \u003ccode\u003ecount\u003c/code\u003e for better readability.\u003c/p\u003e\n"]]],[],null,["# ee.List.sequence\n\nGenerate a sequence of numbers from start to end (inclusive) in increments of step, or in count equally-spaced increments. If end is not specified it is computed from start + step \\* count, so at least one of end or count must be specified.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------------|---------|\n| `ee.List.sequence(start, `*end* `, `*step* `, `*count*`)` | List |\n\n| Argument | Type | Details |\n|----------|------------------------|---------------------------|\n| `start` | Number | The starting number. |\n| `end` | Number, default: null | The ending number. |\n| `step` | Number, default: 1 | The increment. |\n| `count` | Integer, default: null | The number of increments. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(ee.List.sequence(0, 5)); // [0,1,2,3,4,5]\nprint(ee.List.sequence(0, 10, 2)); // [0,2,4,6,8,10]\nprint(ee.List.sequence(0, null, 2, 6)); // [0,2,4,6,8,10]\nprint(ee.List.sequence(0, null, -2, 6)); // [0,-2,-4,-6,-8,-10]\n\n// Step ignored when present along with count.\nprint(ee.List.sequence(0, 10, 2, 999)); // 999 elements\nprint(ee.List.sequence(0, 10, 2, 3)); // [0,5,10]\n\n// Using a dictionary for arguments.\nprint(ee.List.sequence({start:10, count:3})); // [10,11,12]\nprint(ee.List.sequence({start:3, step:2, end:6})); // [3,5]\n// [-1000000000,0,1000000000]\nprint(ee.List.sequence({start:-1e9, end:1e9, count:3}));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nprint(ee.List.sequence(0, 5).getInfo()) # [0, 1, 2, 3, 4, 5]\nprint(ee.List.sequence(0, 10, 2).getInfo()) # [0, 2, 4, 6, 8, 10]\nprint(ee.List.sequence(0, None, 2, 6).getInfo()) # [0, 2, 4, 6, 8, 10]\nprint(ee.List.sequence(0, None, -2, 6).getInfo()) # [0, -2, -4, -6, -8, -10]\n\n# Step ignored when present along with count.\nprint(ee.List.sequence(0, 10, 2, 999).getInfo()) # 999 elements\nprint(ee.List.sequence(0, 10, 2, 3).getInfo()) # [0, 5, 10]\n\n# Using a dictionary for arguments.\nprint(ee.List.sequence(start=10, count=3).getInfo()) # [10, 11, 12]\nprint(ee.List.sequence(start=3, step=2, end=6).getInfo()) # [3, 5]\n# [-1000000000, 0, 1000000000]\nprint(ee.List.sequence(start=-1e9, end=1e9, count=3).getInfo())\n```"]]