用matlab将nc数据读出来,写成二进制文件,然后用grads画图
clear,clc
nt=735;
ny=73; %2.5*2.5格点的
nx=144; %2.5*2.5格点的
f=netcdf('air.mon.mean.nc','nowrite');
tt=f{'air'}(:);
close(f)
fid=fopen('a5.grd','w');
for it=1:nt
for j=1:ny
for i=1:nx
count= fwrite(fid,tt(it,j,i),'float');%根据例子这里用原始的数据
end
end
end
fclose(fid)
a5.grd 对应的ctl文件是
dset F:\a5.grd
title Monthly mean air temperature NCEP Reanalysis
options sequential yrev
undef -9.96921e+36
xdef 145 linear 0 2.5
ydef 73 linear -90 2.5
zdef 1 linear 0 0
tdef 735 linear 00Z01JAN1948 1mo
vars 1
a 0 -999 Monthly Mean Air Temperature
endvars