请给出在GEE中计算EVI的代码
时间: 2023-03-29 19:03:47 浏览: 175
GEE上不同影像NDVI的计算公式.txt
5星 · 资源好评率100%
以下是在GEE中计算EVI的代码:
```javascript
// Load the Landsat 8 surface reflectance collection.
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate('2019-01-01', '2019-12-31')
.filterBounds(geometry);
// Define the EVI function.
var evi = function(image) {
var nir = image.select('B5');
var red = image.select('B4');
var blue = image.select('B2');
var evi = nir.subtract(red).divide(nir.add(red.multiply(6)).subtract(blue.multiply(7.5)).add(1));
return image.addBands(evi.rename('EVI'));
};
// Apply the EVI function to the collection.
var eviCollection = collection.map(evi);
// Select and display the EVI band of the first image in the collection.
var eviImage = eviCollection.first().select('EVI');
Map.addLayer(eviImage, {min: -1, max: 1, palette: ['blue', 'white', 'green']}, 'EVI');
```
阅读全文