Interface to 'NetCDF' Datasets

An interface to the 'NetCDF' file formats designed by Unidata for efficient storage of array-oriented scientific data and descriptions. Most capabilities of 'NetCDF' version 4 are supported. Optional conversions of time units are enabled by 'UDUNITS' version 2, also from Unidata.

RNetCDF provides an R interface to the NetCDF file format designed by Unidata for efficient storage of array-oriented scientific data and descriptions. This R interface is closely based on the C API of the NetCDF library, and it includes calendar conversions from the Unidata UDUNITS library. The current implementation supports operations on NetCDF datasets in classic, 64-bit offset and netcdf4-classic file formats. Work is progressing to add full support for netcdf4.

An introduction to the RNetCDF package is given in .


Version 1.9-1, 2017-10-04

  • Allow multiple NA values in count argument of, so that corresponding dimensions are read/written to their defined length.
  • Fix support for OPeNDAP (if enabled by the netcdf library)
  • Build Windows packages with netcdf4 library
  • Register C routines for efficient access by R

Version 1.8-2, 2016-02-21

  • Add support for POSIXct timestamps to and
  • Use nc-config by default in configure to find netcdf build settings.
  • Allow customisation of configure by variables CPPFLAGS, LDFLAGS and LIBS, and remove the following options: --with-netcdf-include, --with-netcdf-lib, --with-hdf5-lib, --with-udunits-include, --with-udunits-lib.

Version 1.7-3, 2015-05-09

  • Support reading/writing NC_CHAR as vectors of raw bytes
  • Avoid intermediate copies of array data when possible
  • Fix memory errors reported by valgrind for udunits2 calendar functions.
  • Support compilation with udunits.h inside a udunits2 sub-directory.
  • Add udunits data files to source package to ensure they can be found when building binary packages for Windows and Mac.

Version 1.6.3-1, 2014-09-01

  • Allow reading of character vector or scalar

Version 1.6.2-3, 2014-06-16

  • Added HDF5 licence file for distribution

Version 1.6.2-2, 2014-05-27

  • Corrected potential memory leak in read/write of character arrays

Version 1.6.1-2, 2012-07-20

  • Added function
  • Added packing/unpacking of data

Version 1.5.3-1, 2012-02-15

  • Optionally copy udunits data files during installation of RNetCDF.
  • When loading RNetCDF in R, initialise udunits with copied data files.

Version 1.5.2-2, 2011-01-06

  • configure adds tests for extra libraries used by netcdf4 on some systems.
  • Avoid repeated zeroing of character arrays in C interface.

Version 1.5.0-1, 2010-12-30

  • Add new modes (large, prefill, share) to nc_open and nc_create.
  • Avoid unnecessary switching of define and data modes in C library to prevent unwanted data movement within a file.
  • configure script accepts optional path for hdf5 (for netcdf4 library).
  • Added basic functional tests of package.

Version 1.2-1.1, 2010-05-11

  • Add build scripts for Windows.

Version 1.2-1, 2006-07-26

  • and optionally handle dates in string form.
  • configure script accepts optional paths for netcdf and udunits.

Version 1.1-3, 2005-03-21

  • Minor bugfix for detection of udunits headers in configure script.

Version 1.1-2, 2005-01-04

  • Return proper error status in C functions R_nc_sync and R_nc_get_vara_text.

Version 1.1-1, 2004-09-19

  • Add option to collapse singleton dimensions when reading arrays.
  • Allow reading of arrays without conversion of missing values.

Version 1.0-4, 2004-09-11

  • Search extra directories during configure.

Version 1.0-3, 2004-08-01

  • First release based on netcdf package by Thomas Lumley and ncdf package by David Pierce.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


2.4-2 by Milton Woods, 8 months ago

Report a bug at

Browse source code at

Authors: Pavel Michna [aut] , Milton Woods [aut, cre]

Documentation:   PDF Manual  

Task views: Handling and Analyzing Spatio-Temporal Data, Analysis of Spatial Data

GPL (>= 2) | file LICENSE license

Suggests bit64

System requirements: netcdf udunits-2

Imported by MC2toPath, ProfoundData, epwshiftr, ncdfgeom, ncmeta, tidync.

Depended on by RGCxGC.

Suggested by HelpersMG, MALDIquantForeign, REddyProcNCDF, stars.

See at CRAN