Main Content

ncdisp

在命令行窗口中显示 netCDF 数据源内容

    说明

    示例

    ncdisp(source) 在命令行窗口中以文本形式显示指定的 netCDF 数据源中的所有组、维度、变量定义以及属性。

    示例

    ncdisp(source,location) 显示有关 location 指定的变量或组的信息。

    示例

    ncdisp(source,location,dispFormat) 使用 dispFormat 指定的显示格式。

    示例

    全部折叠

    显示 netCDF 文件 example.nc 的内容。

    ncdisp("example.nc")
    Source:
               matlabroot\toolbox\matlab\demos\example.nc
    Format:
               netcdf4
    Global Attributes:
               creation_date = '29-Mar-2010'
    Dimensions:
               x = 50
               y = 50
               z = 5
    Variables:
        avagadros_number
               Size:       1x1
               Dimensions: 
               Datatype:   double
               Attributes:
                           description = 'this variable has no dimensions'
        temperature     
               Size:       50x1
               Dimensions: x
               Datatype:   int16
               Attributes:
                           scale_factor = 1.8
                           add_offset   = 32
                           units        = 'degrees_fahrenheit'
        peaks           
               Size:       50x50
               Dimensions: x,y
               Datatype:   int16
               Attributes:
                           description = 'z = peaks(50);'
    Groups:
        /grid1/
            Attributes:
                       description = 'This is a group attribute.'
            Dimensions:
                       x    = 360
                       y    = 180
                       time = 0     (UNLIMITED)
            Variables:
                temp
                       Size:       []
                       Dimensions: x,y,time
                       Datatype:   int16
        
        /grid2/
            Attributes:
                       description = 'This is another group attribute.'
            Dimensions:
                       x    = 360
                       y    = 180
                       time = 0     (UNLIMITED)
            Variables:
                temp
                       Size:       []
                       Dimensions: x,y,time
                       Datatype:   int16

    显示文件 example.nc 中变量 peaks 的内容。

    ncdisp("example.nc","peaks")
    Source:
               matlabroot\toolbox\matlab\demos\example.nc
    Format:
               netcdf4
    Dimensions:
               x = 50
               y = 50
    Variables:
        peaks
               Size:       50x50
               Dimensions: x,y
               Datatype:   int16
               Attributes:
                           description = 'z = peaks(50);'

    只显示文件 example.nc 的组层次结构和变量定义。

    ncdisp("example.nc","/","min")
    Source:
               matlabroot\toolbox\matlab\demos\example.nc
    Format:
               netcdf4
    Variables:
        avagadros_number
               Size:       1x1
               Dimensions: 
               Datatype:   double
        temperature     
               Size:       50x1
               Dimensions: x
               Datatype:   int16
        peaks           
               Size:       50x50
               Dimensions: x,y
               Datatype:   int16
    Groups:
        /grid1/
            Variables:
                temp
                       Size:       []
                       Dimensions: x,y,time
                       Datatype:   int16
        
        /grid2/
            Variables:
                temp
                       Size:       []
                       Dimensions: x,y,time
                       Datatype:   int16

    输入参数

    全部折叠

    netCDF 数据源的名称,指定为字符串标量或字符向量。source 参数可以是以下值之一:

    • 本地 netCDF 源的路径

    • 远程 OPeNDAP netCDF 数据源的 OPeNDAP URL

    • 远程 netCDF 源的 HTTP URL,在 URL 的末尾附加 #mode=bytes 以支持字节范围读取

      注意

      字节范围读取比从其他来源读取要慢。有关字节范围读取的更多详细信息,请参阅 netCDF 文档。

    示例: "myNetCDFfile.nc"

    示例: "http://host_name/netcdf_filename#mode=bytes"

    netCDF 数据源中变量或组的位置,指定为字符串标量或字符向量。要显示整个数据源的内容,请将 location 设置为 "/"(正斜杠)。

    示例: "myVar"

    示例: "/myGrp/mySubGrp/myNestedVar"

    示例: "myGrp"

    示例: "/myGrp/mySubGrp"

    显示格式,指定为 "full""min"。将 dispFormat 设置为 "full" 可显示属性,将 dispFormat 设置为 "min" 可取消属性的显示。

    数据类型: string | char

    提示

    • 如果 source 是带有约束表达式的 OPeNDAP URL,请使用 ncdisp(source) 语法,不带任何其他输入参数。

    版本历史记录

    在 R2011a 中推出

    全部展开