nctoolkit icon indicating copy to clipboard operation
nctoolkit copied to clipboard

A Python package for netCDF analysis and post-processing

pypi Conda Latest Release contributions welcome codecov GitHub Testing GitHub Testing Documentation Status DOI

nctoolkit - A Python package for netCDF analysis and post-processing

nctoolkit is a comprehensive Python (3.8 and above) package for analyzing netCDF data on Linux and macOS.

Core abilities include:

  • Clipping to spatial regions
  • Calculating climatologies
  • Subsetting to specific time periods
  • Calculating spatial statistics
  • Creating new variables using arithmetic operations
  • Calculating anomalies
  • Calculating rolling and cumulative statistics
  • Horizontally and vertically remapping data
  • Calculating time averages
  • Interactive plotting of data
  • Calculating the correlations between variables
  • Calculating vertical statistics for the likes of oceanic data
  • Calculating ensemble statistics
  • Calculating phenological metrics

PML logo

Installation

The easiest way to install the package is using conda or mamba. This will install nctoolkit and all system dependencies.

conda install -c conda-forge nctoolkit
mamba install -c conda-forge nctoolkit

If you install using conda, please be aware that conda can install a very old version of nctoolkit. Consider setting it to a more recent version.

Install through PyPI using pip:

pip install nctoolkit 

Install the development version using using pip:

pip install git+https://github.com/pmlmodelling/nctoolkit.git

This package requires the installation of Climate Data Operators. The conda installation will handle this for you. Otherwise, you will have to install it. The easiest way is using conda:

conda install -c conda-forge cdo 

A couple of methods give users the option of using NetCDF Operators instead of CDO as the computational backend. Again, the easiest way to install is using conda:

conda install -c conda-forge nco 

If you want to install CDO from source, bash scripts are available here.

nctoolkit is tested with continuous integration using Circle CI (for Linux) and GitHub actions (for Mac OS). It will not work on Windows platforms today or in future, because of system dependency limitations.

Reference and tutorials

A full API reference, in depth tutorials and a how-to guide are available at readthedocs.

Contributing

If you are interesting in contributing to nctoolkit feel free to read the Contributing page.

Got questions about nctoolkit?

  • If you have a question about how to use nctoolkit, please ask on GitHub Discussions.
  • Report any bugs, suggest new features or view the source code on GitHub.