var geometry =
ee.Geometry.Polygon(
[[[121.90456654564989, 40.65237240724255],
[121.90456654564989, 40.46456998182115],
[122.08584095971239, 40.46456998182115],
[122.08584095971239, 40.65237240724255]]]);//自己在地图上勾画出研究区后会直接import,这个研究区域的范围可自行更改
var roi=ee.Image()
.toByte()
.paint({
featureCollection:geometry,
color:0,
width:2
});
// 设置日期范围
var startDate = '2023-02-01';
var endDate = '2023-02-10';
// 导入 Sentinel-1 数据集
var sentinel1 = ee.ImageCollection("COPERNICUS/S1_GRD")
.filterBounds(geometry) // 过滤研究区域内的影像
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VH'))
.filter(ee.Filter.eq('instrumentMode', 'IW'))
.filterDate(startDate, endDate) // 指定时间范围
.sort('system:time_start'); // 按时间升序排序
// 获取最新影像
var latestImage = sentinel1.first();
// 创建一个可视化参数
var visParams = {
bands: ['VV', 'VH'], // 选择显示的波段
min: -25, // 最小亮度值
max: 5, // 最大亮度值
gamma: 1.2 // 伽马校正参数
};
// 合成多个影像成一幅影像,如果研究区域涉及多幅影像的话会用到
var composite = sentinel1.mosaic();
// 裁剪合成影像到指定几何范围
var S_image = composite.clip(geometry);
// 在地图上显示合成影像
Map.centerObject(geometry, 8); // 设置地图中心和缩放级别
Map.addLayer(S_image, visParams, 'S_image');
//Map.addLayer(composite, visParams, 'composite');
Map.addLayer(sentinel1, visParams, 'Sentinel-1');//显示整幅影像
Map.addLayer(roi,{palette:"blue"},"roi");//显示边框
//时间
var timeLabel = ee.String('Image Time: ')
.cat(ee.Date(latestImage.get('system:time_start')).format('YYYY-MM-dd'));
// 打印合成影像信息
print("Sentinel-1 Image Information:", S_image);
print("Day",timeLabel);
//导出
Export.image.toDrive({
image:S_image.select(['VV','VH']),//如果不select的话会报错数据格式不兼容,因为angle的数据类型是float
description:'S_image',
scale:10,
region:geometry,
fileFormat:'GeoTIFF',
crs: "EPSG:4526",
maxPixels:1e13
});
新手刚开始学习GEE,在这里做个专栏用以记录和分享