From 39a290c3d652a6a108c2b63b215ea2b96d872825 Mon Sep 17 00:00:00 2001 From: gis-xh Date: Fri, 16 Jan 2026 12:15:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(Weather=5Fdownload):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E6=B0=94=E8=B1=A1=E6=95=B0=E6=8D=AE=E4=B8=8B=E8=BD=BD=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=8A=95=E5=BD=B1=E5=92=8C=E5=88=86=E8=BE=A8?= =?UTF-8?q?=E7=8E=87=E8=AE=BE=E7=BD=AE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GEE_Scripts/Weather_download.js | 41 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/GEE_Scripts/Weather_download.js b/GEE_Scripts/Weather_download.js index 3ee83ff..185ca20 100644 --- a/GEE_Scripts/Weather_download.js +++ b/GEE_Scripts/Weather_download.js @@ -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,