ee.FeatureCollection.kriging

返回在每个像素处对 Kriging 估计器进行抽样的结果。

用法返回
FeatureCollection.kriging(propertyName, shape, range, sill, nugget, maxDistance, reducer)图片
参数类型详细信息
此:collectionFeatureCollection用作估计源数据的特征集合。
propertyName字符串要估计的属性(必须为数值)。
shape字符串半变异函数形状({exponential, gaussian, spherical} 之一)。
range浮点数半变异函数范围,以米为单位。
sill浮点数半变异函数值域。
nugget浮点数半变异函数块金。
maxDistance浮点数,默认值:null半径,用于确定每个像素的计算中包含哪些特征(以米为单位)。默认为半变异函数的范围。
reducer缩减器,默认值:null用于将重叠点的“propertyName”值折叠为单个值的缩减器。

示例

代码编辑器 (JavaScript)

/**
 * This example generates an interpolated surface using kriging from a
 * FeatureCollection of random points that simulates a table of air temperature
 * at ocean weather buoys.
 */

// Average air temperature at 2m height for June, 2020.
var img = ee.Image('ECMWF/ERA5/MONTHLY/202006')
              .select(['mean_2m_air_temperature'], ['tmean']);

// Region of interest: South Pacific Ocean.
var roi = ee.Geometry.Polygon(
        [[[-156.053, -16.240],
          [-156.053, -44.968],
          [-118.633, -44.968],
          [-118.633, -16.240]]], null, false);

// Sample the mean June 2020 temperature surface at random points in the ROI.
var tmeanFc = img.sample(
  {region: roi, scale: 25000, numPixels: 50, geometries: true}); //250

// Generate an interpolated surface from the points using kriging; parameters
// are set according to interpretation of an unshown semivariogram. See section
// 2.1 of https://doi.org/10.14214/sf.369 for information on semivariograms.
var tmeanImg = tmeanFc.kriging({
  propertyName: 'tmean',
  shape: 'gaussian',
  range: 2.8e6,
  sill: 164,
  nugget: 0.05,
  maxDistance: 1.8e6,
  reducer: ee.Reducer.mean()
});

// Display the results on the map.
Map.setCenter(-137.47, -30.47, 3);
Map.addLayer(tmeanImg, {min: 279, max: 300}, 'Temperature (K)');

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

# This example generates an interpolated surface using kriging from a
# FeatureCollection of random points that simulates a table of air temperature
# at ocean weather buoys.

# Average air temperature at 2m height for June, 2020.
img = ee.Image('ECMWF/ERA5/MONTHLY/202006').select(
    ['mean_2m_air_temperature'], ['tmean']
)

# Region of interest: South Pacific Ocean.
roi = ee.Geometry.Polygon(
    [[
        [-156.053, -16.240],
        [-156.053, -44.968],
        [-118.633, -44.968],
        [-118.633, -16.240],
    ]],
    None,
    False,
)

# Sample the mean June 2020 temperature surface at random points in the ROI.
tmean_fc = img.sample(region=roi, scale=25000, numPixels=50, geometries=True)

# Generate an interpolated surface from the points using kriging parameters
# are set according to interpretation of an unshown semivariogram. See section
# 2.1 of https://doi.org/10.14214/sf.369 for information on semivariograms.
tmean_img = tmean_fc.kriging(
    propertyName='tmean',
    shape='gaussian',
    range=2.8e6,
    sill=164,
    nugget=0.05,
    maxDistance=1.8e6,
    reducer=ee.Reducer.mean(),
)

# Display the results on the map.
m = geemap.Map()
m.set_center(-137.47, -30.47, 3)
m.add_layer(
    tmean_img,
    {'min': 279, 'max': 300, 'min': 279, 'max': 300},
    'Temperature (K)',
)
m