matlab读取逐日的1km分辨率中国大陆地区的土壤水数据,并汇总至逐月分辨率
1.前言
ESSD一篇文章介绍了逐日的土壤水数据:
ESSD - A 1 km daily soil moisture dataset over China using in situ measurement and machine learning
图片来源:Li et al., 2022, ESSD
中国大陆地区的土壤水的数据下载地址:
国家青藏高原科学数据中心
该数据集提供了中国范围1km高质量的土壤湿度数据集-SMCI1.0(Soil Moisture of China by in situ data, version 1.0),SMCI1.0是包含2000-2022年、日尺度、以10厘米为间隔10层深度(10-100cm)的高时空分辨率土壤湿度,数据单位为0.001m³/m³,缺失值为-999,投影为WGS1984。该数据集是以中国气象局提供的1,648个站点观测10层土壤湿度作为基准,使用ERA5_Land气象强迫数据、叶面积指数(LAI)、土地覆盖类型(Landtypes)、地形(DEM)和土壤特性(Soil properties)作为协变量,通过机器学习方式获得。本研究进行了两组实验以验证SMCI1.0的精度,时间尺度上:ubRMSE为0.041-0.052,R为0.883-0.919;空间尺度上:ubRMSE为0.045-0.051,R为0.866-0.893。 由于SMCI1.0是基于实地观测的土壤湿度,它可以作为现有基于模型和卫星数据集的有效补充。该数据产品可用于各种水文、气象、生态分析和建模,尤其在需要高质量、高分辨率土壤湿度的应用上至关重要。有关数据集的引用及详细描述,请阅读说明文档。为便于使用,本研究提供了两种不同分辨率的版本:30 秒(~1km)和0.1度(~9km)。
针对于数据说明中关于单位的问题,chatgpt是这样解释的:
可以使用Filezilla下载,本专栏以9 km逐日分辨率的土壤水数据为例,介绍如何使用matlab批量读取并合并成月分辨率。
2.数据读取
在Matlab中,批量读取数据:
%% uni-stuttgart.de
% Chistrong Wen
% 2024-10-30
address = '/Volumes/Expansion/All_data/SWOT/';
GFA = dir(fullfile(address,'*nc'));
k=length(GFA);
ncdisp([address,GFA(11).name])
lon = ncread([address,GFA(1).name],'lon');
lat = ncread([address,GFA(1).name],'lat');
[lon,lat] = meshgrid(lon,lat);in = [365,365,366,365,365,365,366,365,365,365,366];
mm_ping = [31,28,31,30,31,30,31,31,30,31,30,31];
mm_run = [31,29,31,30,31,30,31,31,30,31,30,31];for i = 1:kB = ncread(GFA(i).name,'SMCI');for j = 1:in(i)AA(:,:,j) = double(B(:,:,j)');endSMCI_soil_dd(i).rg = AA;%% data = AA;monthly_avg = zeros(360,630,12);start_idx = 1;for month = 1:12if(in(i)==366)days = mm_run(month);elsedays = mm_ping(month);end monthly_data = data(:,:,start_idx:start_idx + days - 1);monthly_avg(:,:,month) = mean(monthly_data,3);start_idx = start_idx + days;endSMCI_soil_mm(i).rg = monthly_avg;disp(i)
end
total_smci = cat(3,SMCI_soil_mm(:).rg);for i = 2010:2020for j = 1:12tt(i,j) = time_transfer([i,j,15],1);end
end
tt1 = tt(2010:end,:)';
tt2 = tt1(:)';
O.lon = lon;
O.lat = lat;
O.rg = total_smci;
O.tt = tt2;area_ind_csr=inpolygon(O.lon,O.lat,nc_bound(:,1),nc_bound(:,2));
area_scale=cal_grid_region(O);
for ii=1:size(O.rg,3)soil_smci_rg(ii)=nansum(nansum((O.rg(:,:,ii).*area_ind_csr.*area_scale))/nansum(nansum(area_ind_csr.*area_scale)));soil_smci_tt(ii)=O.tt(ii);disp(ii)
end
plot(soil_smci_tt,soil_smci_rg-mean(soil_smci_rg))
代码要点:
(1)批量读取
address = '/Volumes/Expansion/All_data/SWOT/';
GFA = dir(fullfile(address,'*nc'));
k=length(GFA);
(2)天数据合并成月数据
in = [365,365,366,365,365,365,366,365,365,365,366];
mm_ping = [31,28,31,30,31,30,31,31,30,31,30,31];
mm_run = [31,29,31,30,31,30,31,31,30,31,30,31];
for i = 1:k
B = ncread(GFA(i).name,'SMCI');
for j = 1:in(i)
AA(:,:,j) = double(B(:,:,j)');
end
SMCI_soil_dd(i).rg = AA;
%%
data = AA;
monthly_avg = zeros(360,630,12);
start_idx = 1;
for month = 1:12
if(in(i)==366)
days = mm_run(month);
else
days = mm_ping(month);
end
monthly_data = data(:,:,start_idx:start_idx + days - 1);
monthly_avg(:,:,month) = mean(monthly_data,3);
start_idx = start_idx + days;
end
SMCI_soil_mm(i).rg = monthly_avg;
disp(i)
end
(3)结构体数据整合
total_smci = cat(3,SMCI_soil_mm(:).rg);
3.结果
(1)空间分辨率
(2)时间序列
参考资料:
LI, Qingliang, et al. A 1 km daily soil moisture dataset over China using in situ measurement and machine learning. Earth System Science Data, 2022, 14. Jg., Nr. 12, S. 5267-5286.
❤️欢迎点赞收藏❤️