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.
For mpi-dependent codes, use the non-serial NetCDF module.
Availability and Restrictions
Versions
NetCDF is available for serial code on on Pitzer and Owens Clusters. The versions currently available at OSC are:
Version | Owens | Pitzer |
---|---|---|
4.3.3.1 | X | |
4.6.1 | X | X |
4.6.2 | X | X |
4.7.4 | X* | X* |
4.8.1 | X | X |
You can use module spider netcdf-serial
to view available modules for a given machine. Feel free to contact OSC Help if you need other versions for your work.
Additionally, the C++ and Fortran interfaces for NetCDF are included. After loading a netcdf-serial
module, you can check their versions with ncxx4-config --version
and nf-config --version
, respectively.
Access
NetCDF is available to all OSC users. If you have any questions, please contact OSC Help.
Publisher/Vendor/Repository and License Type
University Corporation for Atmospheric Research, Open source
Usage
Usage on Owens
Set-up
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 serial NetCDF module, run the following command: module load netcdf-serial
. To load a particular version, use module load netcdf-serial/version
. For example, use module load netcdf-serial/4.3.3.1
to load NetCDF version 4.3.3.1. You can use module spider netcdf-serial
to view available modules.
Building With NetCDF
With the netcdf library 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 pnetcdf 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
Batch Usage
When you log into owens.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.
Non-interactive Batch Job (Serial Run)
A batch script can be created and submitted for a serial or parallel run. You can create the batch script using any text editor you like in a working directory on the system of your choice. You must load the netcdf or pnetcdf module in your batch script before executing a program which is built with the netcdf library. Below is the example batch script that executes a program built with NetCDF:#PBS -N AppNameJob #PBS -l nodes=1:ppn=28 module load netcdf cd $PBS_O_WORKDIR cp foo.dat $TMPDIR cd $TMPDIR appname < foo.dat > foo.out cp foo.out $PBS_O_WORKDIR
Usage on Pitzer
Set-up
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 serial NetCDF module, run the following command: module load netcdf-serial
. To load a particular version, use module load netcdf-serial/version
. For example, use module load netcdf-serial/4.6.2
to load NetCDF version 4.6.2. You can use module spider netcdf-serial
to view available modules.
Building With NetCDF
With the netcdf library 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 pnetcdf 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