ee.Array.bitCount
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
بر اساس عنصر، تعداد تک بیت ها را در نمایش دودویی مکمل 64 بیتی ورودی محاسبه می کند.
استفاده | برمی گرداند | Array. bitCount () | آرایه |
استدلال | تایپ کنید | جزئیات | این: input | آرایه | آرایه ورودی |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
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]
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
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]
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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```"]]