Skip to content


Machine-independent libraries for representing scientific data

NetCDF requires an environment module

In order to use NetCDF, you must first load the appropriate environment module:

module load gnu netcdf

From the NetCDF FAQ page:

"NetCDF (network Common Data Form) is a set of interfaces for array-oriented data access and a freely distributed collection of data access libraries for C, Fortran, C++, Java, and other languages. The NetCDF libraries support a machine-independent format for representing scientific data. Together, the interfaces, libraries, and format support the creation, access, and sharing of scientific data."

Using NetCDF on RCC Resources#

Below is an example of using the GNU implementation of NetCDF to compile a simple two-dimensional array from the Example NetCDF programs page on the HPC:

## Load the correct compiler module
$ module load gnu netcdf # substitute 'intel' for 'gnu' if using that compiler

## Download example code XY array source code from NCAR
$ wget

## Compile it with GCC
$ gcc -c simple_xy_wr.c -I/opt/rcc/gnu/include
$ gcc -o simple_xy_wr.x simple_xy_wr.o -L/opt/rcc/gnu/lib64 -lnetcdf

## You can now use the following executable in your Slurm submit script

NetCDF is also available for the Intel compiler. Link and include a different path using the following commands:



For a more in-depth discussion, please refer to the NetCDF tutorial on the UCAR website.