GEE_API Docs_Guides_Specialized Algorithms专门的算法

API Docs_Guides_Specialized Algorithms专门的算法

  • 一.Landsat Algorithms算法
    • 1.Landsat collection structure数据集结构
    • 2.Landsat processing methods处理方法
      • 2.1At-sensor radiance(传感器辐射) and TOA reflectance(大气顶部反射率)
      • 2.2 Surface reflectance地表反射率
      • 2.3Simple cloud score简单云评分
      • 2.4Simple composite复合产品
  • 二.Sentinel-1 Algorithms(用到再看)
  • 三.Resampling and Reducing Resolution重采样和降低分辨率
    • 1.Resampling重采样
    • 2.Reduce Resolution降低分辨率
    • 3.Pixel weights for ReduceResolution用于降低分辨率的像素权重

GEE_API Docs_Guides_Specialized Algorithms专门的算法_第1张图片

一.Landsat Algorithms算法

1.Landsat collection structure数据集结构

USGS为每颗卫星生成3tiers (categories) 层(类别)数据:

  • tiers1(T1)-Data that meets geometric and radiometric quality requirements符合几何和辐射质量要求的数据
  • tiers2(T2)- Data that doesn’t meet the Tier 1 requirements不符合第1层要求的数据
  • Real Time实时(RT)-Data that hasn’t yet been evaluated (it takes as much as a month).尚未评估的数据(最多需要一个月的时间)
有关更多信息,请参见关于数据集1的“层“”(Collection 1 Tiers)的 USGS文档。链接:https://www.usgs.gov/land-resources/nli/landsat/landsat-collection-1?qt-science_support_page_related_con=1#qt-science_support_page_related_con
摘自上面链接中内容:
Landsat Collection 1由Level-1数据产品组成。
Level-1 data products由Landsat 8可操作性陆地成像仪和热红外传感器(Landsat 8 Operational Land Imager (OLI)/Thermal Infrared Sensor (TIRS)),Landsat 7增强型专题制图仪Plus(Enhanced Thematic Mapper Plus (ETM+)),Landsat 4-5专题制图仪(Thematic Mapper (TM)*),Landsat 1-5多光谱扫描仪(Landsat 1-5 Multispectral Scanner (MSS) )等5种仪器生成。

为了允许一起访问经过验证的T1数据和最新的实时数据RT,我们按层和卫星将scene分组到不同集合中。Landsat 8的示例如下:
GEE_API Docs_Guides_Specialized Algorithms专门的算法_第2张图片
每天将新获取的scenes添加到T1_RT collection中。一旦RT scene被重新处理并归类为T1或T2,它将被从T1_RT collection中删除,新版本(处理后的版本)将添加到适当的collection(s)中。如果您的工作对删除或潜在的错误注册(removals or potentially mis-registered )scenes很敏感,那么您可能希望坚持使用T1 collection,但是一般来说,在新获得的scene中,错误注册(misregistration)大到足以引起注意的情况是非常罕见的。

上面的每个collections都包含 raw data(原始数据—标度的,传感器辐射度——scaled, at-sensor radiance)。此外,对于包含T1或T2图像的每个collection,都提供了TOA(top-of-atmosphere reflectance大气顶部反射率)和SR(surface reflectance表面反射率)产品。下表以landsat8数据为例,描述了TOA和SR collections的collection ID。
GEE_API Docs_Guides_Specialized Algorithms专门的算法_第3张图片
这些数据存在于Landsat 4, 5, 7, and 8。使用下表中的icollection definitions with IDs 替换上述集合定义中的“LC08”,以检索各种卫星的collections。
GEE_API Docs_Guides_Specialized Algorithms专门的算法_第4张图片
最后,因为pre-Collection 1 scenes不再被产出,我们将无法更新“老式”Landsat collections(例如:Landsat /LC8_L1T)。我们计划在获得所有C1数据之后仍保留这些collections 一段时间,但它们最终将被淘汰。

2.Landsat processing methods处理方法

Earth Engine包含多种Landsat特定的处理方法。具体的计算方法有计算at-sensor radiance(传感器辐射), top-of-atmosphere (TOA) reflectance(大气顶部反射率)、surface reflectance (SR)(表面反射率)、cloud score(云分数)和cloud-free composites(无云复合产品)。

2.1At-sensor radiance(传感器辐射) and TOA reflectance(大气顶部反射率)

Earth Engine 中的‘raw’ scenes包含数字影像( imagery with digital numbers (DNs) ),数字影像表示标度辐射(scaled radiance)。DNs到at-sensor radiance的转换是利用scene metadata中存储的系数进行线性转换(linear transformation)。

参考文献:https://www.sciencedirect.com/science/article/abs/pii/S0034425709000169

ee.Algorithms.Landsat.calibratedRadiance() 方法执行此转换。

转换到TOA(或at-sensor)反射率是一个线性转换,它解释了太阳高度和按季节变化的地球-太阳距离。

TOA转换由 ee.Algorithms.Landsat.TOA() 方法处理。TOA方法将热波段(thermal bands)转换为亮度温度(brightness temperature)。

有关计算TOA reflectance或brightness temperature的更多信息
参考文献:https://www.sciencedirect.com/science/article/abs/pii/S0034425709000169
或https://www.usgs.gov/land-resources/nli/landsat/using-usgs-landsat-level-1-data-product

下面的例子展示了landsat8 image从 raw data到辐射率(radiance)和TOA 反射率(reflectance)的转换

// Load a raw Landsat scene and display it.加载原始Landsat scene并显示
var raw = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318');
Map.centerObject(raw, 10);
Map.addLayer(raw, {bands: ['B4', 'B3', 'B2'], min: 6000, max: 12000}, 'raw');

// Convert the raw data to radiance.将原始数据转换为辐射
var radiance = ee.Algorithms.Landsat.calibratedRadiance(raw);
Map.addLayer(radiance, {bands: ['B4', 'B3', 'B2'], max: 90}, 'radiance');

// Convert the raw data to top-of-atmosphere reflectance.将原始数据转换为大气顶部反射率
var toa = ee.Algorithms.Landsat.TOA(raw);

Map.addLayer(toa, {bands: ['B4', 'B3', 'B2'], max: 0.2}, 'toa reflectance');

2.2 Surface reflectance地表反射率

到地表反射率的转换通常需要某种大气补偿(atmospheric compensation)。USGS 使用LEDAPS 软件将raw Landsat data转换为Surface reflectance。

参考:https://pubs.er.usgs.gov/publication/ofr20131057

LEDAPS需要各种大气输入 (atmospheric inputs)来约束大气模型。这些大气输入数据包括a 6S model运行的输出、DEM、total column ozone、国家环境预测中心(National Centers for Environmental Prediction (NCEP))模拟的地面压力(surface pressure)、温度和水蒸气。

参考:
6S model:http://6s.ltdri.org/index.html
https://journals.ametsoc.org/bams/article/77/3/437/55258/The-NCEP-NCAR-40-Year-Reanalysis-Project

你可以直接从SR collections中访问预先计算的表面反射率图像(pre-computed surface reflectance images)。比如,去加载一幅Landsat 7 surface reflectance影像,用下面代码:

var srImage = ee.Image('LANDSAT/LE07/C01/T1_SR/LE07_044034_19990707');

Landsat 4到7的Collection 1的surface reflectance datasets:

var surfaceReflectanceL4 = ee.ImageCollection('LANDSAT/LT04/C01/T1_SR');
var surfaceReflectanceL5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR');
var surfaceReflectanceL7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR');

2.3Simple cloud score简单云评分

根据相对云量(relative cloudiness)对 Landsat像素进行评分(scoring Landsat pixels ),Earth Engine提供了基本云评分算法(rudimentary cloud scoring algorithm),调用方法为ee.Algorithms.Landsat.simpleCloudScore()。下面的例子使用云评分算法(cloud scoring algorithm)来屏蔽landsat8图像中的云(mask clouds ):

// Load a cloudy Landsat scene and display it.加载一个多云的的Landsat scene
var cloudy_scene = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20140926');
Map.centerObject(cloudy_scene);
Map.addLayer(cloudy_scene, {bands: ['B4', 'B3', 'B2'], max: 0.4}, 'TOA', false);

// Add a cloud score band. It is automatically called 'cloud'.添加一个cloud score band
var scored = ee.Algorithms.Landsat.simpleCloudScore(cloudy_scene);

// Create a mask from the cloud score and combine it with the image mask.从cloud score生成一个mask,并将其和image mask结合起来
var mask = scored.select(['cloud']).lte(20);

// Apply the mask to the image and display the result.在图像上应用mask
var masked = cloudy_scene.updateMask(mask);
Map.addLayer(masked, {bands: ['B4', 'B3', 'B2'], max: 0.4}, 'masked');

// Load a Landsat 8 composite and set the SENSOR_ID property.加载一个Landsat 8composite并且设置SENSOR_ID属性
var mosaic = ee.Image(ee.ImageCollection('LANDSAT/LC8_L1T_8DAY_TOA').first())
  .set('SENSOR_ID', 'OLI_TIRS');

// Cloud score the mosaic and display the result.
var scored_mosaic = ee.Algorithms.Landsat.simpleCloudScore(mosaic);
Map.addLayer(scored_mosaic, {bands: ['B4', 'B3', 'B2'], max: 0.4},
    'TOA mosaic', false);

如果在Code Editor中运行此示例,请尝试切换( toggle)TOA层的可见性,以比较掩膜图像(masked)和未掩膜图像(unmasked imagery)之间的差异。

请参阅Code Editor文档(https://developers.google.com/earth-engine/playground#layer-manager)以了解如何进行此操作

请注意,simpleCloudScore() 的输入是一个单一的Landsat TOA scene。注意:simpleCloudScore() 将一个名为cloud 的band添加到输入影像。cloud band包含从0(无云)到100(云最多)的云分数(cloud score)。前面的示例在云分数(cloud score)上使用一个任意的阈值(20)来掩膜多云像素( mask cloudy pixels)。要将此算法应用于Landsat scenes的 Earth Engine mosaic(镶嵌),请设置SENSOR_ID属性:

// Load a Landsat 8 composite and set the SENSOR_ID property.加载Landsat 8 composite,设置SENSOR_ID属性
var mosaic = ee.Image(ee.ImageCollection('LANDSAT/LC8_L1T_8DAY_TOA').first())
  .set('SENSOR_ID', 'OLI_TIRS');

// Cloud score the mosaic and display the result.
var scored_mosaic = ee.Algorithms.Landsat.simpleCloudScore(mosaic);
Map.addLayer(scored_mosaic, {bands: ['B4', 'B3', 'B2'], max: 0.4},
    'TOA mosaic', false);

SENSOR_ID是单个图像的属性。当Earth Engine做许多图像的掩膜时,它必须抛出单独的图像元数据,包括:SENSOR_ID属性。为了cloud score一个掩膜,Earth Engine寻找该属性,但找不到它,就会产生一个错误。手动设置该属性以避免这种情况。andsat 5、7和8的 sensor IDs分别为“TM”、“ETM+”和“OLI_TIRS”。

2.4Simple composite复合产品

为了创建简单的无云Landsat复合材料(simple cloud-free Landsat composites),Earth Engine提供了 ee.Algorithms.Landsat.simpleComposite() 方法。该方法在每个位置选取一个scenes子集,将其转换为TOA反射率(TOA reflectance),应用简单云分数(simple cloud score),取最少云像素的中值(median of the least cloudy pixels)。
本例使用默认参数创建了一个简单的组合(simple composite),然后使用自定义参数(custom parameters)(云评分阈值(cloud score threshold)和百分比( percentile))生成一个组合(composite),最后对二者作比较。

// Load a raw Landsat 5 ImageCollection for a single year.加载一年的原始Landsat 5影像集
var collection = ee.ImageCollection('LANDSAT/LT05/C01/T1')
    .filterDate('2010-01-01', '2010-12-31');

// Create a cloud-free composite with default parameters.用默认参数生成一个无云的composite
var composite = ee.Algorithms.Landsat.simpleComposite(collection);

// Create a cloud-free composite with custom parameters for cloud score threshold and percentile.
// 使用自定义参数(cloud score阈值和百分比),生成一个无云composite 
var customComposite = ee.Algorithms.Landsat.simpleComposite({
  collection: collection,
  percentile: 75,
  cloudScoreRange: 5
});

// Display the composites.
Map.setCenter(-122.3578, 37.7726, 10);
Map.addLayer(composite, {bands: ['B4', 'B3', 'B2'], max: 128}, 'TOA composite');
Map.addLayer(customComposite, {bands: ['B4', 'B3', 'B2'], max: 128},
    'Custom TOA composite');

请注意,简单组合(simple composite)的输入是原始图像的集合(collection of raw imagery)。注意,在默认情况下,反射波段(reflective band )输出是反射系数(reflectance)缩放(scaled)到8-bits,而热波段(thermal band)输出是开尔文减100( Kelvin minus 100),以适应8-bit范围。你可以通过将asFloat参数设置为true(setting the asFloat parameter to true,)来改变这种行为,以获得非缩放、非移位的浮点数输出(un-scaled, un-shifted float output)。

二.Sentinel-1 Algorithms(用到再看)

三.Resampling and Reducing Resolution重采样和降低分辨率

正如在投影( Projections)文档中提到的,在重投影期间,Earth Engine默认执行最近邻重采样(nearest neighbor resampling)。可以使用**resample()reduceResolution()**方法更改此行为。具体地说,当将这些方法中的一种应用于输入图像时,输入的任何必要的重投影都将使用指定的重采样或聚合方法来进行。

 Projections doc:https://developers.google.com/earth-engine/projections

1.Resampling重采样

resample()会导致在下一次重投影中使用指示的重采样方法(‘bilinear’或’bicubic’)。由于输入是在输出投影中请求的,隐式重投影可能会在对输入的任何其他操作之前发生。因此,直接在输入图像上调用resample(),简单示例如下:

// Load a Landsat image over San Francisco, California, UAS.加载加利福尼亚旧金山上空的Landsat image
var landsat = ee.Image('LANDSAT/LC08/C01/T1_TOA/LC08_044034_20160323');

// Set display and visualization parameters.设置显示和可视化参数
Map.setCenter(-122.37383, 37.6193, 15);
var visParams = {bands: ['B4', 'B3', 'B2'], max: 0.3};

// Display the Landsat image using the default nearest neighbor resampling when reprojecting to Mercator for the Code Editor map.
// 当对Code Editor中的map重投影到Mercator时,使用默认的最近邻重采样显示Landsat图像。
Map.addLayer(landsat, visParams, 'original image');

// Force the next reprojection on this image to use bicubic resampling.强制此图像的下一个重投影使用双三次(两次立方)重采样。
var resampled = landsat.resample('bicubic');

// Display the Landsat image using bicubic resampling.使用双三次重采样显示Landsat image
Map.addLayer(resampled, visParams, 'resampled');

注意,输出像素的bicubic(双三次)重采样的结果看起来比原始图像更平滑(图1)

具体图像在官网上

此代码示例的操作顺序如下图所示。具体地说,隐式重新投影到maps mercator投影时,使用在输入图像上指定的重采样方法进行。

maps mercator:http://epsg.io/3857

GEE_API Docs_Guides_Specialized Algorithms专门的算法_第5张图片

对上图的说明: 操作流程图:在代码编辑器中显示图像之前对输入图像调用 resample()。曲线表示重投影的信息流,具体来说,就是使用输出投影、比例尺和重采样方法。

2.Reduce Resolution降低分辨率

假设您的目标不是在重投影期间重新采样,而是在不同的投影中将像素聚合为更大的像素。这在比较不同尺度的图像数据集时非常有用,例如,基于landsat产品的30米像素(30-meter pixels)与基于mois产品的粗像素(coarse pixels)(更高尺度)。您可以使用reduceResolution()方法控制这个聚合过程。与resample()一样,对输入调用reduceResolution(),以影响图像的下一次重投影。下面的例子使用**reduceResolution()**比较30米分辨率的森林覆盖数据( forest cover data at 30-meters resolution)与500米分辨率的植被指数(vegetation index at 500-meters resolution):

// Load a MODIS EVI image.加载MODIS EVI图像
var modis = ee.Image(ee.ImageCollection('MODIS/006/MOD13A1').first())
    .select('EVI');

// Display the EVI image near La Honda, California.显示加州La Honda附近的EVI image
Map.setCenter(-122.3616, 37.5331, 12);
Map.addLayer(modis, {min: 2000, max: 5000}, 'MODIS EVI');

// Get information about the MODIS projection.获取MODIS投影的信息
var modisProjection = modis.projection();
print('MODIS projection:', modisProjection);

// Load and display forest cover data at 30 meters resolution.以30米的分辨率加载和显示森林覆盖数据。
var forest = ee.Image('UMD/hansen/global_forest_change_2015')
    .select('treecover2000');
Map.addLayer(forest, {max: 80}, 'forest cover 30 m');

// Get the forest cover data at MODIS scale and projection.以MODIS的比例尺和投影获取森林覆盖数据。
var forestMean = forest
    // Force the next reprojection to aggregate instead of resampling.设置使得下一次重新投影到聚合而不是重新采样
    .reduceResolution({
      reducer: ee.Reducer.mean(),
      maxPixels: 1024
    })
    // Request the data at the scale and projection of the MODIS image.请求数据:以MODIS图像的尺度和投影
    .reproject({
      crs: modisProjection
    });

// Display the aggregated, reprojected forest cover data.显示聚合的、重新投影的森林覆盖数据
Map.addLayer(forestMean, {max: 80}, 'forest cover at MODIS scale');

在本例中,请注意输出投影是用reproject()显式设置的。在重投影到MODIS正弦(MODIS sinusoidal projection)投影期间,不是重采样,而是使用指定的reducer(本例中为ee.reduce .mean())聚合较小的像素。这个操作顺序如下图所示。
虽然这个示例使用**reproject()来帮助可视化reduceResolution()**的效果,但大多数脚本不需要显式地投影变换;请参见此处的警告。

reproject():https://developers.google.com/earth-engine/projections#reprojecting
警告的链接地址:https://developers.google.com/earth-engine/projections#reprojecting

GEE_API Docs_Guides_Specialized Algorithms专门的算法_第6张图片

上图中:操作流程图: reproject()在被调用之前, reduceResolution() 被调用到一个输入图像上
曲线表示重投影的信息流:具体来说,就是用到的输出投影、尺度和像素聚合(output projection, scale and pixel aggregation )

注意,第二次重投影(隐式)会发生,以在Code Editor map上显示数据。
视觉上检查结果,观察MODIS层的像素点与重投影到MODIS尺度和投影的森林覆盖数据之间的对应关系。通常,您很少需要在Earth Engine中显式地 reproject()

3.Pixel weights for ReduceResolution用于降低分辨率的像素权重

reduceResolution() 聚集过程(aggregation process )中使用的weights of pixels(像素权重)是基于被聚合的较小像素和由输出投影指定的较大像素之间的重叠。如下图所示:
GEE_API Docs_Guides_Specialized Algorithms专门的算法_第7张图片

上图说明: 应用 reduceResolution() 的输入像素(黑色)和输出像素(蓝色)

默认行为是:输入像素权重(input pixel weights)被计算为输入像素所覆盖的输出像素面积的比例。图中,输出像素的面积为a,与b相交的输入像素的权值计算为b/a,与c相交的输入像素的权值计算为c/a。在使用除mean reducer之外的reducer时,此行为可能会导致意外结果。例如,要计算每个像素的森林覆盖面积,可以使用mean reducer来计算被覆盖像素的比例,然后乘以面积(而不是在较小的像素计算面积,然后用sum reducer把它们加起来):

// Compute forest area per MODIS pixel.计算每一个MODIS像素的森林面积
var forestArea = forest.gt(0)
    // Force the next reprojection to aggregate instead of resampling.设置使得下一个重新投影进行聚合,而不是重新采样
    .reduceResolution({
      reducer: ee.Reducer.mean(),
      maxPixels: 1024
    })
    // The reduce resolution returns the fraction of the MODIS pixel that's covered by 30 meter forest pixels.  Convert to area after the reduceResolution() call.
    // reduce resolution返回30米森林像素覆盖的MODIS像素的比例。在调用reduceResolution()后转换为面积。
    .multiply(ee.Image.pixelArea())
    // Request the data at the scale and projection of the MODIS image.请求数据——在MODIS图像的尺度和投影下
    .reproject({
      crs: modisProjection
    });
Map.addLayer(forestArea, {max: 500 * 500}, 'forested area at MODIS scale');

你可能感兴趣的:(遥感)