matlab查ncinfo_ncinfo

ncinfo

Return information about NetCDF data source

Syntax

finfo = ncinfo(source)

vinfo = ncinfo(source,varname)

ginfo = ncinfo(source,groupname)

Description

finfo = ncinfo(source) returns information in the structure finfo about the entire NetCDF data source specified by source, where source can be the name of a NetCDF file or the URL of an OPeNDAP NetCDF data source.

vinfo = ncinfo(source,varname) returns information in the structure vinfo about the variable varname in source.

ginfo = ncinfo(source,groupname) returns information in the structure ginfo about the group groupname in source (only NetCDF4 data sources).

Note:   Use ncdisp for visual inspection of a NetCDF source.

Input Arguments

source       Text string specifying the name of a NetCDF file or the URL of an OPeNDAP NetCDF data source.

varname    Text string specifying the name of a variable in a NetCDF file or OPeNDAP data source.

groupname    Text string specifying the name of a group in a NetCDF file or OPeNDAP data source.

Output Arguments

finfoA structure with the following fields.

FieldDescription

Filename                     NetCDF file name or OPeNDAP URL

Name                         '/', indicating the full file

Dimensions                 An array of structures with these fields:

Name                                                                                      Dimension name

Length                                                                                     Current length of dimension

Unlimited                                                                                 Boolean flag, true for unlimited dimensions

Variables                    An array of structures with these fields:

Name                                                                                     Variable name

Dimensions                                                                               Associated dimensions

Size                                                                                            Current variable size

Datatype                                                                                     MATLAB® datatype

Attributes                                                                                    Associated variable attributes

ChunkSize                                                                             Chunk size, if defined. [] otherwise

FillValue                                                                                        Fill value of the variable.

DeflateLevel                                                                             Deflate filter level, if enabled.

Shuffle                                                                                       Shuffle filter enabled flag

Attributes                    An array of global attributes with these fields:

Name                                                                                      Attribute name

Value                                                                                      Attribute value

Groups                      An array of groups present in the file, for netcdf4 files; An empty array ([]) for all other NetCDF file                                               formats.

Format                       The format of the NetCDF file

vinfo                                       A structure containing only the variable fields from finfo.

Field                                                       Description

Filename                                                 NetCDF file name

Name                                                     Name of the variable

Dimensions                                              Dimensions of the variable

Size                                                        Size of the current variable

Datatype                                                 MATLAB datatype

Attributes                                                Attributes associated with the variable

ChunkSize                                               Chunk size, if defined. [] otherwise.

FillValue                                                   Fill value used in the variable.

DeflateLevel                                             Deflate filter level, if enabled.

Shuffle                                                     Shuffle filter enabled flag

Format                                                    The format of the NetCDF file

Examples

Search for dimensions with names that start with the character x in the file.

finfo = ncinfo('example.nc');

disp(finfo);

dimNames = {finfo.Dimensions.Name};

dimMatch = strncmpi(dimNames,'x',1);

disp(finfo.Dimensions(dimMatch));

Obtain the size of a variable and check if it has any unlimited dimensions.

vinfo = ncinfo('example.nc','peaks');

varSize = vinfo.Size;

disp(vinfo);

hasUnLimDim = any([vinfo.Dimensions.Unlimited]);

Find all unlimited dimensions defined in a group.

ginfo = ncinfo('example.nc','/grid2/');

unlimDims = [ginfo.Dimensions.Unlimited];

disp(ginfo.Dimensions(unlimDims));

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值