ee.Array.byte
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह फ़ंक्शन, एलिमेंट के हिसाब से इनपुट वैल्यू को बिना साइन किए गए 8-बिट पूर्णांक में बदलता है.
इस्तेमाल | रिटर्न |
---|
Array.byte() | Array |
आर्ग्यूमेंट | टाइप | विवरण |
---|
यह: input | Array | इनपुट ऐरे. |
उदाहरण
कोड एडिटर (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 सेटअप करना
Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap
का इस्तेमाल करने के बारे में जानकारी पाने के लिए,
Python एनवायरमेंट पेज देखें.
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()) # [[], []]
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 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```"]]