Google Earth Engine(GEE)大批量显示和下载哨兵1号数据(Sentinel-1),多说无用,直接上代码
【代码】GEE大批量下载哨兵1(Sentinel-1)号数据,多说无用,直接上代码。
·
多说无用,直接上代码(GEE大批量下载哨兵1(Sentinel-1)号数据):
var rectangle = ee.Geometry.Rectangle([50, 42, 80, 48]); // [west, south, east, north]
function dBToLinear(image) {
var vvLinear = image.select('VV').expression(
'10 ** ((VV / 10.0) - 1)',
{'VV': image.select('VV')}
).rename('VV_linear');
var vhLinear = image.select('VH').expression(
'10 ** ((VH / 10.0) - 1)',
{'VH': image.select('VH')}
).rename('VH_linear');
return image.addBands([vvLinear, vhLinear]);
}
var sentinel1_collection = ee.ImageCollection('COPERNICUS/S1_GRD')
.filterBounds(table)
.filterDate('2016-01-01', '2018-04-01')
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.select(['VV', 'VH']) // 仅选择 VV 和 VH 波段
.map(dBToLinear) // 对每个图像应用 dB 到线性单位的转换
.map(function(image) {
return image.clip(table); // 按研究区域裁剪图像
});
var rgbVis = {
min: 0.0,
max: 0.3,
bands: ['VH_linear', 'VV_linear'],
};
print("sentinel1_collection", sentinel1_collection);
Map.addLayer(sentinel1_collection, rgbVis, 'sentinel1_collection');
Map.centerObject(table,7)
function exportSentinel1ImageCollection(imgCol) {
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"])
.get("list");
indexList.evaluate(function(indexs) {
indexs.forEach(function(index) {
var image = imgCol.filter(ee.Filter.eq("system:index", index)).first();
// 注意:Sentinel-1 数据已经是整型,但转换后的线性值可能是浮点型
// 这里不需要再转换为 int16,除非你有特定的理由要这样做
// image = image.toInt16(); // 通常不需要这一行
Export.image.toDrive({
image: image,
description: index,
fileNamePrefix: index,
folder: 'S1_linear_images', // 更改文件夹名称以匹配你的需求
region: table.bounds(), // 使用边界框作为导出区域
scale: 10, // Sentinel-1 IW 模式的分辨率通常为 10 米或 20 米,具体取决于子模式
crs: "EPSG:4326",
maxPixels: 1e13, // 根据需要调整,但请注意 Google Drive 的导出限制
fileDimensions: 10240, // 可选,用于控制导出文件的大小(宽x高像素)
fileFormat: 'GeoTIFF' // 明确指定文件格式
});
});
});
}
exportSentinel1ImageCollection(sentinel1_collection);

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐
所有评论(0)