向量至光柵內插

在 Earth Engine 中,從向量插補至光柵會從 FeatureCollection 建立 Image。具體來說,Earth Engine 會使用地圖項目屬性中儲存的數值資料,對地圖項目以外的新位置進行內插值。內插結果會產生連續的 Image,內插值會一直延伸到指定的距離。

反比率加權內插

Earth Engine 中的反距離加權 (IDW) 函式是以 Basso 等人 (1999) 所述的方法為依據。在反比距離上,以衰減因子 (gamma) 的形式新增額外的控制參數。其他參數包括要內插的屬性平均值和標準差,以及內插的最大範圍距離。以下範例會建立 甲烷濃度的內插表面,以填補原始光柵資料集的空間空隙。FeatureCollection 是透過取樣兩週的甲烷複合物產生。

// Import two weeks of S5P methane and composite by mean.
var ch4 = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_CH4')
  .select('CH4_column_volume_mixing_ratio_dry_air')
  .filterDate('2019-08-01', '2019-08-15')
  .mean()
  .rename('ch4');

// Define an area to perform interpolation over.
var aoi =
  ee.Geometry.Polygon(
    [[[-95.68487605978851, 43.09844605027055],
       [-95.68487605978851, 37.39358590079781],
       [-87.96148738791351, 37.39358590079781],
       [-87.96148738791351, 43.09844605027055]]], null, false);

// Sample the methane composite to generate a FeatureCollection.
var samples = ch4.addBands(ee.Image.pixelLonLat())
  .sample({region: aoi, numPixels: 1500,
    scale:1000, projection: 'EPSG:4326'})
  .map(function(sample) {
    var lat = sample.get('latitude');
    var lon = sample.get('longitude');
    var ch4 = sample.get('ch4');
    return ee.Feature(ee.Geometry.Point([lon, lat]), {ch4: ch4});
  });

// Combine mean and standard deviation reducers for efficiency.
var combinedReducer = ee.Reducer.mean().combine({
  reducer2: ee.Reducer.stdDev(),
  sharedInputs: true});

// Estimate global mean and standard deviation from the points.
var stats = samples.reduceColumns({
  reducer: combinedReducer,
  selectors: ['ch4']});

// Do the interpolation, valid to 70 kilometers.
var interpolated = samples.inverseDistance({
  range: 7e4,
  propertyName: 'ch4',
  mean: stats.get('mean'),
  stdDev: stats.get('stdDev'),
  gamma: 0.3});

// Define visualization arguments.
var band_viz = {
  min: 1800,
  max: 1900,
  palette: ['0D0887', '5B02A3', '9A179B', 'CB4678',
            'EB7852', 'FBB32F', 'F0F921']};

// Display to map.
Map.centerObject(aoi, 7);
Map.addLayer(ch4, band_viz, 'CH4');
Map.addLayer(interpolated, band_viz, 'CH4 Interpolated');

請注意,根據 range 參數的指定,插補作業只會在距離最近測量站 70 公里的範圍內執行。

Kriging

Kriging 是一種內插方法,會使用模擬的半變異數估計值,建立內插值的圖片,這是已知位置的值最佳組合。Kriging 估計器需要參數,用於描述與已知資料點相符的 半變異函數形狀。這些參數請見圖 1。

變異函數
圖 1. 理想變異函數函式中的 nuggetsillrange 參數。

以下範例會在隨機位置取樣海表溫度 (SST) 圖片,然後使用克里金法從樣本內插 SST:

// Load an image of sea surface temperature (SST).
var sst = ee.Image('NOAA/AVHRR_Pathfinder_V52_L3/20120802025048')
  .select('sea_surface_temperature')
  .rename('sst')
  .divide(100);

// Define a geometry in which to sample points
var geometry = ee.Geometry.Rectangle([-65.60, 31.75, -52.18, 43.12]);

// Sample the SST image at 1000 random locations.
var samples = sst.addBands(ee.Image.pixelLonLat())
  .sample({region: geometry, numPixels: 1000})
  .map(function(sample) {
    var lat = sample.get('latitude');
    var lon = sample.get('longitude');
    var sst = sample.get('sst');
    return ee.Feature(ee.Geometry.Point([lon, lat]), {sst: sst});
  });

// Interpolate SST from the sampled points.
var interpolated = samples.kriging({
  propertyName: 'sst',
  shape: 'exponential',
  range: 100 * 1000,
  sill: 1.0,
  nugget: 0.1,
  maxDistance: 100 * 1000,
  reducer: 'mean',
});

var colors = ['00007F', '0000FF', '0074FF',
              '0DFFEA', '8CFF41', 'FFDD00',
              'FF3700', 'C30000', '790000'];
var vis = {min:-3, max:40, palette: colors};

Map.setCenter(-60.029, 36.457, 5);
Map.addLayer(interpolated, vis, 'Interpolated');
Map.addLayer(sst, vis, 'Raw SST');
Map.addLayer(samples, {}, 'Samples', false);

maxDistance 參數會指定要執行插補的鄰域大小。尺寸越大,輸出內容就越流暢,但運算速度就越慢。