fix(Weather_download): 修正气象数据下载脚本的投影和分辨率设置.
This commit is contained in:
parent
ccfe4ef7bc
commit
39a290c3d6
@ -2,7 +2,7 @@
|
||||
* 气象数据下载 —— 以年平均气温与年总降雨量处理下载为例
|
||||
*
|
||||
* @author CVEO Team
|
||||
* @date 2026-01-15
|
||||
* @date 2026-01-16
|
||||
*
|
||||
* 1. 加载 ERA5-Land 数据
|
||||
* 2. 合成年度平均气温数据, 年度总降雨量数据
|
||||
@ -19,15 +19,16 @@ var region_name_en = "Baokang";
|
||||
var region = Baokang;
|
||||
var target_crs = "EPSG:4525";
|
||||
var target_res = 30;
|
||||
var orign_res = 10000;
|
||||
var start_year = 2021;
|
||||
var end_year = 2025;
|
||||
var start_date = start_year + "-01-01";
|
||||
var end_date = end_year + "-12-31";
|
||||
var ERA5Bands = ["temperature_2m", "total_precipitation_sum"];
|
||||
var commonBands = ["temperature", "total_precipitation_sum"];
|
||||
|
||||
// 设置研究区域的缓冲区, 确保粗分辨率数据能够完整覆盖研究区域
|
||||
var region_geo = region.geometry();
|
||||
var bounds = region_geo.bounds();
|
||||
var bounds = ee.Feature(region_geo.bounds()).buffer(orign_res * 3).geometry();
|
||||
var common_filter = ee.Filter.and(
|
||||
ee.Filter.bounds(bounds),
|
||||
ee.Filter.date(start_date, end_date)
|
||||
@ -84,13 +85,13 @@ print(year_str + " Annual Mean ERA5-Land Temperature Histogram", ui.Chart.image.
|
||||
var annual_mean_precipitation = ee.Image(yearlyRain.mean()).setDefaultProjection(proj);
|
||||
print(year_str + " Annual Mean ERA5-Land Precipitation Histogram", ui.Chart.image.histogram(annual_mean_precipitation, region, 10000, 258));
|
||||
|
||||
var annual_mean_temp_1km = annual_mean_temperature.clip(bounds).resample("bicubic").reproject({
|
||||
crs: "EPSG:4526",
|
||||
scale: 30,
|
||||
var annual_mean_temp_30m = annual_mean_temperature.clip(bounds).resample("bicubic").reproject({
|
||||
crs: "EPSG:4326",
|
||||
scale: target_res,
|
||||
});
|
||||
var annual_mean_precipitation_1km = annual_mean_precipitation.clip(bounds).resample("bicubic").reproject({
|
||||
crs: "EPSG:4526",
|
||||
scale: 30,
|
||||
var annual_mean_precip_30m = annual_mean_precipitation.clip(bounds).resample("bicubic").reproject({
|
||||
crs: "EPSG:4326",
|
||||
scale: target_res,
|
||||
});
|
||||
|
||||
var temperature_vis = {
|
||||
@ -119,11 +120,11 @@ var styling = {
|
||||
fillColor: "00000000",
|
||||
};
|
||||
|
||||
Map.centerObject(region, 7);
|
||||
Map.addLayer(annual_mean_temperature, temperature_vis, year_str + " Annual Mean Temperature 0.1 degree");
|
||||
Map.addLayer(annual_mean_precipitation, precipitation_vis, year_str + " Annual Mean Precipitation 0.1 degree");
|
||||
Map.addLayer(annual_mean_temp_1km, temperature_vis, year_str + " Annual Mean Temperature " + target_res + "m");
|
||||
Map.addLayer(annual_mean_precipitation_1km, precipitation_vis, year_str + " Annual Mean Precipitation " + target_res + "m");
|
||||
Map.centerObject(region, 9);
|
||||
Map.addLayer(annual_mean_temperature, temperature_vis, year_str + " Annual Mean Temperature 0.1°");
|
||||
Map.addLayer(annual_mean_precipitation, precipitation_vis, year_str + " Annual Mean Precipitation 0.1°");
|
||||
Map.addLayer(annual_mean_temp_30m, temperature_vis, year_str + " Annual Mean Temperature " + target_res + "m");
|
||||
Map.addLayer(annual_mean_precip_30m, precipitation_vis, year_str + " Annual Mean Precipitation " + target_res + "m");
|
||||
Map.addLayer(region.style(styling), {}, region_name);
|
||||
|
||||
// 导出合并后的影像
|
||||
@ -131,8 +132,8 @@ Map.addLayer(region.style(styling), {}, region_name);
|
||||
// 并对缺失值进行填充, 否则默认为nan不便于后续本地处理
|
||||
function exportCOG(image, description, folder, region, scale, crs) {
|
||||
image = image.toFloat().unmask(-9999.0);
|
||||
// 默认为 EPSG:4526 投影
|
||||
crs = crs || "EPSG:4526";
|
||||
// 默认为 EPSG:4326 投影
|
||||
crs = crs || "EPSG:4326";
|
||||
Export.image.toDrive({
|
||||
image: image,
|
||||
description: description,
|
||||
@ -150,18 +151,18 @@ function exportCOG(image, description, folder, region, scale, crs) {
|
||||
});
|
||||
}
|
||||
|
||||
print("Start exporting " + year_str + " Yearly Mean ERA5-Land Temperature (" + target_crs + " " + target_res + "m)", annual_mean_temperature);
|
||||
print("Start exporting " + year_str + " Yearly Mean ERA5-Land Temperature (" + target_crs + " " + target_res + "m)", annual_mean_temp_30m);
|
||||
exportCOG(
|
||||
annual_mean_temperature,
|
||||
annual_mean_temp_30m,
|
||||
region_name_en + "_ERA5_Temperature_" + year_str + "_" + target_res + "m",
|
||||
"Temperature",
|
||||
region,
|
||||
target_res,
|
||||
target_crs
|
||||
);
|
||||
print("Start exporting " + year_str + " Yearly Mean ERA5-Land Precipitation (" + target_crs + " " + target_res + "m)", annual_mean_precipitation);
|
||||
print("Start exporting " + year_str + " Yearly Mean ERA5-Land Precipitation (" + target_crs + " " + target_res + "m)", annual_mean_precip_30m);
|
||||
exportCOG(
|
||||
annual_mean_precipitation,
|
||||
annual_mean_precip_30m,
|
||||
region_name_en + "_ERA5_Precipitation_" + year_str + "_" + target_res + "m",
|
||||
"Precipitation",
|
||||
region,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user