ee.Array.identity
Creates a 2D identity matrix of the given size.
Usage | Returns | ee.Array.identity(size) | Array |
Argument | Type | Details | size | Integer | The length of each axis. |
Examples
Code Editor (JavaScript)
// []
print(ee.Array.identity(0));
// [[1]]
print(ee.Array.identity(1));
// [[1,0],
// [0,1]]
print(ee.Array.identity(2));
// [[1,0,0],
// [0,1,0],
// [0,0,1]]
print(ee.Array.identity(3));
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
Colab (Python)
# []
display(ee.Array.identity(0))
# [[1]]
display(ee.Array.identity(1))
# [[1, 0],
# [0, 1]]
display(ee.Array.identity(2))
# [[1, 0, 0],
# [0, 1, 0],
# [0, 0, 1]]
display(ee.Array.identity(3))
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`ee.Array.identity()` generates a 2-dimensional identity matrix (a square matrix with 1s on the main diagonal and 0s elsewhere) with a specified size."],["The `size` argument determines the dimensions of the matrix, representing the length of each axis."],["An identity matrix with a size of 0 results in an empty array (`[]`), while sizes of 1, 2, and 3 create identity matrices of corresponding dimensions as shown in the examples."]]],[]]