ee.data.computePixels (Python only)
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
یک کاشی را با انجام یک محاسبه دلخواه روی داده های تصویر محاسبه می کند.
برمی گرداند: پیکسل ها به عنوان داده های تصویر خام.
استفاده | برمی گرداند | ee.data.computePixels(params) | شیء|مقدار |
استدلال | تایپ کنید | جزئیات | params | شیء | یک شی حاوی پارامترهایی با مقادیر ممکن زیر: expression - عبارت برای محاسبه. fileFormat - فرمت فایل حاصل. به صورت پیش فرض png است. برای فرمت های موجود به ImageFileFormat مراجعه کنید. فرمت های دیگری وجود دارد که شی دانلود شده را به یک شی داده پایتون تبدیل می کند. این موارد عبارتند از: NUMPY_NDARRAY ، که به یک آرایه NumPy ساختار یافته تبدیل می شود. grid - پارامترهایی که شبکه پیکسلی را که در آن داده ها را واکشی می کند، توصیف می کند. پیشفرض شبکه پیکسلی دادهها. bandIds - در صورت وجود، مجموعه خاصی از باندها را مشخص می کند که از آن پیکسل ها دریافت می شود. visualizationOptions - در صورت وجود، مجموعهای از گزینههای تجسم برای ایجاد یک تصویرسازی RGB 8 بیتی از دادهها، به جای بازگرداندن دادههای خام اعمال میشود. workloadTag - برچسب ارائه شده توسط کاربر برای ردیابی این محاسبات. |
نمونه ها
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
# Region of interest.
coords = [
-121.58626826832939,
38.059141484827485,
]
region = ee.Geometry.Point(coords)
# Sentinel-2 median composite.
image = (ee.ImageCollection('COPERNICUS/S2')
.filterBounds(region)
.filterDate('2020-04-01', '2020-09-01')
.median())
# Make a projection to discover the scale in degrees.
proj = ee.Projection('EPSG:4326').atScale(10).getInfo()
# Get scales out of the transform.
scale_x = proj['transform'][0]
scale_y = -proj['transform'][4]
# Make a request object.
request = {
'expression': image,
'fileFormat': 'PNG',
'bandIds': ['B4', 'B3', 'B2'],
'grid': {
'dimensions': {
'width': 640,
'height': 640
},
'affineTransform': {
'scaleX': scale_x,
'shearX': 0,
'translateX': coords[0],
'shearY': 0,
'scaleY': scale_y,
'translateY': coords[1]
},
'crsCode': proj['crs'],
},
'visualizationOptions': {'ranges': [{'min': 0, 'max': 3000}]},
}
image_png = ee.data.computePixels(request)
# Do something with the image...
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003ccode\u003eee.data.computePixels\u003c/code\u003e computes a tile by performing an arbitrary computation on image data and returns the pixels as raw image data.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eparams\u003c/code\u003e argument to \u003ccode\u003eee.data.computePixels\u003c/code\u003e allows for customizing the computation through an expression, file format, pixel grid, band selection, visualization options, and workload tag.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Python example demonstrates using \u003ccode\u003eee.data.computePixels\u003c/code\u003e to retrieve a PNG image tile from a Sentinel-2 median composite with specified visualization and grid parameters.\u003c/p\u003e\n"]]],[],null,["# ee.data.computePixels (Python only)\n\n\u003cbr /\u003e\n\nComputes a tile by performing an arbitrary computation on image data.\n\n\u003cbr /\u003e\n\nReturns:\nThe pixels as raw image data.\n\n| Usage | Returns |\n|---------------------------------|---------------|\n| `ee.data.computePixels(params)` | Object\\|Value |\n\n| Argument | Type | Details |\n|----------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `params` | Object | An object containing parameters with the following possible values: `expression` - The expression to compute. `fileFormat` - The resulting file format. Defaults to png. See [ImageFileFormat](https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat) for the available formats. There are additional formats that convert the downloaded object to a Python data object. These include: `NUMPY_NDARRAY`, which converts to a structured NumPy array. `grid` - Parameters describing the pixel grid in which to fetch data. Defaults to the native pixel grid of the data. `bandIds` - If present, specifies a specific set of bands from which to get pixels. `visualizationOptions` - If present, a set of visualization options to apply to produce an 8-bit RGB visualization of the data, rather than returning the raw data. `workloadTag` - User supplied tag to track this computation. |\n\nExamples\n--------\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# Region of interest.\ncoords = [\n -121.58626826832939,\n 38.059141484827485,\n]\nregion = ee.Geometry.Point(coords)\n\n# Sentinel-2 median composite.\nimage = (ee.ImageCollection('COPERNICUS/S2')\n .filterBounds(region)\n .filterDate('2020-04-01', '2020-09-01')\n .median())\n\n# Make a projection to discover the scale in degrees.\nproj = ee.Projection('EPSG:4326').atScale(10).getInfo()\n\n# Get scales out of the transform.\nscale_x = proj['transform'][0]\nscale_y = -proj['transform'][4]\n\n# Make a request object.\nrequest = {\n 'expression': image,\n 'fileFormat': 'PNG',\n 'bandIds': ['B4', 'B3', 'B2'],\n 'grid': {\n 'dimensions': {\n 'width': 640,\n 'height': 640\n },\n 'affineTransform': {\n 'scaleX': scale_x,\n 'shearX': 0,\n 'translateX': coords[0],\n 'shearY': 0,\n 'scaleY': scale_y,\n 'translateY': coords[1]\n },\n 'crsCode': proj['crs'],\n },\n 'visualizationOptions': {'ranges': [{'min': 0, 'max': 3000}]},\n}\n\nimage_png = ee.data.computePixels(request)\n# Do something with the image...\n```"]]