skillfed

netCDF4

Provides an object-oriented python interface to the netCDF version 4 library

netcdf4 v1.7.4 4.7M downloads/30d#2,241 on PyPI835
Permissive license MIT Active released

What it is and what it does

netcdf4 is a Python wrapper around the netCDF C library that lets you work with netCDF version 4 files—a widely used format in climate, meteorology, and oceanography for storing multidimensional scientific data. It provides an object-oriented API to create, read, and modify netCDF datasets, including support for complex numbers, multiple compression algorithms (zstd, bzip2, blosc via plugins), and quantization for improved compression. The package depends on numpy for array operations, cftime for calendar-aware time handling, and certifi for SSL certificate validation in OpenDAP https URLs.

The library is maintained by Unidata and actively developed; version 1.7.4 (released January 2026) includes compression plugins in wheels, free-threaded Python support, and improved Unicode string handling. It requires Python 3.10 or later and provides precompiled wheels for macOS, Linux, and Windows across multiple architectures. A notable caveat: the underlying netCDF C library is not thread-safe, and while netcdf4-python includes internal locking, the documentation warns that free-threaded Python users must exercise care to call netCDF only from a single thread to avoid segfaults.

Use it for:

  • Read and analyze climate model output or observational data stored in netCDF format for research or forecasting.
  • Create and write multidimensional scientific datasets with compression and metadata for archival or sharing.
  • Access remote netCDF files via OpenDAP https URLs for distributed data analysis workflows.
  • Convert between netCDF and other formats, or manipulate existing files to add/modify variables and attributes.
  • Process time-series data from meteorological or oceanographic instruments using calendar-aware time coordinates.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

netcdf4 provides a Python interface to read, write, and manipulate netCDF version 4 files through bindings to the netCDF C library.

Yes, if you work with netCDF files in scientific computing. The package is actively maintained, well-established (since 2006), has no known vulnerabilities, and provides convenient Python access to a standard data format. Install friction is moderate but manageable via precompiled wheels. The single-thread requirement for free-threaded Python is a gotcha only if you use that runtime; standard Python users are unaffected.

Install

netcdf4 on PyPI

pip

pip install netcdf4

uv

uv add netcdf4

poetry

poetry add netcdf4

Installing netCDF4

Before you install

Medium install friction due to compiled C library dependency. The package is actively maintained with recent releases (1.7.4 in January 2026) and provides precompiled wheels for multiple Python versions (3.10–3.14) and platforms, reducing build complexity. Repository shows active development with 835 stars.

License in practice

MIT license is permissive and imposes minimal restrictions on use, modification, and distribution.

Quickstart

pip install netcdf4

import netCDF4
ds = netCDF4.Dataset('file.nc', 'r')
data = ds.variables['var_name'][:]
ds.close()

Requires the netCDF C library to be installed on your system; wheels bundle this for most platforms but some Linux distributions may require manual installation of system dependencies.

Verify before relying

  • Whether the thread-safety warning in the changelog (segfaults with free-threaded Python) affects typical single-threaded workflows.
  • Performance characteristics for very large files or high-frequency read/write operations.
  • Compatibility with alternative netCDF implementations or non-standard file variants.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — cftime, certifi, numpy
Maintenance actively maintained — 221 days since the last release
Last repo commit
First released
Downloads 4,747,772/month — #2,241 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: netcdf4-1.7.4-cp310-cp310-macosx_13_0_x86_64.whl; netcdf4-1.7.4-cp310-cp310-macosx_14_0_arm64.whl; netcdf4-1.7.4-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; netcdf4-1.7.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; netcdf4-1.7.4-cp310-cp310-win_amd64.whl; netcdf4-1.7.4-cp311-abi3-macosx_13_0_x86_64.whl; netcdf4-1.7.4-cp311-abi3-macosx_14_0_arm64.whl; netcdf4-1.7.4-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; netcdf4-1.7.4-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; netcdf4-1.7.4-cp311-abi3-win_amd64.whl; netcdf4-1.7.4-cp311-abi3-win_arm64.whl; netcdf4-1.7.4-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; netcdf4-1.7.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; netcdf4-1.7.4-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; netcdf4-1.7.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; netcdf4-1.7.4-cp314-cp314t-macosx_13_0_x86_64.whl; netcdf4-1.7.4-cp314-cp314t-macosx_14_0_arm64.whl; netcdf4-1.7.4-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; netcdf4-1.7.4-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; netcdf4-1.7.4-cp314-cp314t-win_amd64.whl

Keywords: numpy, netcdf, data, science, network, oceanography, meteorology, climate

Development Status :: 3 - AlphaIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: Archiving :: Compression

Tags

netcdf file reading writing pythonscientific data format hdf5climate meteorology data accessmultidimensional array storageoceanography data processingnetcdf4 python interface
scientific-dataclimate-meteorologyhdf5-netcdf

More Python Modules packages