NC数据(即 NetCDF 数据) 及Matlab工具箱maxcdf

注意啦注意啦,一晃3年过去了,现在的matlab已经自带读取netcdf程序,而且最新的nc文件如果用了cf-1.4以上标准写的话,老的nc插件已经无法支持了

详细信息,请猛击下面链接,看更多更新内容

请更新到2011b以上版本,即可用最简单的方式读取nc

实在不愿意更新太多的,也可采用low-level方式来读取

http://hi.baidu.com/curbzz/item/2e975a619448bb2f69105baf


呃,是不是还有人想找新版matlab下载地址啊?

嘘,既然用matlab,我就默认你们都懂英文了哦



============================================================

the first day,终于开始接触鼎鼎大名的nc数据,曾有心考虑是否要学一下,最终还是没能绕开

格式说明
nc数据格式来自unidata,
NetCDF (network Common Data Form) is a set of                software libraries and machine-independent data                formats that support the creation, access, and sharing of         array-oriented scientific data.               
http://www.unidata.ucar.edu/software/netcdf/index.html

相关documentation(可下载pdf):
http://www.unidata.ucar.edu/software/netcdf/docs/

相关插件
nc文件的matlab插件maxcdf toolbox:
http://mexcdf.sourceforge.net/index.html
maxcdf插件适用于Matlab2008b之后版本,例如我下载的mexcdf.r3183,解压缩后为一个maxcdf文件夹,其下包含子文件夹maxnc和snctools两个工具。

General InfoWhat's MEXNC?

MEXNC is an interface to NetCDF files for MATLAB, and has  roughly a one-to-one equivalence with the C API for NetCDF.  In  fact, there's no better introduction to MEXNC than to read the   NetCDF Documentationprovided by Unidata.

MEXNC is now layered on top of MATLAB's netcdf package, so if  you have any old code that uses mexnc, it should end up calling   the netcdf package "under the hood".  However, you should   probably look to rewrite your code to notuse mexnc   anymore and just call the netcdf package instead.  SNCTOOLS does   just that...

SNCTOOLS

SNCTOOLS is a set of MATLAB programs that read and write netCDF files.         It was originally written to use mexnc, but now it also has  backends         for the native MATLAB netcdf package as well as a java backend.   Check the tutorialfor some examples.

续:
以上两个工具虽然好用,但对于从未接触过nc的人来说,实在是不直观
还是要配合netcdf toolbox这个工具箱使用
利用ncbrowser命令 在弹出的对话框中选中需要分析的nc文件,观察各dimension 和variable

nc_dump('filename') 显示nc文件的具体信息,相对ncbrowser,适合看属性信息。
至于读取,暂时用了matlab自带的netcdf系列命令 具体doc netcdf即可

例如

ncid = netcdf.open('HadSST2_1x1.nc','nc_nowrite');
vid = netcdf.inqvarid(ncid,'time');
htimes = netcdf.getvar(ncid,vid);   % hours since 1-1-1 0 0 0 
vid = netcdf.inqvarid(ncid,'lon');
hlons = netcdf.getvar(ncid,vid);  % longitude
vid = netcdf.inqvarid(ncid,'lat');
hlats = netcdf.getvar(ncid,vid);  % latitude
vid = netcdf.inqvarid(ncid,'sst');
sst = netcdf.getvar(ncid,vid);  % Monthly 1degree resolution SST anomalies
% Shape = 360(long) * 180(lat) * time)

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值