我们如何进行NDVI和EVI指数的图表展示,我们可以通过建立一个函数NDVI和EVI,然后用map遍历每一期影像,从而实现图表的展示,这我们使用sentinel2影像进行分析。
Sentinel-2卫星是由欧洲空间局(ESA)和欧洲联盟开发的一个卫星系统,它可以提供高分辨率和高质量的地球观测数据,特别是在多光谱图像方面。
以下是Sentinel-2卫星影像的相关信息:
- 分辨率:Sentinel-2卫星有两个多光谱传感器(MSI),分别具有10米、20米和60米的分辨率。其中,10米分辨率的传感器可以提供高精度的地表信息。
- 波段:Sentinel-2卫星的多光谱传感器可以捕捉13个波段的数据,包括红外和紫外波段。
- 数据提供方式:Sentinel-2卫星的数据由ESA提供,并且可以通过ESA的Sentinel数据门户进行访问和下载。此外,一些商业公司也提供了Sentinel-2卫星数据的订阅和使用服务。
- 应用领域:Sentinel-2卫星影像在许多领域都有广泛的应用,包括农业、林业、城市规划、自然资源管理和环境监测等。
函数:
setOptions(options)
Sets options used to style this chart.
Returns this chart.
Arguments:
this:ui.chart (ui.Chart):
The ui.Chart instance.
options (Object):
An object defining chart style options such as:
- title (string) The title of the chart.
- colors (Array) An array of colors used to draw the chart. Its format should follow the Google Visualization API's options: https://developers.google.com/chart/interactive/docs/customizing_charts
Returns: ui.Chart
ui.Chart.image.series(imageCollection, region, reducer, scale, xProperty)
Generates a Chart from an ImageCollection. Plots derived values of each band in a region across images. Usually a time series.
- X-axis: Image, labeled by xProperty value.
- Y-axis: Band value.
- Series: Band names.
Returns a chart.
Arguments:
imageCollection (ImageCollection):
An ImageCollection with data to be included in the chart.
region (Feature|FeatureCollection|Geometry):
The region to reduce.
reducer (Reducer, optional):
Reducer that generates the values for the y-axis. Must return a single value. Defaults to ee.Reducer.mean().
scale (Number, optional):
Scale to use with the reducer in meters.
xProperty (String, optional):
Property to be used as the label for each image on the x-axis. Defaults to 'system:time_start'.
Returns: ui.Chart
代码:
代码语言:javascript复制var geometry =
/* color: #d63000 */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[113.12962886187917, -8.101032847560129],
[113.12962886187917, -8.12754392211754],
[113.16533442828542, -8.12754392211754],
[113.16533442828542, -8.101032847560129]]], null, false);
var S2A = ee.ImageCollection('COPERNICUS/S2_SR').filterDate('2021-01-01','2022-01-01').filterBounds(geometry);
// print(S2A);
var getIndices=function(image){
var NDVI = image.normalizedDifference(['B8', 'B4']).rename('NDVI');
var EVI = image.expression('2.5 * ((NIR - RED) / (NIR 2.4 * RED 1))',
{
'NIR': image.select('B8'),
'RED': image.select('B4')
}).rename('EVI');
return image.addBands([NDVI,EVI]);
};
var collection=S2A.map(getIndices);
// print(collection);
var chartEVI = ui.Chart.image.series({
imageCollection: collection.select('EVI'),
region: geometry,
reducer: ee.Reducer.mean(),
scale: 20
}).setOptions({
title: 'Original EVI Time Series',
interpolateNulls: false,
vAxis: {title: 'EVI', viewWindow: {min: 0, max: 1}},
hAxis: {title: '', format: 'YYYY-MM'},
lineWidth: 1,
pointSize: 4,
series: {
0: {color: '#238b45'},
},
})
print(chartEVI);
var chartNDVI = ui.Chart.image.series({
imageCollection: collection.select('NDVI'),
region: geometry,
reducer: ee.Reducer.mean(),
scale: 20
}).setOptions({
title: 'Original EVI Time Series',
interpolateNulls: false,
vAxis: {title: 'EVI', viewWindow: {min: 0, max: 1}},
hAxis: {title: '', format: 'YYYY-MM'},
lineWidth: 1,
pointSize: 4,
series: {
0: {color: '#238b45'},
},
})
print(chartNDVI);