NetCDF (Network Common Data Form) is an interface for array-oriented data access and a library that provides an implementation of the interface. The netcdf library also defines a machine-independent format for representing scientific data. Together, the interface, library, and format support the creation, access, and sharing of scientific data.
NetCDF is available on OSC Clusters. The versions currently available at OSC are:
| Version | Pitzer | Ascend | Cardinal |
|---|---|---|---|
| 1.12.3 | P | P | P |
| 4.3.1 | S | S | S |
| 4.6.1 | F | F | F |
| 4.8.1 | C | C | C |
You can use module spider netcdf to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.
The netcdf module is split into three parts: netcdf-c for the C interface, netcdf-fortran for the Fortran interface and netcdf-cxx4 for the C++ interface. You can load netcdf-c with module load netcdf-c, netcdf-cxx4 with module load netcdf-cxx4, and netcdf-fortran with module load netcdf-fortran
NetCDF is available to all OSC users. If you have any questions, please contact OSC Help.
University Corporation for Atmospheric Research, Open source
Initalizing the system for use of the NetCDF is dependent on the system you are using and the compiler you are using. To load the default NetCDF C interface, run the following command: module load netcdf-c. The pnetcdf module is parallel-netcdf on Cardinal. To load parallel-netcdf, run the following command: module load parallel-netcdf
With any of the netcdf libraries loaded, the following environment variables will be available for use:
| VARIABLE | USE |
|---|---|
| $NETCDF_CFLAGS | Use during your compilation step for C or C++ programs. |
| $NETCDF_FFLAGS | Use during your compilation step for Fortran programs. |
| $NETCDF_LIBS | Use when linking your program to NetCDF. |
Similarly, when the parallel-netcdf module is loaded, the following environment variables will be available:
| VARIABLE | USE |
|---|---|
| $PNETCDF_CFLAGS | Use during your compilation step for C programs. |
| $PNETCDF_FFLAGS | Use during your compilation step for Fortran programs. |
| $PNETCDF_LIBS | Use when linking your program to NetCDF. |
For example, to build the code myprog.c with the netcdf library you would use:
icc -c $NETCDF_CFLAGS myprog.c icc -o myprog myprog.o $NETCDF_LIBS
When you log into cardinal.osc.edu you are actually logged into a linux box referred to as the login node. To gain access to the mutiple processors in the computing environment, you must submit your job to the batch system for execution. Batch jobs can request mutiple nodes/cores and compute time up to the limits of the OSC systems. Refer to Queues and Reservations and Batch Limit Rules for more info.
#!/bin/bash #SBATCH --job-name=job-name #SBATCH --nodes=1 --ntasks-per-node=48 #SBATCH --account <project-account> module load netcdf-c cp foo.dat $TMPDIR cd $TMPDIR appname < foo.dat > foo.out cp foo.out $SLURM_SUBMIT_DIR