ee.PixelType

Trả về PixelType có độ chính xác đã cho với giới hạn đã cho cho mỗi phần tử và một chiều tuỳ chọn.

Cách sử dụngGiá trị trả về
ee.PixelType(precision, minValue, maxValue, dimensions)PixelType
Đối sốLoạiThông tin chi tiết
precisionĐối tượngĐộ chính xác của pixel, một trong các giá trị "int", "float" hoặc "double".
minValueSố, mặc định: nullGiá trị tối thiểu của pixel thuộc loại này. Nếu độ chính xác là "float" hoặc "double", thì giá trị này có thể là giá trị rỗng, biểu thị vô cực âm.
maxValueSố, mặc định: nullGiá trị tối đa của pixel thuộc loại này. Nếu độ chính xác là "float" hoặc "double", thì giá trị này có thể là giá trị rỗng, biểu thị vô cực dương.
dimensionsSố nguyên, mặc định: 0Số lượng phương diện mà các pixel thuộc loại này có thể thay đổi; 0 là một đại lượng vô hướng, 1 là một vectơ, 2 là một ma trận, v.v.

Ví dụ

Trình soạn thảo mã (JavaScript)

print(ee.PixelType('int', 0, 1));  // int ∈ [0, 1]
print(ee.PixelType('int', -20, -10));  // int ∈ [-20, -10]
print(ee.PixelType('float'));  // float
print(ee.PixelType('double'));  // double
print(ee.PixelType('double', null));  // double
print(ee.PixelType('double', null, null));  // double
print(ee.PixelType('double', null, null, 0));  // double
print(ee.PixelType('double', null, null, 1));  // double, 1 dimensions
print(ee.PixelType('double', null, null, 2));  // double, 2 dimensions
print(ee.PixelType('double', null, null, 3));  // double, 3 dimensions
print(ee.PixelType('double', null, null, 10));  // double, 10 dimensions
print(ee.PixelType('double', null, null, 1e8));  // double, 100000000 dimensions

print(ee.PixelType('double', 1, 2, 0));  // double ∈ [1, 2]
print(ee.PixelType('double', 1, 3, 2));  // double ∈ [1, 3], 2 dimensions
print(ee.PixelType('double', -4, -3, 0));  // double ∈ [-4, -3]

print(ee.PixelType('double', null, 2.3, 0));  // double
print(ee.PixelType('double', 3.4, null, 0));  // double

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

import ee
import geemap.core as geemap

Colab (Python)

print(ee.PixelType('int', 0, 1).getInfo())  # int ∈ [0, 1]
print(ee.PixelType('int', -20, -10).getInfo())  # int ∈ [-20, -10]
print(ee.PixelType('float').getInfo())  # float
print(ee.PixelType('double').getInfo())  # double
print(ee.PixelType('double', None).getInfo())  # double
print(ee.PixelType('double', None, None).getInfo())  # double
print(ee.PixelType('double', None, None, 0).getInfo())  # double
print(ee.PixelType('double', None, None, 1).getInfo())  # double, 1 dimensions
print(ee.PixelType('double', None, None, 2).getInfo())  # double, 2 dimensions
print(ee.PixelType('double', None, None, 3).getInfo())  # double, 3 dimensions
print(ee.PixelType('double', None, None, 10).getInfo())  # double, 10 dimensions

# double, 100000000 dimensions
print(ee.PixelType('double', None, None, 1e8).getInfo())

print(ee.PixelType('double', 1, 2, 0).getInfo())  # double ∈ [1, 2]

# double ∈ [1, 3], 2 dimensions
print(ee.PixelType('double', 1, 3, 2).getInfo())
print(ee.PixelType('double', -4, -3, 0).getInfo())  # double ∈ [-4, -3]

print(ee.PixelType('double', None, 2.3, 0).getInfo())  # double
print(ee.PixelType('double', 3.4, None, 0).getInfo())  # double