Skip to content

NetCDF

Machine-independent libraries for representing scientific data


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 # substitute 'gnu' for 'intel' if using that compiler

## Download example code XY array source code from NCAR
$ wget https://www.unidata.ucar.edu/software/netcdf/examples/programs/simple_xy_wr.c

## 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
./simple_xy_wr.x

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

-I/opt/rcc/intel/include
-L/opt/rcc/intel/lib64

In-Depth#

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