Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
ee.Array.reduce
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Applica un riduttore a una matrice comprimendo tutti i valori di input lungo ciascun asse specificato in un singolo valore di output calcolato dal riduttore.
L'output ha sempre la stessa dimensionalità dell'input e gli assi individuali sono interessati come segue:
La lunghezza degli assi specificati nel parametro "axes" viene ridotta a 1 (applicando il riduttore).
Se il riduttore ha più input o output, l'asse specificato in "fieldAxis" verrà utilizzato per fornire gli input del riduttore e memorizzare i suoi output.
Tutti gli altri assi rimangono invariati (vengono eseguite riduzioni indipendenti).
Utilizzo | Resi |
---|
Array.reduce(reducer, axes, fieldAxis) | Array |
Argomento | Tipo | Dettagli |
---|
questo: array | Array | L'array. |
reducer | Riduttore | Il riduttore da applicare. Ciascun output deve essere un numero, non un array o un altro tipo. |
axes | Elenco | L'elenco degli assi su cui ridurre. L'output avrà una lunghezza di 1 in tutti questi assi. |
fieldAxis | Numero intero, valore predefinito: null | L'asse da utilizzare come campi di input e output del riduttore. Obbligatorio solo se il riduttore ha più input o più output, nel qual caso l'asse deve avere una lunghezza pari al numero di input del riduttore e nel risultato avrà una lunghezza pari al numero di output del riduttore. |
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eArray.reduce\u003c/code\u003e collapses input values along specified axes into single output values using a reducer function.\u003c/p\u003e\n"],["\u003cp\u003eThe output array retains the original input dimensionality, with specified axes reduced to length 1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003efieldAxis\u003c/code\u003e is used when your reducer has multiple inputs or outputs, aligning with those fields.\u003c/p\u003e\n"],["\u003cp\u003eIndependent reductions are performed along all other axes not specified in the \u003ccode\u003eaxes\u003c/code\u003e parameter.\u003c/p\u003e\n"]]],[],null,["# ee.Array.reduce\n\nApply a reducer to an array by collapsing all the input values along each specified axis into a single output value computed by the reducer.\n\n\u003cbr /\u003e\n\nThe output always has the same dimensionality as the input, and the individual axes are affected as follows:\n\n- The axes specified in the 'axes' parameter have their length reduced to 1 (by applying the reducer).\n\n- If the reducer has multiple inputs or multiple outputs, the axis specified in 'fieldAxis' will be used to provide the reducer's inputs and store the reducer's outputs.\n\n- All other axes are unaffected (independent reductions are performed).\n\n| Usage | Returns |\n|----------------------------------------------|---------|\n| Array.reduce`(reducer, axes, `*fieldAxis*`)` | Array |\n\n| Argument | Type | Details |\n|---------------|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| this: `array` | Array | The array. |\n| `reducer` | Reducer | The reducer to apply. Each of its outputs must be a number, not an array or other type. |\n| `axes` | List | The list of axes over which to reduce. The output will have a length of 1 in all these axes. |\n| `fieldAxis` | Integer, default: null | The axis to use as the reducer's input and output fields. Only required if the reducer has multiple inputs or multiple outputs, in which case the axis must have length equal to the number of reducer inputs, and in the result it will have length equal to the number of reducer outputs. |"]]