ncdf home page: A netcdf package for R
David W. Pierce / Scripps Institution of Oceanography
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.
NOTE: There used to be a version of the library for 64-bit windows. However I have received a report that the netcdf library (as opposed to the R ncdf4 package) has an odd bug that sometimes accesses data from the wrong file, if multiple files are open. I have reported this to the netcdf library maintainers but they do not support compiling the netcdf library on Windows-64 using the compilers that R needs. Right now, unless someone can successfully compile a bug-free version of the netcdf library on Windows-64, there is no immediate prospect of having ncdf4 work correctly on that platform.
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.9.tar.gz
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.9.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
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:
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: 6 August 2013