GEE python: Decloud (less than 20% cloudiness) in the form of an array and convert the filtered array into a multi-band image value load

The conversion process between image arrays:
In GEE, converting an array to an image requires the use of ee.Image()a function. This function creates a new image, filled with pixel values ​​from the given array or raster.

The following is a sample code to convert an array to an image in GEE:

// 创建一个3*3的数组
var arr = ee.Array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);

// 创建一个新的影像
var image = ee.Image(arr);

// 输出影像
print(image);

In this sample code, we first create an array of size 3*3. Then use ee.Image()a function to convert the array to an image, and finally output the image.

Note that in the above code, the values ​​in the array are automatically converted to floating point values ​​in the image. If you need to use an integer value in the image, you need to use the method ee.Image()of the function int()to convert it to an integer type.

Here is a sample code that converts an array to an image of integer type:

// 创建一个3*3的整型数组
var arr = ee.Array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], ee.PixelType.int16());

// 创建一个新的整型影像
var image = ee.Image(arr).int();

// 输出影像
print(image);

In this sample code, we create an array of integers, then use ee.Image()a function to convert it to an integer image, and int()a method to convert the floating point values ​​in the image to integer values. Finally output the integer image.

Install the Earth Engine API and geemap
Install the Earth Engine Python API and geemap. geema

Guess you like

Origin blog.csdn.net/qq_31988139/article/details/131886813