netCDF4
Provides an object-oriented python interface to the netCDF version 4 library
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 netcdf4uv
uv add netcdf4poetry
poetry add netcdf4Installing 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
h5netcdfh5netcdf reads and writes netCDF4 files using…
permissive · top 5,000 on PyPI
cfgribcfgrib maps GRIB meteorological data files to…
permissive · top 5,000 on PyPI
cftimeConverts between calendar dates and numeric…
permissive · top 5,000 on PyPI
hdmfHDMF provides APIs for defining hierarchical…
permissive · top 15,000 on PyPI
tablesPyTables provides an object-oriented interface…
permissive · top 5,000 on PyPI
h5pyh5py reads and writes HDF5 files from Python,…
permissive · top 1,000 on PyPI
earthkit-dataearthkit-data provides a unified Python…
permissive · top 15,000 on PyPI
pypcd4pypcd4 reads, writes, and manipulates Point…
permissive · top 15,000 on PyPI
pydappydap is a pure-Python OPeNDAP client and…
permissive · top 15,000 on PyPI
arraykitArrayKit provides C-extension implementations…
permissive · top 15,000 on PyPI