nctoolkit relies on Climate Data Operators (CDO) as its computational backend. This is a high-powered command line tool for manipulating and analyzing climate model data. You can read more about CDO on their website.

nctoolkit is designed as a stand alone package and users will require no understanding of CDO to use it. However, people with knowledge of CDO may want to use the cdo_command method to use CDO methods directly.

Using CDO commands

If you want to apply a CDO command in nctoolkit, all you need to do is remove the beginning and end, i.e. ‘cdo’ and the file names.

So, a typical CDO command looks like this:

cdo yearmean

If we wanted to use this in nctoolkit, we would just do this:


If the CDO command is an ensemble method that takes multiple files as input and produces one, you will need to specify that it is an ensemble method, as follows:

ds.cdo_command("ensmean", ensemble = True)

Using NCO commands

nctoolkit also allows you to apply NCO commands to datasets using the nco_command method. You just need to remove the two file names from the command you want to apply.

So, the following command:

ncks -v kd_490 -d lat,40.0,70.0 -d lon,-20.0,15.0

would become:

ds.nco_command("ncks -v kd_490 -d lat,40.0,70.0 -d lon,-20.0,15.0")