nctoolkit: Efficient and intuitive tools for analyzing netCDF data in Python

nctoolkit is a comprehensive Python (3.6 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

Under the hood nctoolkit relies on Climate Data Operators (CDO). nctoolkit is designed as a standalone package with no required understanding of CDO, but it provides expert users of CDO the ability to process data in Python with ease, and with method chaining handled automatically.

In addition to the guidance given here, tutorials for how to use nctoolkit are available at nctoolkit’s GitHub page.

Fixing plotting problem due to xarray bug

There is currently a bug in xarray caused by the update of pandas to version 1.1. As a result some plots will fail in nctoolkit. To fix this ensure pandas version 1.0.5 is installed. Do this after installing nctoolkit. This can be done as follows:

$ conda install -c conda-forge pandas=1.0.5

or:

$ pip install pandas==1.0.5