GEE代码学习 day4

Spectral resolution refers to the number and width of spectral bands in which the sensor takes measurements.

/ 
// Explore spectral resolution /
  
// Get the MODIS band names as an ee.List 
var modisBands = modisImage.bandNames();  
// Print the list. 
print('MODIS bands:', modisBands);  
// Print the length of the list. 
print('Length of the bands list:', modisBands.length());
// Graph the MODIS spectral bands (bands 11-17).  
// Select only the reflectance bands of interest. 
var reflectanceImage = modisImage.select(  'sur_refl_b01', 'sur_refl_b02', 'sur_refl_b03', 'sur_refl_b04', 'sur_refl_b05', 'sur_refl_b06', 'sur_refl_b07' );
// Define an object of customization parameters for the chart. 
var options = {  title: 'MODIS spectrum at SFO', 
                 hAxis: { title: 'Band' }, 
                 vAxis: { title: 'Reflectance' }, 
                 legend: { position: 'none' }, 
                 pointSize: 3 };
// Make the chart. 
var modisReflectanceChart = ui.Chart.image.regions({  image: reflectanceImage, regions: sfoPoint }).setOptions(options);  
// Display the chart. 
print(modisReflectanceChart);
// Get the EO-1 band “EO-1 Hyperion Hyperspectral Imager” dataset.
var eo1Image = eo1  .filterDate('2015-01-01', '2016-01-01') .first();  
// Extract the EO-1 band names. var eo1Bands = eo1Image.bandNames();  
// Print the list of band names. 
print('EO-1 bands:', eo1Bands);
// Create an options object for our chart. 
var optionsEO1 = {  title: 'EO1 spectrum', hAxis: { title: 'Band' }, 
                    vAxis: { title: 'Reflectance' }, 
                    legend: { position: 'none' }, 
                    pointSize: 3 };  
// Make the chart and set the options. 
var eo1Chart = ui.Chart.image.regions({  image: eo1Image, 
                                         regions: ee.Geometry.Point([6.10, 81.12]) 
                                      }).
                                           setOptions(optionsEO1);  
// Display the chart. 
print(eo1Chart);

Per-Pixel Quality

/ 
// Examine pixel quality 
/ 
// Sentinel Quality Visualization. 
msiCloud = msi  
           .filterBounds(Map.getCenter()) 
           .filterDate('2019-12-31', '2020-02-01') .first();

Metadata:Metadata properties can be extracted from an image’s properties using the get function and printed to the Console.

/ 
// Metadata 
/ 
print('MSI Image Metadata', msiImage);

CLOUDY_PIXEL_PERCENTAGE information. Distinct from the cloudiness flag attached to every pixel, this is an image-level summary assessment of the overall cloudiness in the image.

第五章:图像处理

Spectral indices (光谱指数)are based on the fact that different objects and land covers on the Earth’s surface reflect different amounts of light from the Sun at different wavelengths.

Band Arithmetic in Earth Engine

1、Arithmetic Calculation of NDVI

植被曲线(以绿色绘制)在 NIR 范围(约 750-900 nm)具有相对较高的反射率,红色范围(约 630-690 nm)的反射率较低,其中阳光被叶绿素吸收。这表明,如果红色波段和近红外波段可以组合在一起,它们将提供有关植被的大量信息。

其中 NIR 和 red 表示这两个波段中每个波段的亮度。此亮度可能以反射率、辐射度或数字数 (DN) 为单位表示;NDVI 旨在在使用这些波长的平台上提供几乎相同的值。这个方程的一般形式称为“归一化差”——分子是“差”,分母“归一化”值。NDVI 的输出在 −1 和 1 之间变化。大量绿色植被的值约为 0.8-0.9。没有绿叶的值接近 0,水的值接近 -1。

/ 
// Band Arithmetic 
/  
// Calculate NDVI using Sentinel 2  
// Import and filter imagery by location and date. 
var sfoPoint = ee.Geometry.Point(-122.3774, 37.6194); 
var sfoImage = ee.ImageCollection('COPERNICUS/S2')  
                 .filterBounds(sfoPoint) 
                 .filterDate('2020-02-01', '2020-04-01') 
                 .first();  
// Display the image as a false color composite. 
Map.centerObject(sfoImage, 11); 
Map.addLayer(sfoImage, 
             { bands: ['B8', 'B4', 'B3'], 
               min: 0, max: 2000 }, 
               'False color');
// Extract the near infrared and red bands. 
var nir = sfoImage.select('B8'); 
var red = sfoImage.select('B4');  
// Calculate the numerator and the denominator using subtraction and addition respectively. 
var numerator = nir.subtract(red); 
var denominator = nir.add(red);  
// Now calculate NDVI. 
var ndvi = numerator.divide(denominator);  
// Add the layer to our map with a palette. 
var vegPalette = ['red', 'white', 'green']; 
Map.addLayer(ndvi, { min: -1, max: 1, palette: vegPalette }, 'NDVI Manual');

Single-Operation Computation of Normalized Difference for NDVI

// Now use the built-in normalizedDifference function to achieve the same outcome. 
var ndviND = sfoImage.normalizedDifference(['B8', 'B4']);  
Map.addLayer(ndviND, 
            { min: -1, max: 1, palette: vegPalette }, 
             'NDVI normalizedDiff');

向 normalizedDifference 提供两个区间的顺序很重要。我们使用近红外波段 B8 作为第一个参数,红色波段 B4 作为第二个参数。

Using Normalized Difference for NDWI

The Normalized Difference Water Index (NDWI) was developed by Gao (1996) as an index of vegetation water content.该指数对植被冠层液体含量的变化很敏感。这意味着该指数可用于检测经历干旱条件的植被或区分作物灌溉水平等。在干旱地区,可以区分经过灌溉的作物与自然植被。它有时也称为归一化差值水分指数 (NDMI)。

其中 NIR 是近红外的,中心在 860 nm (0.86 μm) 附近,SWIR 是短波红外,中心在 1240 nm (1.24 μm) 附近。

对于 Sentinel-2,B 8 是 NIR 波段,B11 是 SWIR 波段

// Use normalizedDifference to calculate NDWI 
var ndwi = sfoImage.normalizedDifference(['B8', 'B11']); 
var waterPalette = ['white', 'blue'];  
Map.addLayer(ndwi, { min: -0.5, max: 1, palette: waterPalette }, 'NDWI');

gee代码是指Google Earth Engine的编程语言,用于在Google Earth Engine平台上进行遥感影像合成。影像合成是指将多个遥感影像融合或组合起来,以生成新的影像产品或提取特定的信息。 三年影像合成是指基于三年时间范围内的遥感影像数据,利用gee代码进行合成处理。在合成过程中,可以使用一系列的遥感处理算法和技术,例如表面反射率校正、背景去除、云和阴影去除、归一化差异植被指数计算等,以提高合成影像的质量和可用性。 其中,gee代码的应用可以通过以下步骤来实现三年影像合成。首先,需要从Google Earth Engine平台的遥感影像数据库中获取三年内的多个影像数据。其次,通过gee代码进行数据预处理,包括校正、去噪、修补等操作,以提高影像的质量和一致性。然后,根据需要的合成目标,选择适当的合成算法和处理方法,如被动微波支持向量机算法、线性混合模型、多光谱融合算法等,对影像数据进行融合处理。最后,对合成结果进行评估和后处理,如边缘增强、色调调整、尺度转换等,以获得最终的三年影像合成产品。 通过gee代码实现三年影像合成可以广泛应用于各个领域,例如土地利用/覆盖分类、环境监测、资源管理等。这种方法可以提供更全面、一致性较好的遥感影像数据,为研究者和决策者提供更准确、全面的信息。同时,利用gee代码进行影像合成也能够实现对大规模遥感影像数据的快速处理和分析,提高工作效率和效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值