Gleam数据下载与预处理(nc转tif文件)


gleam数据3.6a
链接:https://pan.baidu.com/s/1xrOXYby6sYJMAEi6bltHXw?pwd=gnwd
提取码:gnwd
nc to tif mtlab代码
%%
clc
clear
%% 读取文件信息
ncFile = 'SMsurf_1980-2021_GLEAM_v3.6a_MO.nc'; %设定文件
ncdisp(ncFile)
outpath='E:\DATA\MWSNDVI\gleam\MONTH\E\'
%% 读取数据
time=1980;
y=1;
lat=ncread(ncFile,'lat');
lon=ncread(ncFile,'lon');
E=ncread(ncFile,'E'); % Actual evaporation from GLEAM v3.6a
for i=1:1:504
if y==13
time=time+1;
y=1;
end
outname=[int2str(time),int2str(y),'gleam'];
out=E(:,:,i);
out=rot90(out);
%out = fliplr(out);
R=georasterref('RasterSize', size(out),'Latlim', [-89.875 89.875], 'Lonlim', [-179.875 179.875]);
geotiffwrite([outpath,outname], out, R);
y=y+1;
disp(outname)
end
代码可以根据实际情况修改,这是以E作为例子;
如果要循环文件夹的话,可以把变量名称从 文件名称中取 ;在将文件夹写入循环 嵌套三个循环;命名循环比较简单;