Anúncio: todos os projetos não comerciais registrados para usar o Earth Engine antes de
15 de abril de 2025 precisam
verificar a qualificação não comercial para manter o acesso ao Earth Engine.
ee.Image.arrayCat
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Cria uma imagem de matriz concatenando cada pixel da matriz ao longo do eixo especificado em cada banda.
Uso | Retorna |
---|
Image.arrayCat(image2, axis) | Imagem |
Argumento | Tipo | Detalhes |
---|
isso: image1 | Imagem | Primeira imagem da matriz a ser concatenada. |
image2 | Imagem | Segunda imagem da matriz a ser concatenada. |
axis | Número inteiro | Eixo ao longo do qual concatenar. |
Exemplos
Editor de código (JavaScript)
// A function to print arrays for a selected pixel in the following examples.
function sampArrImg(arrImg) {
var point = ee.Geometry.Point([-121, 42]);
return arrImg.sample(point, 500).first().get('array');
}
// Create two 1D array images.
var arrayImg1Da = ee.Image([0, 1, 2]).toArray();
print('1D array image (A) (pixel)', sampArrImg(arrayImg1Da));
// [0, 1, 2]
var arrayImg1Db = ee.Image([3, 4, 5]).toArray();
print('1D array image (B) (pixel)', sampArrImg(arrayImg1Db));
// [3, 4, 5]
// Concatenate 1D array image B to 1D array image A on 0-axis (rows).
var arrayImg1DcatAx0 = arrayImg1Da.arrayCat(arrayImg1Db, 0);
print('Concatenate 1D array images on 0-axis', sampArrImg(arrayImg1DcatAx0));
// [0, 1, 2, 3, 4, 5]
// Concatenate 1D array image B to 1D array image A on 1-axis (columns).
var arrayImg1DcatAx1 = arrayImg1Da.arrayCat(arrayImg1Db, 1);
print('Concatenate 1D array images on 1-axis', sampArrImg(arrayImg1DcatAx1));
// [[0, 3],
// [1, 4]
// [2, 5]]
// Create two 2D array images (expand the dimensions of 1D arrays).
var arrayImg2Da = arrayImg1Da.toArray(1);
print('2D array image (A) (pixel)', sampArrImg(arrayImg2Da));
// [[0],
// [1],
// [2]]
var arrayImg2Db = arrayImg1Db.toArray(1);
print('2D array image (B) (pixel)', sampArrImg(arrayImg2Db));
// [[3],
// [4],
// [5]]
// Concatenate 2D array image B to 2D array image A on 0-axis (rows).
var arrayImg2DcatAx0 = arrayImg2Da.arrayCat(arrayImg2Db, 0);
print('Concatenate 2D array images on 0-axis', sampArrImg(arrayImg2DcatAx0));
// [[0],
// [1],
// [2],
// [3],
// [4],
// [5]]
// Concatenate 2D array image B to 2D array image A on 1-axis (columns).
var arrayImg2DcatAx1 = arrayImg2Da.arrayCat(arrayImg2Db, 1);
print('Concatenate 2D array images on 1-axis', sampArrImg(arrayImg2DcatAx1));
// [[0, 3],
// [1, 4],
// [2, 5]]
Configuração do Python
Consulte a página
Ambiente Python para informações sobre a API Python e como usar
geemap
para desenvolvimento interativo.
import ee
import geemap.core as geemap
Colab (Python)
# A function to print arrays for a selected pixel in the following examples.
def samp_arr_img(arr_img):
point = ee.Geometry.Point([-121, 42])
return arr_img.sample(point, 500).first().get('array')
# Create two 1D array images.
array_img_1d_a = ee.Image([0, 1, 2]).toArray()
print('1D array image (A) (pixel):', samp_arr_img(array_img_1d_a).getInfo())
# [0, 1, 2]
array_img_1d_b = ee.Image([3, 4, 5]).toArray()
print('1D array image (B) (pixel):', samp_arr_img(array_img_1d_b).getInfo())
# [3, 4, 5]
# Concatenate 1D array image B to 1D array image A on 0-axis (rows).
array_img_1d_cat_ax0 = array_img_1d_a.arrayCat(array_img_1d_b, 0)
print(
'Concatenate 1D array images on 0-axis:',
samp_arr_img(array_img_1d_cat_ax0).getInfo()
)
# [0, 1, 2, 3, 4, 5]
# Concatenate 1D array image B to 1D array image A on 1-axis (columns).
array_img_1d_cat_ax1 = array_img_1d_a.arrayCat(array_img_1d_b, 1)
print(
'Concatenate 1D array images on 1-axis:',
samp_arr_img(array_img_1d_cat_ax1).getInfo()
)
# [[0, 3],
# [1, 4]
# [2, 5]]
# Create two 2D array images (expand the dimensions of 1D arrays).
array_img_2d_a = array_img_1d_a.toArray(1)
print('2D array image (A) (pixel):', samp_arr_img(array_img_2d_a).getInfo())
# [[0],
# [1],
# [2]]
array_img_2d_b = array_img_1d_b.toArray(1)
print('2D array image (B) (pixel):', samp_arr_img(array_img_2d_b).getInfo())
# [[3],
# [4],
# [5]]
# Concatenate 2D array image B to 2D array image A on 0-axis (rows).
array_img_2d_cat_ax0 = array_img_2d_a.arrayCat(array_img_2d_b, 0)
print(
'Concatenate 2D array images on 0-axis:',
samp_arr_img(array_img_2d_cat_ax0).getInfo()
)
# [[0],
# [1],
# [2],
# [3],
# [4],
# [5]]
# Concatenate 2D array image B to 2D array image A on 1-axis (columns).
array_img_2d_cat_ax1 = array_img_2d_a.arrayCat(array_img_2d_b, 1)
print(
'Concatenate 2D array images on 1-axis:',
samp_arr_img(array_img_2d_cat_ax1).getInfo()
)
# [[0, 3],
# [1, 4],
# [2, 5]]
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eImage.arrayCat()\u003c/code\u003e combines two array images by concatenating their pixels along a specified axis (0 for rows, 1 for columns).\u003c/p\u003e\n"],["\u003cp\u003eThis function accepts two array images and the axis of concatenation as input, returning a new, combined array image.\u003c/p\u003e\n"],["\u003cp\u003eThe resulting array image has dimensions determined by the original images and the chosen concatenation axis.\u003c/p\u003e\n"],["\u003cp\u003eIt can be used to combine 1D or 2D array images, effectively expanding their dimensions or creating multi-band array images.\u003c/p\u003e\n"]]],[],null,["# ee.Image.arrayCat\n\nCreates an array image by concatenating each array pixel along the given axis in each band.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------|---------|\n| Image.arrayCat`(image2, axis)` | Image |\n\n| Argument | Type | Details |\n|----------------|---------|------------------------------------|\n| this: `image1` | Image | First array image to concatenate. |\n| `image2` | Image | Second array image to concatenate. |\n| `axis` | Integer | Axis to concatenate along. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A function to print arrays for a selected pixel in the following examples.\nfunction sampArrImg(arrImg) {\n var point = ee.Geometry.Point([-121, 42]);\n return arrImg.sample(point, 500).first().get('array');\n}\n\n// Create two 1D array images.\nvar arrayImg1Da = ee.Image([0, 1, 2]).toArray();\nprint('1D array image (A) (pixel)', sampArrImg(arrayImg1Da));\n// [0, 1, 2]\nvar arrayImg1Db = ee.Image([3, 4, 5]).toArray();\nprint('1D array image (B) (pixel)', sampArrImg(arrayImg1Db));\n// [3, 4, 5]\n\n// Concatenate 1D array image B to 1D array image A on 0-axis (rows).\nvar arrayImg1DcatAx0 = arrayImg1Da.arrayCat(arrayImg1Db, 0);\nprint('Concatenate 1D array images on 0-axis', sampArrImg(arrayImg1DcatAx0));\n// [0, 1, 2, 3, 4, 5]\n\n// Concatenate 1D array image B to 1D array image A on 1-axis (columns).\nvar arrayImg1DcatAx1 = arrayImg1Da.arrayCat(arrayImg1Db, 1);\nprint('Concatenate 1D array images on 1-axis', sampArrImg(arrayImg1DcatAx1));\n// [[0, 3],\n// [1, 4]\n// [2, 5]]\n\n// Create two 2D array images (expand the dimensions of 1D arrays).\nvar arrayImg2Da = arrayImg1Da.toArray(1);\nprint('2D array image (A) (pixel)', sampArrImg(arrayImg2Da));\n// [[0],\n// [1],\n// [2]]\nvar arrayImg2Db = arrayImg1Db.toArray(1);\nprint('2D array image (B) (pixel)', sampArrImg(arrayImg2Db));\n// [[3],\n// [4],\n// [5]]\n\n// Concatenate 2D array image B to 2D array image A on 0-axis (rows).\nvar arrayImg2DcatAx0 = arrayImg2Da.arrayCat(arrayImg2Db, 0);\nprint('Concatenate 2D array images on 0-axis', sampArrImg(arrayImg2DcatAx0));\n// [[0],\n// [1],\n// [2],\n// [3],\n// [4],\n// [5]]\n\n// Concatenate 2D array image B to 2D array image A on 1-axis (columns).\nvar arrayImg2DcatAx1 = arrayImg2Da.arrayCat(arrayImg2Db, 1);\nprint('Concatenate 2D array images on 1-axis', sampArrImg(arrayImg2DcatAx1));\n// [[0, 3],\n// [1, 4],\n// [2, 5]]\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\n# A function to print arrays for a selected pixel in the following examples.\ndef samp_arr_img(arr_img):\n point = ee.Geometry.Point([-121, 42])\n return arr_img.sample(point, 500).first().get('array')\n\n# Create two 1D array images.\narray_img_1d_a = ee.Image([0, 1, 2]).toArray()\nprint('1D array image (A) (pixel):', samp_arr_img(array_img_1d_a).getInfo())\n# [0, 1, 2]\narray_img_1d_b = ee.Image([3, 4, 5]).toArray()\nprint('1D array image (B) (pixel):', samp_arr_img(array_img_1d_b).getInfo())\n# [3, 4, 5]\n\n# Concatenate 1D array image B to 1D array image A on 0-axis (rows).\narray_img_1d_cat_ax0 = array_img_1d_a.arrayCat(array_img_1d_b, 0)\nprint(\n 'Concatenate 1D array images on 0-axis:',\n samp_arr_img(array_img_1d_cat_ax0).getInfo()\n)\n# [0, 1, 2, 3, 4, 5]\n\n# Concatenate 1D array image B to 1D array image A on 1-axis (columns).\narray_img_1d_cat_ax1 = array_img_1d_a.arrayCat(array_img_1d_b, 1)\nprint(\n 'Concatenate 1D array images on 1-axis:',\n samp_arr_img(array_img_1d_cat_ax1).getInfo()\n)\n# [[0, 3],\n# [1, 4]\n# [2, 5]]\n\n# Create two 2D array images (expand the dimensions of 1D arrays).\narray_img_2d_a = array_img_1d_a.toArray(1)\nprint('2D array image (A) (pixel):', samp_arr_img(array_img_2d_a).getInfo())\n# [[0],\n# [1],\n# [2]]\narray_img_2d_b = array_img_1d_b.toArray(1)\nprint('2D array image (B) (pixel):', samp_arr_img(array_img_2d_b).getInfo())\n# [[3],\n# [4],\n# [5]]\n\n# Concatenate 2D array image B to 2D array image A on 0-axis (rows).\narray_img_2d_cat_ax0 = array_img_2d_a.arrayCat(array_img_2d_b, 0)\nprint(\n 'Concatenate 2D array images on 0-axis:',\n samp_arr_img(array_img_2d_cat_ax0).getInfo()\n)\n# [[0],\n# [1],\n# [2],\n# [3],\n# [4],\n# [5]]\n\n# Concatenate 2D array image B to 2D array image A on 1-axis (columns).\narray_img_2d_cat_ax1 = array_img_2d_a.arrayCat(array_img_2d_b, 1)\nprint(\n 'Concatenate 2D array images on 1-axis:',\n samp_arr_img(array_img_2d_cat_ax1).getInfo()\n)\n# [[0, 3],\n# [1, 4],\n# [2, 5]]\n```"]]