netcdf4-python: python/numpy interface to the netCDF C library
Python Other
Latest commit 6087ae9 Feb 23, 2017 @jswhit jswhit committed on GitHub Merge pull request #638 from Unidata/issue637
fix for docstring bug (issue #637)
Failed to load latest commit information.
conda.recipe Update AppVeyor configuration. Jan 8, 2017
docs/netCDF4 update Feb 24, 2017
examples update to make consistent with change in docstring Feb 2, 2017
include use malloc and free imported from cython Jan 9, 2016
man Fix various spelling errors. Mar 11, 2016
netCDF4 take out debug prints Feb 24, 2017
netcdftime fix so that works Nov 28, 2016
test remove deprecated assert_, replace with assertTrue Dec 22, 2016
utils RF: move modules into netCDF4 package May 9, 2015
.gitattributes add .gitattributes to exclude files for tarballs on releases page. Apr 11, 2015
.gitignore RF: add build files to .gitignore May 9, 2015
.travis.yml update Dec 21, 2016
COPYING add license from pyiso8601 Jul 3, 2010
Changelog update for release Jan 3, 2017 netcdftime/{ => _netcdftime.pyx} Oct 17, 2016
PKG-INFO update to 1.2.7 Jan 9, 2017 update pdoc requirements. Jul 28, 2015 update download link to point to pypi. Jan 9, 2017
README.release update instructions for triggering a build at netcdf4-python-wheels Jan 9, 2017 DOC: add README explaining wheel build / upload Jul 15, 2015
appveyor.yml Update AppVeyor configuration. Jan 8, 2017 print numpy version Jan 7, 2016 regenerate C May 22, 2015
setup.cfg make sure booleans are treated correctly in setup.cfg, add use_cython to Apr 10, 2015
setup.cfg.template update Apr 10, 2015 bump version number Dec 20, 2016


Python/numpy interface to the netCDF C library.

Linux Build Status Windows Build Status PyPI package


For the latest updates, see the Changelog.

1/8/2017: Version 1.2.7 released. Python 3.6 compatibility, and fix for vector missing_values.

12/10/2016: Version 1.2.6 released. Bug fixes for Enum data type, and _FillValue/missing_value usage when data is stored in non-native endian format. Add get_variables_by_attributes to MFDataset. Support for python 2.6 removed.

12/1/2016: Version 1.2.5 released. See the Changelog for changes.

4/15/2016: Version 1.2.4 released. Bugs in handling of variables with specified non-native "endian-ness" (byte-order) fixed (issue #554). Build instructions updated and warning issued to deal with potential backwards incompatibility introduced when using HDF5 1.10.x (see Unidata/netcdf-c/issue#250).

3/10/2016: Version 1.2.3 released. Various bug fixes. All text attributes in NETCDF4 formatted files are now written as type NC_CHAR, unless they contain unicode characters that cannot be encoded in ascii, in which case they are written as NC_STRING. Previously, all unicode strings were written as NC_STRING. This change preserves compatibility with clients, like Matlab, that can't deal with NC_STRING attributes. A setncattr_string method was added to force attributes to be written as NC_STRING.

1/1/2016: Version 1.2.2 released. Mostly bugfixes, but with two new features.

  • support for the new NETCDF3_64BIT_DATA format introduced in netcdf-c 4.4.0. Similar to NETCDF3_64BIT (now NETCDF3_64BIT_OFFSET), but includes 64 bit dimension sizes (> 2 billion), plus unsigned and 64 bit integer data types. Uses the classic (netcdf-3) data model, and does not use HDF5 as the underlying storage format.

  • Dimension objects now have a size attribute, which is the current length of the dimension (same as invoking len on the Dimension instance).

The minimum required python version has now been increased from 2.5 to 2.6.

10/15/2015: Version 1.2.1 released. Adds the ability to slice Variables with unsorted integer sequences, and integer sequences with duplicates.

9/23/2015: Version 1.2.0 released. New features:

7/28/2015: Version 1.1.9 bugfix release.

5/14/2015: Version 1.1.8 released. Unix-like paths can now be used in createVariable and createGroup.

    v = nc.createVariable('/path/to/var1', ('xdim', 'ydim'), float)

will create a variable named 'var1', while also creating the groups 'path' and 'path/to' if they do not already exist.


    g = nc.createGroup('/path/to') 

now acts like mkdir -p in unix, creating groups 'path' and '/path/to', if they don't already exist. Users who relied on nc.createGroup(groupname) failing when the group already exists will have to modify their code, since nc.createGroup will now return the existing group instance. Dataset.__getitem__ was also added. nc['/path/to'] now returns a group instance, and nc['/path/to/var1'] now returns a variable instance.

3/19/2015: Version 1.1.7 released. Global Interpreter Lock (GIL) now released when extension module calls C library for read operations. This speeds up concurrent reads when using threads. Users who wish to use netcdf4-python inside threads should read regarding thread-safety in the HDF5 C library. Fixes to now ensure that pip install netCDF4 with export USE_NCCONFIG=0 will use environment variables to find paths to libraries and include files, instead of relying exclusively on the nc-config utility.

Quick Start

  • Clone GitHub repository (git clone, or get source tarball from PyPI. Links to Windows and OS X precompiled binary packages are also available on PyPI.

  • Make sure numpy (required) and Cython (recommended) are installed and you have Python 2.6 or newer.

  • Make sure HDF5 and netcdf-4 are installed, and the nc-config utility is in your Unix PATH. If setup.cfg does not exist, copy setup.cfg.template to setup.cfg, and make sure the line with use_ncconfig=True is un-commented.

  • Run python build, then python install (with sudo if necessary).

  • To run all the tests, execute cd test && python


See the online docs for more details.


Sample iPython notebooks available in the examples directory on reading and writing netCDF data with Python.