码迷,mamicode.com
首页 > 其他好文 > 详细

用matlab将nc数据读出来,写成二进制文件,然后用grads画图

时间:2015-04-06 21:36:24      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:

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

用matlab将nc数据读出来,写成二进制文件,然后用grads画图

标签:

原文地址:http://www.cnblogs.com/tiandi/p/4396648.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!