fix(GEE_Scripts): 添加HLS数据作为S2备用数据源并优化导出配置.
This commit is contained in:
parent
e750c067e9
commit
70a7d1433b
@ -2,7 +2,7 @@
|
|||||||
* Sentinel-1 & Sentinel-2 哨兵一号与二号长时序数据下载 —— 适用于小范围区域年度数据获取
|
* Sentinel-1 & Sentinel-2 哨兵一号与二号长时序数据下载 —— 适用于小范围区域年度数据获取
|
||||||
*
|
*
|
||||||
* @author CVEO Team
|
* @author CVEO Team
|
||||||
* @date 2026-01-05
|
* @date 2026-01-06
|
||||||
*
|
*
|
||||||
* 1. 加载 Sentinel-1, Sentinel-2 数据与 Cloud Score+ 云掩膜, 以及 HLS 数据
|
* 1. 加载 Sentinel-1, Sentinel-2 数据与 Cloud Score+ 云掩膜, 以及 HLS 数据
|
||||||
* 2. 合成年度Sentinel-1, Sentinel-2, HLS无云影像
|
* 2. 合成年度Sentinel-1, Sentinel-2, HLS无云影像
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* 4. 合并Sentinel-1和Sentinel-2影像
|
* 4. 合并Sentinel-1和Sentinel-2影像
|
||||||
* 5. 导出COG云优化并填补缺失值的GeoTIFF影像 (小区域不分块)
|
* 5. 导出COG云优化并填补缺失值的GeoTIFF影像 (小区域不分块)
|
||||||
*
|
*
|
||||||
* 注: 截止至 2026-01-05, GEE 仍未集成 2015-2017 年的 L2A 数据.
|
* 注: 截止至 2026-01-05, GEE 仍未集成 2015-2017 年的 L2A 数据, 且 2018 年的 L2A 数据仍不完整.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 加载研究区域和影像
|
// 加载研究区域和影像
|
||||||
@ -20,7 +20,7 @@ var name_list = [
|
|||||||
"高雄左营区左营军港",
|
"高雄左营区左营军港",
|
||||||
"高雄旗山区陆军第八军团指挥部",
|
"高雄旗山区陆军第八军团指挥部",
|
||||||
];
|
];
|
||||||
var target_index = 2; // 从 0 开始计数, 0-3
|
var target_index = 0; // 从 0 开始计数, 0-3
|
||||||
var region_name = name_list[target_index];
|
var region_name = name_list[target_index];
|
||||||
var region = ee.FeatureCollection(
|
var region = ee.FeatureCollection(
|
||||||
demoPoints
|
demoPoints
|
||||||
@ -121,6 +121,30 @@ function sortedByPriority(collection, region, cloud_field) {
|
|||||||
return ee.ImageCollection(sorted);
|
return ee.ImageCollection(sorted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载HLS L30和L30数据
|
||||||
|
var HLSL30 = ee
|
||||||
|
.ImageCollection("NASA/HLS/HLSL30/v002")
|
||||||
|
.filter(common_filter)
|
||||||
|
.filter(ee.Filter.lt("CLOUD_COVERAGE", cloud_threshold))
|
||||||
|
.map(maskHLSclouds)
|
||||||
|
.select(L30Bands, commonBands);
|
||||||
|
var HLSS30 = ee
|
||||||
|
.ImageCollection("NASA/HLS/HLSS30/v002")
|
||||||
|
.filter(common_filter)
|
||||||
|
.filter(ee.Filter.lt("CLOUD_COVERAGE", cloud_threshold))
|
||||||
|
.map(maskHLSclouds)
|
||||||
|
.select(s2Bands, commonBands);
|
||||||
|
var HLSdataset = ee.ImageCollection(HLSL30.merge(HLSS30));
|
||||||
|
print(start_date + " - " + end_date + " HLSdataset", HLSdataset);
|
||||||
|
var targetHLSCol = sortedByPriority(HLSdataset, region, "CLOUD_COVERAGE");
|
||||||
|
// Mosaic 处理后会丢失投影信息, 需重新设置投影
|
||||||
|
var proj = targetHLSCol.first().select(1).projection();
|
||||||
|
var hls_img = ee.Image(targetHLSCol.mosaic()).setDefaultProjection(proj);
|
||||||
|
var hls_10m_img = hls_img.resample("bicubic").reproject({
|
||||||
|
crs: proj,
|
||||||
|
scale: 10,
|
||||||
|
});
|
||||||
|
|
||||||
// 加载Sentinel-1 GRD数据
|
// 加载Sentinel-1 GRD数据
|
||||||
var S1dataset = ee
|
var S1dataset = ee
|
||||||
.ImageCollection("COPERNICUS/S1_GRD")
|
.ImageCollection("COPERNICUS/S1_GRD")
|
||||||
@ -150,28 +174,21 @@ var S2dataset = ee
|
|||||||
.linkCollection(S2csPlus, [QA_BAND])
|
.linkCollection(S2csPlus, [QA_BAND])
|
||||||
.map(maskS2cloudsByCS)
|
.map(maskS2cloudsByCS)
|
||||||
.select(s2Bands, commonBands);
|
.select(s2Bands, commonBands);
|
||||||
var targetS2 = sortedByPriority(S2dataset, region);
|
var targetS2Col = sortedByPriority(S2dataset, region);
|
||||||
var s2_img = ee.Image(targetS2.mosaic());
|
var s2_img = ee.Image(targetS2Col.mosaic());
|
||||||
print(start_date + " - " + end_date + " S2dataset", S2dataset);
|
print(start_date + " - " + end_date + " S2dataset", S2dataset);
|
||||||
|
|
||||||
|
// 2015-2018 年间若 Sentinel-2 数据为空, 则使用重采样到 10m 的 HLS 数据
|
||||||
|
if (
|
||||||
|
S2dataset.size().getInfo() === 0 ||
|
||||||
|
(start_year === 2018 && (target_index === 0 || target_index === 3))
|
||||||
|
) {
|
||||||
|
s2_img = hls_10m_img;
|
||||||
|
}
|
||||||
|
|
||||||
var s2_img_rgb = s2_img.select(["Red", "Green", "Blue"]);
|
var s2_img_rgb = s2_img.select(["Red", "Green", "Blue"]);
|
||||||
var s2_img_frgb = s2_img.select(["NIR", "Red", "Green"]);
|
var s2_img_frgb = s2_img.select(["NIR", "Red", "Green"]);
|
||||||
|
|
||||||
var HLSL30 = ee
|
|
||||||
.ImageCollection("NASA/HLS/HLSL30/v002")
|
|
||||||
.filter(common_filter)
|
|
||||||
.filter(ee.Filter.lt("CLOUD_COVERAGE", cloud_threshold))
|
|
||||||
.map(maskHLSclouds)
|
|
||||||
.select(L30Bands, commonBands);
|
|
||||||
var HLSS30 = ee
|
|
||||||
.ImageCollection("NASA/HLS/HLSS30/v002")
|
|
||||||
.filter(common_filter)
|
|
||||||
.filter(ee.Filter.lt("CLOUD_COVERAGE", cloud_threshold))
|
|
||||||
.map(maskHLSclouds)
|
|
||||||
.select(s2Bands, commonBands);
|
|
||||||
var HLS = ee.ImageCollection(HLSL30.merge(HLSS30));
|
|
||||||
var targetHLS = sortedByPriority(HLS, region, "CLOUD_COVERAGE");
|
|
||||||
var hls_img = ee.Image(targetHLS.mosaic());
|
|
||||||
|
|
||||||
var s1_vis = {
|
var s1_vis = {
|
||||||
min: -25,
|
min: -25,
|
||||||
max: 5,
|
max: 5,
|
||||||
@ -185,8 +202,8 @@ var s2_vis = {
|
|||||||
|
|
||||||
var true_rgb_vis = {
|
var true_rgb_vis = {
|
||||||
bands: ["Red", "Green", "Blue"],
|
bands: ["Red", "Green", "Blue"],
|
||||||
min: 0.01,
|
min: 0.0,
|
||||||
max: 0.15,
|
max: 0.2,
|
||||||
};
|
};
|
||||||
|
|
||||||
var false_rgb_vis = {
|
var false_rgb_vis = {
|
||||||
@ -202,10 +219,10 @@ var styling = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Map.centerObject(region, 14);
|
Map.centerObject(region, 14);
|
||||||
Map.addLayer(s1_vv_img, s1_vis, start_year + " Sentinel-1 GRD VV");
|
Map.addLayer(s1_vv_img, s1_vis, start_year + " Sentinel-1 GRD VV", false);
|
||||||
Map.addLayer(s1_vh_img, s1_vis, start_year + " Sentinel-1 GRD VH");
|
Map.addLayer(s1_vh_img, s1_vis, start_year + " Sentinel-1 GRD VH", false);
|
||||||
Map.addLayer(hls_img, false_rgb_vis, start_year + " HLS False RGB", false);
|
|
||||||
Map.addLayer(hls_img, true_rgb_vis, start_year + " HLS True RGB");
|
Map.addLayer(hls_img, true_rgb_vis, start_year + " HLS True RGB");
|
||||||
|
Map.addLayer(hls_10m_img, true_rgb_vis, start_year + " HLS True RGB 10m");
|
||||||
Map.addLayer(
|
Map.addLayer(
|
||||||
s2_img_frgb,
|
s2_img_frgb,
|
||||||
false_rgb_vis,
|
false_rgb_vis,
|
||||||
@ -234,6 +251,7 @@ Export.image.toDrive({
|
|||||||
folder: "Sentinel",
|
folder: "Sentinel",
|
||||||
region: region, // 添加后会自动裁剪
|
region: region, // 添加后会自动裁剪
|
||||||
scale: 10,
|
scale: 10,
|
||||||
|
crs: "EPSG:4326",
|
||||||
maxPixels: 1e13, // GEE 最多支持 1e8 像素, 当超过时会自动分块
|
maxPixels: 1e13, // GEE 最多支持 1e8 像素, 当超过时会自动分块
|
||||||
fileFormat: "GeoTIFF",
|
fileFormat: "GeoTIFF",
|
||||||
// 导出COG云优化的GeoTIFF影像, 并明确设置缺失值为-9999.0
|
// 导出COG云优化的GeoTIFF影像, 并明确设置缺失值为-9999.0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user