NetCDF (Network Common Data Format) is an array-oriented data standard developed by the Unidata Program of the University Corporation for Atmospheric Research (UCAR) for scientific data sharing. For details, visit the Official NetCDF Website.
Similar to zip, jpeg, and bmp formats, NetCDF is an open standard file format. Originally designed for meteorological data storage, it's now widely adopted by data acquisition systems. NetCDF enables efficient storage, management, retrieval, and distribution of multidimensional data. Its flexibility in handling large array-oriented datasets makes it prevalent in atmospheric sciences, hydrology, oceanography, environmental modeling, and geophysics.
Mathematically, NetCDF stores data as single-valued multivariate functions: f(x,y,z,...)=value. Dimensions (or axes) represent independent variables (x,y,z,...), while Variables store function values. Attributes describe physical characteristics like units and nomenclature for both dimensions and variables.
Key Concepts
A NetCDF file contains dimensions, variables, and attributes that collectively define data relationships in array-oriented datasets.
NetCDF name{
Dimensions:… // Define dimensions
Variables:… // Define variables
Attributes:… // Metadata
Data:…// Data values
}
- Dimensions
A dimension corresponds to an independent variable in mathematical functions or an axis in coordinate systems. Each dimension has a name and size (domain length). NetCDF files can contain one unlimited dimension (record dimension) allowing variable extension along this axis.
- Variables
Variables represent physical measurements. For example: - Electricity meter readings as a time-dependent function (1D) - Atmospheric pressure values at geographic coordinates (2D function with longitude/latitude axes)
- Attributes
Attributes provide metadata about variables and dimensions. Consisting of name-value pairs (typically strings), they clarify physical meanings. Example:
Global attributes describe entire files using empty variable associations in CDL/C/Fortran.temperature:units = "celsius"; - Data
Supported data types: char, byte, short, int, float, double.
Example
netcdf simple_xy {
dimensions:
x = 6 ;
y = 12 ;
variables:
int data(x, y) ;
data:
data =
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71 ;
}
This example contains three components:
- Dimensions section:
dimensions:x = 6 ;y = 12 ;Defines two dimensions: x-axis (length 6) and y-axis (length 12).
- Variables declaration:
variables:int data(x, y);Declares a 2D variable data with dimension order (x,y), determining data assignment sequence.
- Data values:
data:data =0, 1, 2, ..., 71 ;Represents function values where data[0][0]=0, data[5][11]=71.
Related Topics
Supported Data Formats for Type Conversion