声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1875|回复: 0

[编程技巧] matlab中关于nc文件的一些主要命令

[复制链接]
发表于 2015-10-16 08:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
------------------------------------------------------------------------------------------------------------------
1、File Function文件操作
   (1). netcdf.open: open netCDF source.
      ncid = netcdf.open(filename, mode)
      parameter: 'WRITE' for read-write access, 'SHARE' for synchronous(同时) file updates, or 'NOWRITE' for read-only access.
(2). netcdf.inq: Return information about netCDF file.
     [ndims, nvars, ngatts, unlimdimid]=netcdf.inq(ncid)
      ndims: number of dimensions
      nvars: number of variables
      ngatts: number of global attributes   'nglobalatts'
     unlimdimid: identity of the unlimited dimension
(3). netcdf.close: Close netCDF file.
       netcdf.close(ncid)
--------------------------------------------------------------------------------------
2、dimension functions维数
   netcdf.inqDim: Return netCDF dimension name and length.   
  [dimname, dimlen] = netcdf.inqDim(ncid,dimid)
   dimd: dimension ID
--------------------------------------------------------------------------------------
3、Variable Functions变量
(1). netcdf.inqVarID: Return ID associated with variable name.
    varid = netcdf.inqVarID(ncid,varname)
(2). netcdf.getVar: Return data from netCDF variable.
   data = netcdf.getVar(ncid,varid)
   data = netcdf.getVar(ncid,varid,start)
   data = netcdf.getVar(ncid,varid,start,count)
   data = netcdf.getVar(ncid,varid,start,count,stride)
(3). netcdf.inqVar: Return information about netCDF variable.
   [varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid)
   dimids: dimensions IDs,
   natts: the number of attributes of  the variable identified by varid.
--------------------------------------------------------------------------------------
4、Attribute Functions变量属性
(1). netcdf.inqAttName: Return name of netCDF attribute.
     attname = netcdf.inqAttName(ncid,varid,attnum) returns the name of an attribute given the attribute number.(从Variable Functions(3)中可知道)
(2). netcdf.getAtt: Return netCDF attribute.
    attrvalue = netcdf.getAtt(ncid,varid,attname)
(3). netcdf.inqAtt:Return information about netCDF attribute.
   [xtype,attlen] = netcdf.inqAtt(ncid,varid,attname) [returns the datatype and length of an attribute identified by attname.]
--------------------------------------------------------------------------------------
----the--end---

转自:http://blog.sina.com.cn/u/66678321
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-12-26 15:18 , Processed in 0.087883 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表