天天看點

GEE基礎學習——門檻值的設定clamp(下線值,上限值)!

當我們想要影像中的某一部分的值而不是所有值呈現的時候,就可以采用clamp()來進行!

官方文檔中給出的例子:數字和影像都可以

GEE基礎學習——門檻值的設定clamp(下線值,上限值)!

clamp(low, high)

Clamps the values in all bands of an image to all lie within the specified range.

Arguments:

this:input (Image):

The image to clamp.

low (Float):

The minimum allowed value in the range.

high (Float):

The maximum allowed value in the range.

Returns: Image鉗位(低,高)

将圖像的所有波段中的值都夾在指定範圍内。

    參數: this:input (Image): 要鉗制的圖像。

    低(Float):範圍内的最小允許值。

    高(Float):範圍内的最大允許值。

    傳回:圖像

// ee.Image.clamp() 示例。

// 将圖像中所有波段的值限制在指定範圍内。

// 低于該範圍低值的值被設定為低值,高于該範圍的高值的值被設定為高值。

var image = ee.Image('CGIAR/SRTM90_V4');
var clamped = image.clamp(1000, 2000);

Map.setCenter(-121.753, 46.855, 9);
Map.addLayer(image, {min: 0, max: 4300}, 'Full stretch');
Map.addLayer(clamped, {min: 0, max: 4300}, 'Clamped');
           

未進行篩選的原始資料:

GEE基礎學習——門檻值的設定clamp(下線值,上限值)!

篩選1000-2000M高程後的影像:

GEE基礎學習——門檻值的設定clamp(下線值,上限值)!