How to install nctoolkit¶
You will need a Linux or Mac operating system for nctoolkit to work. It will not work on Windows due to system requirements.
nctoolkit is available from the Python Packaging Index. To install nctoolkit using pip:
$ pip install numpy $ pip install nctoolkit
If you already have numpy installed, ignore the first line. This is only included as it will make installing some dependencies smoother. nctoolkit partly relies on cartopy for plotting. This has some additional dependencies, so you may need to follow their guide here to ensure cartopy is installed fully. If you install nctoolkit using conda, you will not need to worry about that.
If you install nctoolkit from pypi, you will need to install the system dependencies listed below.
nctoolkit can also be installed using conda, as follows:
$ conda install -c conda-forge nctoolkit
Note that recent releases are not available for Python 3.8 on macOS on conda. This issue is being investigated at the minute, and will hopefully be resolved shortly. In the meantime, if you are using macOS and Python 3.8, it is best to install using pip.
At present this can be slow due to the time taken to resolve dependency versions. If you run into problems just use pip.
To install the development version from GitHub:
$ pip install git+https://github.com/r4ecology/nctoolkit.git
An update to a dependency of a dependency has broken plotting in nctoolkit. If you experience an error related to jinja2, downgrad the package as follows:
$ conda install jinja2=3.0.3 $ pip install jinja2==3.0.3
Jupyter notebook issue¶
A recent update to ipykernel has broken some functionality in jupyter notebooks, with Python not exiting properly when notebooks are restarted or closed. This is resulting in nctoolkit not automatically deleting temporary files at the end of sessions. To fix this just downgrade ipykernel:
$ conda install ipykernel=6.9.1 $ pip install ipykernel==6.9.1
CDO update issue¶
The latest version of CDO is incompatible with nctoolkit at present, due to the switch to C++14 in CDO. This will be rectified in an upcoming version of nctoolkit. For now, if you have version 2.0.0 of CDO installed, you should downgrade it. If you are using conda, just do this:
$ conda install -c conda-forge cdo=1.9.10
$ conda install -c conda-forge cdo $ conda install -c conda-forge nco
CDO is necessary for the package to work. NCO is an optional dependency and does not have to be installed.
If you want to install CDO from source, you can use one of the bash scripts available here.