ncdf home page: A netcdf package for R


NOTE: The "ncdf" package is designed to work with the netcdf library version 3. If you want to know how to install the R ncdf package even if you have netcdf library version 4 installed, look here.

Newer package "ncdf4" is designed to work with the netcdf library version 4, and supports features such as compression and chunking. Unfortunately, for various reasons the ncdf4 package must have a different API than the ncdf package.


Package ncdf4 -- use this for new code

The "ncdf4" package is designed to work with the netcdf library, version 4. It includes the ability to use compression and chunking, which seem to be some of the most anticipated benefits of the version 4 library. Note that the API of ncdf4 has to be different from the API of ncdf, unfortunately. New code should use ncdf4, not ncdf.

You can download the latest version of ncdf4 source package here: ncdf4_1.8.tar.gz.

Pre-compiled zip file for MS Windows (32-bit R version 2.14.1): ncdf4_1.4.zip
[NOTE: this zip file is only for the 32-bit version of R. Of course, you can run 32-bit R on a 64-bit MS Windows machine. I make only the 32-bit version available because I do not know of a source for 64-bit netcdf and hdf5 libraries compiled on MS Windows -- if you know of such a source, please email me.]

Installation

UNIX/Linux: the same as for every other R package, but NOTE that you must install the netcdf library version 4 before trying to install the ncdf4 package. After you have installed netcdf version 4, from the command line prompt type:

R CMD INSTALL ncdf4_1.8.tar.gz

Installation for Windows: Use the R graphical user interface and pick the menu item to install a package from a local file. Then select the ncdf4_1.4.zip file.

If you want instead to build the source package from scratch on windows, my personal notes for doing this can be found here


Package ncdf -- deprecated

The "ncdf" package provides an interface to netCDF format data files in the R statistical language. The interface is a high-level, object oriented one. People who are used to the low-level, procedurally oriented netCDF calls in the netCDF library itself will probably find this interface to be rather different from what they are used to -- but, I hope, better. Neophytes who don't know anything about netCDF and don't care to know anything about netCDF -- they just want to read their data files and get to the analysis -- will almost certainly find the object oriented interface provided by this package far, far easier to use than the low-level interface. Note that the other netCDF reading packages on CRAN generally provide the low-level interface.

I've noticed that the pdf manual on CRAN has some errors. So here is a pdf manual for ncdf that works.

The packages are available for download from CRAN, both the source package and the Windows .zip file.  Here are links to local copies in case you need them:

Source package for UNIX: ncdf_1.8.5.tar.gz
Zip file for Windows: ncdf_1.8.1.zip (Instructions for building on windows can be found here)

Installation

UNIX/Linux: the same as for every other R package. For example, from the command line prompt type:

R CMD INSTALL ncdf_1.8.5.tar.gz

Installation for Windows: Use the R graphical user interface and pick the menu item to install a package from a local file. Then select the ncdf_1.8.1.zip file.

I try to fix bugs that users find in ncdf, so feel free to send me email if you find a problem with the code.


Last modified: 19 March 2012
Contact: dpierce@ucsd.edu