Quantcast

Documentation Center

  • Trial Software
  • Product Updates

ncdisp

Display contents of NetCDF data source in Command Window

Syntax

Description

example

ncdisp(source) displays all the groups, dimensions, variable definitions, and all attributes in the NetCDF data source, source, as text in the Command Window.

example

ncdisp(source,location) displays information about the variable or group specified by location.

example

ncdisp(source,location,dispFormat) displays the contents of the NetCDF data source, in the display format specified by dispFormat.

Examples

expand all

Display Contents of NetCDF File

Display the contents of the example NetCDF file, 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_fahrenheight'
    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

MATLAB® displays all the groups, dimensions, and variable definitions in example.nc.

Display Contents of NetCDF Variable

Display the contents of the variable peaks in the file, example.nc.

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);'

Display Contents of NetCDF File and Hide Attributes

Display only the group hierarchy and variable definitions of the example file, 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

Input Arguments

expand all

source — Name of NetCDF filestring

Name of a NetCDF file, specified as a string. source also can be the URL of an OPeNDAP NetCDF data source that resolves to a NetCDF file or a variable in a NetCDF file.

Example: 'myNetCDFfile.nc'

Data Types: char

location — Location of variable or group'/' (default) | string

Location of a variable or group in the NetCDF file, specified as a string. Set location to '/'(forward slash) to display the entire contents of the file.

Data Types: char

dispFormat — Display format'full' (default) | 'min'

Display format, specified as one of the following strings.

'full'Display group hierarchy with dimensions, attributes, and variable definitions.
'min'Display group hierarchy and variable definitions.

Data Types: char

More About

expand all

Tips

  • If source is an OPeNDAP URL with string constraints, use the syntax, ncdisp(source) with no other input arguments.

See Also

| | | |

Was this topic helpful?