【发布时间】:2019-11-20 17:41:34
【问题描述】:
我有一个 netcdf 文件
ncdisp('F:\Data\Coriolis\ArgoProfiles\ArgoProfiles\DataSelection_20191119_093255_9342316/argo-profiles-2902636.nc')
Source:
F:\Data\Coriolis\ArgoProfiles\ArgoProfiles\DataSelection_20191119_093255_9342316\argo-profiles-2902636.nc
Format:
classic
Global Attributes:
title = 'Argo float vertical profile'
institution = 'CSIO'
source = 'Argo float'
history = '2019-11-19T09:33:19Z creation'
references = 'http://www.argodatamgt.org/Documentation'
comment = ''
user_manual_version = '3.03'
Conventions = 'Argo-3.0 CF-1.6'
featureType = 'trajectoryProfile'
Dimensions:
DATE_TIME = 14
STRING256 = 256
STRING64 = 64
STRING32 = 32
STRING16 = 16
STRING8 = 8
STRING4 = 4
STRING2 = 2
N_PROF = 2
N_PARAM = 3
N_LEVELS = 71
N_CALIB = 1
N_HISTORY = 6 (UNLIMITED)
Variables:
DATA_TYPE
Size: 16x1
Dimensions: STRING16
Datatype: char
Attributes:
long_name = 'Data type'
_FillValue = ' '
FORMAT_VERSION
Size: 4x1
Dimensions: STRING4
Datatype: char
Attributes:
long_name = 'File format version'
_FillValue = ' '
HANDBOOK_VERSION
Size: 4x1
Dimensions: STRING4
Datatype: char
Attributes:
long_name = 'Data handbook version'
_FillValue = ' '
我想计算变量的数量。在这种情况下,答案是 3。
我尝试使用
info=ncinfo(FilePath);
numel(info.Variables.Name)
但这给了我
2.6413e+96
Warning: Number of elements exceeds maximum flint 2^53-1.
The result may be inaccurate.
这是不正确的。 如何在我的 netcdf 文件中找到变量的数量?我原来的 netcdf 文件要大得多,我不能再用手数了。
【问题讨论】:
-
实际上,您正在计算变量名称中的字符数。请改用
numel(info.Variables)