利用gee使用Landsat影像计算20年的rsei
时间: 2024-06-09 08:09:05 浏览: 279
gee-Landsat影像 随机森林分类代码
5星 · 资源好评率100%
要计算20年的RSEI,您需要获取Landsat影像数据,并使用Google Earth Engine(GEE)的代码编辑器来计算。以下是一些基本的步骤:
1. 打开GEE的代码编辑器(https://code.earthengine.google.com)。
2. 输入以下代码以加载Landsat 5、7和8的表面反射率数据:
```javascript
var collection5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR');
var collection7 = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR');
var collection8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR');
```
3. 使用以下代码筛选出您需要的影像:
```javascript
var start_date = '1999-01-01';
var end_date = '2019-12-31';
var filteredCollection5 = collection5
.filterDate(start_date, end_date);
var filteredCollection7 = collection7
.filterDate(start_date, end_date);
var filteredCollection8 = collection8
.filterDate(start_date, end_date);
```
4. 定义RSEI计算所需的参数:
```javascript
var bands = ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7'];
var solar_zenith = 'SOLAR_ZENITH_ANGLE';
var solar_azimuth = 'SOLAR_AZIMUTH_ANGLE';
var sat_zenith = 'SENSOR_ZENITH_ANGLE';
var sat_azimuth = 'SENSOR_AZIMUTH_ANGLE';
var cloud_mask = 'pixel_qa';
```
5. 加载RSEI计算所需的函数:
```javascript
var RSEI = require('users/dmlmonteiro/RSEI:RSEI_Functions');
```
6. 使用以下代码计算每个影像的RSEI:
```javascript
var rseiCollection5 = filteredCollection5.map(function(image){
var rsei = RSEI.RSEI_From_Image(image, bands, solar_zenith, solar_azimuth, sat_zenith, sat_azimuth, cloud_mask);
return image.addBands(rsei);
});
var rseiCollection7 = filteredCollection7.map(function(image){
var rsei = RSEI.RSEI_From_Image(image, bands, solar_zenith, solar_azimuth, sat_zenith, sat_azimuth, cloud_mask);
return image.addBands(rsei);
});
var rseiCollection8 = filteredCollection8.map(function(image){
var rsei = RSEI.RSEI_From_Image(image, bands, solar_zenith, solar_azimuth, sat_zenith, sat_azimuth, cloud_mask);
return image.addBands(rsei);
});
```
7. 将计算出的RSEI导出为GeoTIFF格式的文件:
```javascript
Export.image.toDrive({
image: rseiCollection5.select('RSEI').toBands(),
description: 'rsei_landsat5',
scale: 30,
maxPixels: 1e13,
region: region,
folder: 'RSEI'
});
Export.image.toDrive({
image: rseiCollection7.select('RSEI').toBands(),
description: 'rsei_landsat7',
scale: 30,
maxPixels: 1e13,
region: region,
folder: 'RSEI'
});
Export.image.toDrive({
image: rseiCollection8.select('RSEI').toBands(),
description: 'rsei_landsat8',
scale: 30,
maxPixels: 1e13,
region: region,
folder: 'RSEI'
});
```
其中,“region”是您需要处理的区域,也可以使用GEE的绘图工具来指定。此外,您还可以更改输出文件的格式和位置。
阅读全文