Main Content

NetCDF Files

Network Common Data Form

Network Common Data Form (netCDF) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. You can interact with netCDF files in several ways:

  • The Import Tool app (in MATLAB® Online™) and the Import Data Live Editor task provide intuitive graphical interfaces for exploring and reading data from netCDF files.

  • The MATLAB high-level netCDF functions provide a simplified programmatic interface for reading data from netCDF files and writing data from the MATLAB workspace to netCDF files.

  • The MATLAB low-level netCDF functions provide finer control over the reading and writing process of netCDF files by providing access to more than 50 functions in the netCDF C library.

    To use the MATLAB low-level netCDF functions, you must be familiar with netCDF C API programming concepts, described at https://www.unidata.ucar.edu/software/netcdf/.

MATLAB uses netCDF C library version 4.9.2.

Tâches du Live Editor

Import DataImport data from a file in the Live Editor (depuis R2023a)

Applications

Import ToolImport data from file

Fonctions

développer tout

nccreateCreate variable in netCDF file
ncdispDisplay contents of netCDF data source in Command Window
ncinfo Return information about netCDF data source
ncreadRead data from variable in netCDF data source
ncreadattRead attribute from netCDF data source
ncwriteWrite data to netCDF file
ncwriteattWrite attribute to netCDF file
ncwriteschemaAdd netCDF schema definitions to netCDF file

Library Functions

netcdf.getChunkCacheReturn default chunk cache settings for netCDF library
netcdf.inqLibVersReturn netCDF library version information
netcdf.setChunkCacheSet default chunk cache settings for netCDF library
netcdf.setDefaultFormatChange default netCDF file format

File Operations

netcdf.abortRevert recent netCDF file definitions
netcdf.closeClose netCDF file
netcdf.createCreate new netCDF dataset
netcdf.endDefEnd netCDF file define mode
netcdf.inqReturn information about netCDF file
netcdf.inqFormatDetermine format of netCDF file
netcdf.inqGrpsReturn array of child group IDs
netcdf.inqUnlimDimsReturn IDs of all visible unlimited dimensions in group
netcdf.openOpen netCDF data source
netcdf.reDefPut open netCDF file into define mode
netcdf.setFillSet netCDF fill mode
netcdf.syncSynchronize netCDF file to disk

Dimensions

netcdf.defDimCreate netCDF dimension
netcdf.inqDimReturn netCDF dimension name and length
netcdf.inqDimIDReturn dimension ID
netcdf.renameDimChange name of netCDF dimension

Groups

netcdf.defGrpCreate group in netCDF file
netcdf.inqDimIDsReturn list of dimension identifiers in group
netcdf.inqGrpNameReturn name of group
netcdf.inqGrpNameFullComplete pathname of group
netcdf.inqGrpParentReturn ID of parent group
netcdf.inqNcidReturn ID of group
netcdf.inqVarIDsReturn IDs of all variables in group

Variables

netcdf.defVarCreate netCDF variable
netcdf.defVarChunkingDefine chunking parameters for netCDF variable
netcdf.defVarDeflateDefine compression parameters for netCDF variable
netcdf.defVarFillDefine fill parameters for netCDF variable
netcdf.defVarFletcher32Define checksum parameters for netCDF variable
netcdf.getVarRead data from netCDF variable
netcdf.inqVarInformation about netCDF variable
netcdf.inqVarChunkingReturn chunking parameters for netCDF variable
netcdf.inqVarDeflateReturn compression parameters for netCDF variable
netcdf.inqVarFillReturn fill parameters for netCDF variable
netcdf.inqVarFletcher32Return checksum parameters for netCDF variable
netcdf.inqVarIDReturn ID associated with variable name
netcdf.putVarWrite data to netCDF variable
netcdf.renameVarChange name of netCDF variable

Attributes

netcdf.copyAttCopy attribute to new location
netcdf.delAttDelete netCDF attribute
netcdf.getAttReturn netCDF attribute
netcdf.inqAttReturn information about netCDF attribute
netcdf.inqAttIDReturn ID of netCDF attribute
netcdf.inqAttNameReturn name of netCDF attribute
netcdf.putAttWrite data to netCDF attribute
netcdf.renameAttChange name of netCDF attribute

User-Defined Types

netcdf.defVlenDefine user-defined variable length array type (NC_VLEN) (depuis R2022a)
netcdf.inqUserTypeReturn information about user-defined type (depuis R2022a)
netcdf.inqVlenReturn information about user-defined NC_VLEN type (depuis R2022a)

Utilities

netcdf.getConstantReturn numeric value of named constant
netcdf.getConstantNamesReturn list of constants known to netCDF library

Rubriques

Résolution des problèmes

Resolve Errors Reading OPeNDAP Data

When you have trouble reading OPeNDAP data, consider these factors.

Informations connexes