إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.Array.abs
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
على أساس كل عنصر على حدة، يتم احتساب القيمة المطلقة للإدخال.
الاستخدام | المرتجعات |
---|
Array.abs() | مصفوفة |
الوسيطة | النوع | التفاصيل |
---|
هذا: input | مصفوفة | مصفوفة الإدخال |
أمثلة
محرّر الرموز البرمجية (JavaScript)
print(ee.Array([-1]).abs()); // [1]
print(ee.Array([-2, 0, 2]).abs()); // [2,0,2]
print(ee.Array([[-3.1, -2], [-1, 0]]).abs()); // [[3.1,2],[1,0]]
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
geemap
للتطوير التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
display(ee.Array([-1]).abs()) # [1]
display(ee.Array([-2, 0, 2]).abs()) # [2, 0, 2]
display(ee.Array([[-3.1, -2], [-1, 0]]).abs()) # [[3.1, 2], [1, 0]]
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003eabs()\u003c/code\u003e function calculates the absolute value of each element in an input array.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts an array as input and returns a new array with the absolute values of the original elements.\u003c/p\u003e\n"],["\u003cp\u003eThe function works on arrays of any dimensions, including nested arrays.\u003c/p\u003e\n"],["\u003cp\u003eBoth JavaScript and Python APIs support the \u003ccode\u003eabs()\u003c/code\u003e function.\u003c/p\u003e\n"]]],["The `abs()` function computes the absolute value of each element in an input array. It takes an array as input (`this: input`) and returns a new array. The function operates element-wise, transforming negative values to their positive counterparts while leaving non-negative values unchanged. Examples show its use in JavaScript and Python, demonstrating its application to one-dimensional and two-dimensional arrays. In both cases it is used by the `.abs()` at the end of the array.\n"],null,["# ee.Array.abs\n\nOn an element-wise basis, computes the absolute value of the input.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------|---------|\n| Array.abs`()` | 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([-1]).abs()); // [1]\nprint(ee.Array([-2, 0, 2]).abs()); // [2,0,2]\nprint(ee.Array([[-3.1, -2], [-1, 0]]).abs()); // [[3.1,2],[1,0]]\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([-1]).abs()) # [1]\ndisplay(ee.Array([-2, 0, 2]).abs()) # [2, 0, 2]\ndisplay(ee.Array([[-3.1, -2], [-1, 0]]).abs()) # [[3.1, 2], [1, 0]]\n```"]]