目标:获取某区域的LST的影像
结果:在某一时段范围内,有多少期影像,最终就返回多少幅影像,并以tif格式输出
方法一:如果是Landsat8数据,'ST_B10'就是LST值,仅需要简单波段运算
-
代码
var roi = ee.FeatureCollection("users/yuanmengjia9991/yakou")
// 去云函数
function maskL8sr(image){
// Bits 4 and 3 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = (1 << 4);
var cloudsBitMask = (1 << 3);
// Get the pixel QA band.
var qa = image.select('QA_PIXEL');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
.and(qa.bitwiseAnd(cloudsBitMask).eq(0));
return image.updateMask(mask);
}
var dataset = ee.ImageCollection("LANDSAT/LC08/C02/T1_L2")
.filterDate('2016-3-15', '2021-10-31')
.filterBounds(roi)
.map(maskL8sr)
.map(function(image){
var thermalBands = image.select('ST_B10').multiply(0.00341802).add(149.0).rename("LST")
return image.addBands(thermalBands)
})
.select('LST');
//引入批量导出函数
var batch = require('users/fitoprincipe/geetools:batch')
//导出影像
batch.Download.ImageCollection.toDrive(dataset, 'yakou_LST', {
scale: 30,
region: roi
})