ee.List.sequence

Genera una sequenza di numeri dall'inizio alla fine (inclusi) con incrementi di passo o con incrementi di conteggio equidistanti. Se la fine non è specificata, viene calcolata da inizio + passo * conteggio, quindi deve essere specificato almeno uno tra fine e conteggio.

UtilizzoResi
ee.List.sequence(start, end, step, count)Elenco
ArgomentoTipoDettagli
startNumeroIl numero iniziale.
endNumero, valore predefinito: nullIl numero finale.
stepNumero, valore predefinito: 1L'incremento.
countNumero intero, valore predefinito: nullIl numero di incrementi.

Esempi

Editor di codice (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}));

Configurazione di Python

Consulta la pagina Ambiente Python per informazioni sull'API Python e sull'utilizzo di geemap per lo sviluppo interattivo.

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