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.bitCount
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Girişin 64 bitlik ikinin tamamlayıcısı ikili gösterimindeki bir bitlerinin sayısını öğe bazında hesaplar.
Kullanım | İadeler |
---|
Array.bitCount() | Dizi |
Bağımsız Değişken | Tür | Ayrıntılar |
---|
bu: input | Dizi | Giriş dizisi. |
Örnekler
Kod Düzenleyici (JavaScript)
print(ee.Array([], ee.PixelType.int8()).bitCount()); // []
print(ee.Array([0]).bitCount()); // [0]
print(ee.Array([1]).bitCount()); // [1]
print(ee.Array([2]).bitCount()); // [1]
print(ee.Array([3]).bitCount()); // [2]
print(ee.Array([0xFFFF]).bitCount()); // [16]
print(ee.Array([1, 2, 3]).bitCount()); // [1,1,2]
print(ee.Array([[0, 1], [6, 13]]).bitCount()); // [[0,1],[2,3]]
// https://en.wikipedia.org/wiki/Two's_complement signed values.
print(ee.Array([-1]).bitCount()); // [64]
print(ee.Array([-1], ee.PixelType.int8()).bitCount()); // [64]
print(ee.Array([-2]).bitCount()); // [63]
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)
display(ee.Array([], ee.PixelType.int8()).bitCount()) # []
display(ee.Array([0]).bitCount()) # [0]
display(ee.Array([1]).bitCount()) # [1]
display(ee.Array([2]).bitCount()) # [1]
display(ee.Array([3]).bitCount()) # [2]
display(ee.Array([0xFFFF]).bitCount()) # [16]
display(ee.Array([1, 2, 3]).bitCount()) # [1, 1, 2]
display(ee.Array([[0, 1], [6, 13]]).bitCount()) # [[0, 1], [2, 3]]
# https://en.wikipedia.org/wiki/Two's_complement signed values.
display(ee.Array([-1]).bitCount()) # [64]
display(ee.Array([-1], ee.PixelType.int8()).bitCount()) # [64]
display(ee.Array([-2]).bitCount()) # [63]
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-27 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eArray.bitCount()\u003c/code\u003e calculates the number of 1s in the binary representation of each element in an array.\u003c/p\u003e\n"],["\u003cp\u003eIt operates on 64-bit two's complement binary representation, supporting both positive and negative integers.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns an array with the same dimensions as the input, where each element represents the bit count of the corresponding input element.\u003c/p\u003e\n"],["\u003cp\u003eThis method works for arrays of various data types, including int8, int16, int32, and int64.\u003c/p\u003e\n"],["\u003cp\u003eIt handles empty arrays, single-element arrays, multi-dimensional arrays, and arrays with both positive and negative numbers.\u003c/p\u003e\n"]]],["The `bitCount()` function calculates the number of one-bits in the 64-bit two's complement binary representation of each element in an input array. It operates element-wise and returns a new array with the same shape as the input. The input array can contain positive or negative integers, and the output array provides the one-bit count for each corresponding element. For example, `ee.Array([1, 2, 3]).bitCount()` returns `[1, 1, 2]`.\n"],null,["# ee.Array.bitCount\n\nOn an element-wise basis, calculates the number of one-bits in the 64-bit two's complement binary representation of the input.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------|---------|\n| Array.bitCount`()` | 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\nprint(ee.Array([], ee.PixelType.int8()).bitCount()); // []\n\nprint(ee.Array([0]).bitCount()); // [0]\nprint(ee.Array([1]).bitCount()); // [1]\nprint(ee.Array([2]).bitCount()); // [1]\nprint(ee.Array([3]).bitCount()); // [2]\nprint(ee.Array([0xFFFF]).bitCount()); // [16]\nprint(ee.Array([1, 2, 3]).bitCount()); // [1,1,2]\n\nprint(ee.Array([[0, 1], [6, 13]]).bitCount()); // [[0,1],[2,3]]\n\n// https://en.wikipedia.org/wiki/Two's_complement signed values.\nprint(ee.Array([-1]).bitCount()); // [64]\nprint(ee.Array([-1], ee.PixelType.int8()).bitCount()); // [64]\nprint(ee.Array([-2]).bitCount()); // [63]\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\ndisplay(ee.Array([], ee.PixelType.int8()).bitCount()) # []\n\ndisplay(ee.Array([0]).bitCount()) # [0]\ndisplay(ee.Array([1]).bitCount()) # [1]\ndisplay(ee.Array([2]).bitCount()) # [1]\ndisplay(ee.Array([3]).bitCount()) # [2]\ndisplay(ee.Array([0xFFFF]).bitCount()) # [16]\ndisplay(ee.Array([1, 2, 3]).bitCount()) # [1, 1, 2]\n\ndisplay(ee.Array([[0, 1], [6, 13]]).bitCount()) # [[0, 1], [2, 3]]\n\n# https://en.wikipedia.org/wiki/Two's_complement signed values.\ndisplay(ee.Array([-1]).bitCount()) # [64]\ndisplay(ee.Array([-1], ee.PixelType.int8()).bitCount()) # [64]\ndisplay(ee.Array([-2]).bitCount()) # [63]\n```"]]