NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2269 most downloaded on PyPI
Provides an object-oriented python interface to the netCDF version 4 library
Last release 9 months ago
05 Jan 2026
Release timing varies
gaps range from 2 weeks to 12 months
Most releases are documented
notes for 39 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
20 years old
88 releases · first in 2006
Nothing published for this version
Nothing published for this version
Nothing published for this version
update tag to rebuild windows wheel
update tag to rebuild windows wheel
One column per quarter.
Nothing published for this version
include nc_complex source code from v0.2.0 tag (instead of using submodule).
fix for deprecated Cython DEF and IF statements using compatibility header with shims for unavailable functionality (PR #1277)
auto_complex keyword to Dataset (PR #1295)DEF and IF statements using compatibility header
with shims for unavailable functionality (PR #1277)szip as the library name on Windows (PR #1304)MPI_Message detection (PR #1305)fix for issue #1271 (mask ignored if bool MA assigned to uint8 var)
set path to SSL certificates internally, so https DAP URLs work with wheels (issue #1246, requires nc_rc_set function available starting with netcdf-c
isopen method to MFDataset object to check if underlying files are open.Use nc_put_vars for strided writes for netcdf-c >= 4.6.2 (issue #1222).
nc_put_vars for strided writes for netcdf-c >= 4.6.2 (issue #1222).Added netCDF4.__has_set_alignment__ property to help identify if the underlying netcdf4 supports setting the HDF5 alignment.
netCDF4.__has_set_alignment__ property to help identify if the
underlying netcdf4 supports setting the HDF5 alignment.add Dataset methods has_ _filter (where =zstd,blosc,bzip2,szip) to check for availability of extra compression filters.
'blosc_shuffle', 'szip_mask' and 'szip_pixels_per_block' kwargs also added. compression='zlib' is equivalent to (the now deprecated) zlib=True. If the…
Fix Enum bug (issue #1128): the enum_dict member of an EnumType read from a file contains invalid values when the enum is large enough (more than 127
don't try to mask vlens with default _FillValue, since vlens don't have a default _FillValue. This gets rid of numpy DeprecationWarning (issue #1099).
change numpy.bool to numpy.bool_ and numpy.float to numpy.float_ (float and bool are deprecated in numpy 1.20, issue #1065)
rebuild binary wheels for linux and OSX to link netcdf-c 4.7.4 and hdf5 1.12.0.
have setup.py always try use nc-config first to find paths to netcdf and hdf5 libraries and headers. Don't use pkg-config to find HDF5 if HDF5 env var
use len instead of deprecated numpy.alen (issue #1008)
set_chunk_cache/get_chunk_cache module functions to reset the
default chunk cache sizes before opening a Dataset (issue #1018).make sure arrays are masked that are not filled when auto_fill is off (issue #972).
fix for scaling bug when _Unsigned attribute is set and byteorder of data does not match native byteorder (issue #930).
fix another slicing bug introduced by the fix to issue #906 (issue #922).
fixed __version__ attribute (was set incorrectly in 1.5.1 release).
fix issue #908 by adding workaround for incorrect value returned by nc_inq_var_fill for netcdf-c < 4.5.1.
binary wheels for linux and macosx rebuilt against netcdf-c 4.6.3 (instead of 4.4.1.1).
added support for parallel IO in the classic netcdf-3 formats through the pnetcdf library (pull request #897).
include missing membuf.pyx file in release source tarball.
fix bug in implementation of NETCDF4_CLASSIC support for parallel IO in v1.4.3 release.
make set_always_mask work in MFDataset.
set_ncstring_attrs() to Dataset, Group and Variable that
forces all text attributes to be written as variable length strings (netCDF
type NC_STRING - issue #882).fix numpy FutureWarning (non-tuple sequence for multidimensional indexing is deprecated), issue #833.
disable workaround for slow nc_get_vars for __netcdflibversion__ >= 4.6.2, since a fix was added to speed up nc_get_vars in the C library. Issue 680.
fixed bug in detection of CDF5 library support in setup.py (pull request
add parallel IO capabilities. netcdf-c and hdf5 must be compiled with MPI support, and mpi4py must be installed. To open a file for parallel access, u
parallel=True in Dataset.__init__ and optionally pass the mpi4py Comm instance
using the comm kwarg and the mpi4py Info instance using the info kwarg.
IO can be toggled between collective and independent using Variable.set_collective.
See examples/mpi_example.py. Issue #717, pull request #716.
Minimum cython dependency bumped from 0.19 to 0.21.MFTime calendar overload to use across all files, for example,
'standard' or 'gregorian'. If None (the default), check that the calendar
attribute is present on each variable and values are unique across files raising
a ValueError otherwise.always search for HDF5 headers when building, even when nc-config is used (since nc-config does not always include the path to the HDF5 headers). Also
Fix for auto scaling and masking when _Unsigned attribute set (create view as unsigned type after scaling and masking). Issue #671.
recognize _Unsigned attribute used by netcdf-java to designate unsigned integer data stored with a signed integer type in netcdf-3 (issue #656).
fix for issue #624 (error in conversion to masked array when variable slice returns a scalar). This is a regression introduced in 1.2.5 associated wit
fix some test failures on big endian PPC64 that were due to errors in byte-swapping logic. Also fixed bug in enum code exposed on PPC64 (issue #608).
Add MFDataset.set_auto_maskandscale (plus set_auto_scale, set_auto_mask). Fixes issue #570.
raise warning for HDF5 1.10.x (issue #549), since backwards incompatible files may be created.
try to avoid writing NC_STRING attributes if possible, by trying to convert unicode strings to ascii and write as NC_CHAR (issue
speed up the creation of new Group instances (issue 239).
fix logic errors in setup.py (issue 236).
it is now possible to create and set variable length string variables with numpy string datatypes (pull request 224).
add .travis.yml (for travis-ci testing on github), silence warnings from test output (issue 225).
modify unicode for Variable and Dimension to return more useful error message when Dataset object has been garbage collected.
use weak references to group instances when creating Dimension and Variable objects. This prevents cyclic references messing up garbage collection (issue 218, pull request 219).
accessing values from a 0-dimensional Variable now returns a 0-dimensional numpy array, not a 1-dimensional array (issue 220). To write code compatible with both the old and new (fixed) behavior, wrap values accessed from a 0-dimensional Variable with numpy.asscalar.
add an array method to Variable to make numpy ufuncs faster (issue 216).
change download_url in setup.py to point to pypi instead of googlecode.
fix for date2index error when time variable has only one entry (issue 215).
silence warnings ("Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line") with Cython 0.2.
reduced memory usage for Variable.getitem under Python 2.
change file_format Dataset attribute to data_model (keeping file_format for backward compatibility). Add disk_format attribute (underlying disk format, one of NETCDF3, HDF4, HDF5, DAP2, DAP4, PNETCDF or UNDEFINED). Uses nc_inq_format_extended, added in version 4.3.1 of library. If using earlier version of lib, disk_format will be set to UNDEFINED.
default _FillValue now ignored for byte data types (int8 and uint8) as per http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c/Fill-Values.html#Fill-Values "If you need a fill value for a byte variable, it is recommended that you explicitly define an appropriate _FillValue attribute, as generic utilities such as ncdump will not assume a default fill value for byte variables". ncinfo now returns fill mode information (issue 209).
check to see if filling was disabled before masking data equal to default fill value (issue 209).
add variable type information to Dataset.repr (output of ncinfo).
add the ability to specify the locations of hdf4,jpeg and curl libs, in case netCDF4 was built statically with HDF4 and/or OpenDAP support (issue 207).
add 'ncinfo' utility (like 'ncdump -h' but less verbose).
more information displayed when Dataset or Group instance is printed.
fix for issue 194 (versions after 1.0.5 fail for netcdf 4.1.1, due to call to nc_inq_path, which was added in netcdf 4.1.2). Fixed by adding compile time API check similar to what was done for nc_rename_grp. If filepath Dataset method is called an exception will be raised at runtime if the module was built with netcdf < 4.1.2, or cython was not installed at build time.
fix for issues 202 and 206 (exception raised by numpy.isnan for character data types).
if dateutils not installed and time unit accuracy < 1 second requested, have netcdftime raise an ImportError.
issue warning of endian-ness of dtype argument does not match endian kwarg in createVariable.
make sure netcdf type NC_CHAR always returned in numpy array dtype 'S1' (sometimes arrays of type 'U1' were being returned). Fixes intermittently failing test tst_compoundatt.py on python 3.3.
fix for issue 201 (if data associated with numpy array not the same endian-ness as dtype, data was written incorrectly). Now bytes are swapped if necessary. Variable.endian() now returns 'native' instead of None for NETCDF3 formatted files. createVariable now enforces endian='native' for NETCDF3 files. Added tst_endian.py test case.
fix for issue 200 (library version detection failed on cygwin).
fix for issue 199 (nc4tonc3 utility not copying global attributes).
fix for issue 198 (setup.py chokes when no arguments given).
fix for issue 197 (slicing of netCDF variables using lists of integers).
create 'path' attribute for group instance using posixpath, instead of os.path (to ensure the unix path is used on all platforms). Issue 196.
fix for issue 196 (test failures on win32 due to files being deleted before they are closed).
change setup.py to compile the Cython sources directly, if cython is available. This allows for "ifdef" like capability to modify source at compile time to account for changes in netcdf API (e.g. the forthcoming addition of the nc_rename_grp in version 4.3.1).
added a "renameGroup" method, which raises an exception if the netcdf lib version linked does not support it. Requires netcdf >= 4.3.1.
support for more than one missing value (missing_value attribute is a vector) when converting to masked array.
add 'renameAttribute' method to Dataset, Group and Variable.
fix so that var[:] = x works if x is a scalar, and var is a netcdf variable with an unlimited dimension that has shape () - i.e. no data has been written to it yet. Before this change, var[:] = x did not write any data. Now the scalar x will be written as the first entry in var along the unlimited dimension.
remove dos line feeds from nc3tonc4 (issue 181).
add datatype property for Variable that returns numpy dtype for primitive datatypes (same as dtype attribute) but returns CompoundType or VLType instance for compound or vlen variables (issue 178).
fix logic for deciding where to look for nc-config in setup.py (issue 177).
issue a warning and don't try to apply scale_factor or add_offset if these attributes are not convertible to floats (issue 176).
add filepath method to Dataset instance to return file path (or opendap URL) used to create Dataset (issue 172).
fix for issue 170 (opening a remote DAP dataset fails after creating a NETCDF4 formatted file).
fix for issue 169 (error in chartostring function on 64-bit windows).
add support for missing_value or _FillValue == NaN (issue 168).
added a Dimension.group() method (issue 165).
don't try to write empty data array to netcdf file (fixed failing test with netcdf 4.3.0rc2).
date2num, num2date and date2index now can handle units of microseconds and milliseconds (for proleptic_gregorian calendar, or gregorian and standard calendars as long as the time origin is after 1582-10-15). Issue 159.
Added a _grp attribute to Dimension (issue 165).
don't bundle ordereddict (issue 164).
support reading of vlen string attributes (issue 156).
add --vars option to nc3tonc4 (issue 154).
Don't try to set fletcher32 checksum on scalar variables (it causes HDF5 to crash). Fixes issue 150.
Add --istart/--istop options to nc3tonc4 (issue 148, courtesy of Rich Signell).
fix for proleptic_gregorian in netcdftime.py (courtesy of Matthias Cuntz).
disable version check for HDF5, which is broken by hdf5 1.8.10.
make sure all files have a calendar attribute in MFTime (issue 144).
more robust fix to issue 90 (array shape modified by assignment to a netCDF variable with one more dimension), including test case.
fix error that occurred when retrieving data from a variable that has a missing_value attribute specified as a string (issue 142).
automatically close netcdf files when there are no references left to Dataset object (using dealloc method). Fixes issue 137.
fix for slicing of scalar vlen string variables (issue 140).
fix to allow writing of unicode data to a NC_CHAR variable.
allow for writing of large variables (> 2**32 elements). Fixes issue 130.
add 'aggdim' keyword to MFDataset, so the name of the dimension to aggregate over can be specified (instead of using the unlimited dimension). aggdim=None by default, which results in the previous behavior. aggdim must be the leftmost dimension of all the variables to be aggregated.
raise IndexError when indexing a netcdf variable out of range so iterating over a variable in a for loop behaves as expected (as described in http://effbot.org/zone/python-for-statement.htm). Fixes issue 121.
added MacPorts portfile (so it can be installed via MacPorts on macosx using a "local Portfile repository"). Installs from svn HEAD using 'port install netcdf4-python'.
added experimental 'diskless' file capability (only added to the C lib after the 4.2 release). Controlled by kwarg 'diskless' to netCDF4.Dataset (default False). diskless=True when creating a file results in a file that exists only in memory, closing the file makes the data disappear, except if persist=True keyword given in which case it is persisted to a disk file on close. diskless=True when opening a file creates an in-memory copy of the file for faster access.
add the ability to specify the location of the required libs (and whether to use nc-config) with setup.cfg, instead of using environment variables.
fix ISO9601 date parser so it recognizes time zone offsets in time unit strings (contributed by David Hassel, issue 114, r1117).
add setncatts Dataset,Group and Variable method to add a bunch of attributes (given in a python dictionary) at once. Speeds things up for NETCDF3 and NETCDF4_CLASSIC files a lot, since nc_redef/nc_enddef not need to be called for each attribute (issue 85, r1113). Adding 1000 attributes is about 35 times faster using setncatts to add them all at once. Makes no difference for NETCDF4 formatted files, since nc_redef/nc_enddef is not called.
only round after apply scale_factor and add_offset if variable type is integer (issue 111, r1109).
Fixed bug with all False Boolean index (r1107).
added support for after, before and nearest selection method to date2index fast "first guess" indexing (r1106).
Remove white space in time units string (netcdftime._parse_date). An extra space in the time units of one CMIP3 model caused an error (r1105).
based on results with examples/bench_compress2.py, change default complevel for zlib compression from 6 to 4. If complevel=0, turn compression off entirely (set zlib=False) (r1102).
changed default unicode encoding from "latin-1" to "utf-8", since this is the python 3 default, and the only encoding that appears to work for dimension and variable names.
added test case for unicode attributes, variable and dimension names.
fixes for unicode variable, dimension and group names.
fix for unicode attributes in python3 (ncdump did not intrepret them as text strings). Issue 107.
add --format option to nc4tonc3 utility (can be either NETCDF3_CLASSIC or NETCDF3_64BIT). Fixes issue 104.
use numpy.ma.isMA to check for masked array (instead of checking for presence of 'mask' attribute).
fixes for AIX with ibm xlc compiler.
make sure unicode attributes don't get converted to ascii strings (issue 98).
Added str methods to Dataset, Variable, Dimension, CompoundType, VLType and MFDataset, so useful human-readable information is provided when these objects are printed in an interactive session.
don't try to apply scale_factor and offset if scale_factor=1 and add_offset=0 (to avoid making copies of large arrays).
changed netCDF4._default_fillvals to netCDF4.default_fillvals (to make part of public API). Added to docs (issue 94).
changed default unicode encoding from "ascii" to "latin-1" (iso-8859-1).
add "unicode_error" module variable to control what happens when characters cannot be decoded by the encoding specified by the "default_encoding" module variable (which is "ascii" by default). unicode_error = "replace" by default which means bad characters are replace by "?". Previously an error was raised, the old behavior can be obtained by setting unicode_error = 'strict'. Fixes issue 92.
add enter and exit methods so you can do "with Dataset(url) as f:" (issue 89).
don't add extra singleton dimensions to rhs numpy arrays when assigning to a netcdf variable. Fixes issue 90.
coerce missing_value attribute to same type as variable (for primitive types). Fixes issue 91.
fix for compound variables on python 3.2.
fix slicing of masked MFDataset variables (issue 83).
round to nearest integer after packing with scale_factor and add_offset (instead of truncation) (issue 84).
if add_offset missing, but scale_factor present, assume add_offset zero. if scale_factor missing, but add_offset present, assume scale_factor one. (this is consistent with unidata recommendations - issue 86).
only try to convert strings to bytes for python 3 so Dataset can be subclassed (issue 87).
tested with python 2.7.1/3.1.3 using netcdf 4.1.2 and hdf5 1.8.6.
Added a 'default_encoding' module variable that controls how unicode strings are encoded into bytes. Default is 'ascii'.
now works on Python 3.
netCDF3 module removed. If you still need it, get it from netCDF4 0.9.3.
regenerated C source with Cython 0.14.1.
Added a MFTime class. Provide a unified interface to MFDataset time variable using different time units.
Fixed bug in netcdftime (issue 75) that occurs when time specified is within one second of the end of the month.
on unix-like systems, the environment variable USE_NCCONFIG can be set to tell setup.py to use the nc-config script installed by netcdf to figure out where all the libs and headers are (without having to specify NETCDF_DIR, HDF5_DIR, etc). Only works with netcdf 4.1.2.
fix chunk sizes bug (chunk sizes pointer should be size_t, not int). Fixes issue 66. Added test in tst_compression.py
fixed writing of data with missing values with scale/offset packing. Added test (tst_masked2.py).
fix iso8601 regex in netcdftime date parser so it can parse 'hours since 1-1-1 ...' (year had to be 4 digits previously)
fix netcdftime bug with '360_day' calendar. Fixes issue 59.
make sure scalar slice of 1d variable returns array scalar (not array of shape (1,)). Fixes issue 57.
updated date parser in netcdftime. Can now handle units like "seconds since 1970-01-01T00:00:00Z".
added support in setup.py for specifying the locations of the HDF5/netcdf-4 headers and libs separately with environment variables (HDF5_INCDIR, HDF5_LIBDIR).i Patch contributed by Patrice Dumas.
add masked array support to num2date (dates for missing times set to None).
add chunk_cache keyword to createVariable. HDF5 default is 1mb, which can cause problems when creating 1000's of variables. In such cases, chunk_cache can be reduced, or set to zero.
add set_var_chunk_cache and get_var_chunk_cache Variable methods.
raise AttributeError when trying to set _FillValue attribute (it can only be reliably set on variable creation, using the fill_value keyword to createVariable).
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →