Duyuru:
15 Nisan 2025'ten önce Earth Engine'i kullanmak için kaydedilen tüm ticari olmayan projelerin Earth Engine erişimini sürdürmek için
ticari olmayan uygunluğu doğrulaması gerekir.
ee.Array.byte
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Giriş değerini öğe bazında 8 bitlik işaretsiz bir tamsayıya dönüştürür.
Kullanım | İadeler |
---|
Array.byte() | Dizi |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
bu: input | Dizi | Giriş dizisi. |
Örnekler
Kod Düzenleyici (JavaScript)
// Clamps below at 0.
print(ee.Array([-1]).byte()); // [0]
print(ee.Array([255]).byte()); // [255]
// Clamps above at 255.
print(ee.Array([256]).byte()); // [255]
// Rounds. [0,0,1,127,255,255]
print(ee.Array([-0.1, 0.1, 0.5, 127.1, 255.1, 255.9]).byte());
// Requires an explicit PixelType if no data.
print(ee.Array([[], []], ee.PixelType.float()).byte()); // Empty [[], []]
Python kurulumu
Python API'si ve etkileşimli geliştirme için geemap
kullanımı hakkında bilgi edinmek üzere
Python Ortamı sayfasına bakın.
import ee
import geemap.core as geemap
Colab (Python)
# Clamps below at 0.
display(ee.Array([-1]).byte()) # [0]
display(ee.Array([255]).byte()) # [255]
# Clamps above at 255.
display(ee.Array([256]).byte()) # [255]
# Rounds. [0, 0, 1, 127, 255, 255]
display(ee.Array([-0.1, 0.1, 0.5, 127.1, 255.1, 255.9]).byte())
# Requires an explicit PixelType if no data.
display(ee.Array([[], []], ee.PixelType.float()).byte()) # [[], []]
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eArray.byte()\u003c/code\u003e casts the input array values to unsigned 8-bit integers, element-wise.\u003c/p\u003e\n"],["\u003cp\u003eValues less than 0 are clamped to 0, and values greater than 255 are clamped to 255.\u003c/p\u003e\n"],["\u003cp\u003eInput values are rounded to the nearest integer before casting.\u003c/p\u003e\n"],["\u003cp\u003eWhen the input array has no data, an explicit \u003ccode\u003ePixelType\u003c/code\u003e is required.\u003c/p\u003e\n"]]],["The `Array.byte()` method casts array elements to unsigned 8-bit integers. Input values below 0 are clamped to 0, while values above 255 are clamped to 255. Decimal values are rounded to the nearest integer. If the input array is empty, an explicit `PixelType` is needed. This method returns a new array with the transformed elements. It can be used in both JavaScript and Python.\n"],null,["# ee.Array.byte\n\nOn an element-wise basis, casts the input value to an unsigned 8-bit integer.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|----------------|---------|\n| Array.byte`()` | Array |\n\n| Argument | Type | Details |\n|---------------|-------|------------------|\n| this: `input` | Array | The input array. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Clamps below at 0.\nprint(ee.Array([-1]).byte()); // [0]\nprint(ee.Array([255]).byte()); // [255]\n// Clamps above at 255.\nprint(ee.Array([256]).byte()); // [255]\n\n// Rounds. [0,0,1,127,255,255]\nprint(ee.Array([-0.1, 0.1, 0.5, 127.1, 255.1, 255.9]).byte());\n\n// Requires an explicit PixelType if no data.\nprint(ee.Array([[], []], ee.PixelType.float()).byte()); // Empty [[], []]\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# Clamps below at 0.\ndisplay(ee.Array([-1]).byte()) # [0]\ndisplay(ee.Array([255]).byte()) # [255]\n# Clamps above at 255.\ndisplay(ee.Array([256]).byte()) # [255]\n\n# Rounds. [0, 0, 1, 127, 255, 255]\ndisplay(ee.Array([-0.1, 0.1, 0.5, 127.1, 255.1, 255.9]).byte())\n\n# Requires an explicit PixelType if no data.\ndisplay(ee.Array([[], []], ee.PixelType.float()).byte()) # [[], []]\n```"]]