Written and maintained by CASRAI Editorial Board
Last updated
Climate Data Operators (CDO) is an open-source collection of command-line operators developed by the Max Planck Institute for Meteorology (MPI-M) and Deutsches Klimarechenzentrum (DKRZ) for standard processing and analysis of climate and numerical weather prediction (NWP) model outputs. The software enables researchers to execute statistical computations, spatio-temporal selections, field interpolations, and arithmetic transformations on multi-gigabyte environmental datasets without exceeding workstation physical memory limits. Released under the 3-clause BSD License, CDO provides format-independent data manipulation for NetCDF 3/4, GRIB 1/2, SERVICE, EXTRA, and IEG formats via the Climate Data Interface (CDI).
What it is used for in research
Atmospheric, oceanic, and environmental science workflows depend on massive multidimensional data produced by Earth system models or observational reanalyses, such as datasets retrieved through the Copernicus Climate Data Store or ECMWF. CDO solves the operational bottleneck of handling these vast data volumes by operating as a high-throughput, memory-conservative stream processor. Rather than loading entire multidimensional arrays into RAM, CDO processes records sequentially, allowing researchers to evaluate data files that far exceed available system memory.
In standard scientific workflows, CDO is utilized for:
- Format Harmonization: Converting operational meteorological files between GRIB and NetCDF or converting legacy formats to self-describing structures compliant with Climate and Forecast (CF) conventions and rich metadata standards.
- Spatio-Temporal Subsetting: Clipping global climate grids to regional domains (bounding boxes), masking ocean or land areas, and isolating specific temporal periods, seasonal intervals, or atmospheric vertical pressure levels.
- Climatological Statistics: Computing long-term multi-year monthly averages, seasonal cycles, standard deviations, running means, and empirical climate extreme indices.
- Data Curation and Sharing: Pre-processing curated datasets prior to archiving and distribution in public repositories such as the PANGAEA Data Publisher to support open data sharing.
Install or access
CDO is distributed primarily as open-source C/C++ source code configured via GNU Autoconf and Automake, compiling on standard POSIX-compliant systems including Linux distributions, macOS, BSD variants, and high-performance computing (HPC) clusters. Researchers can deploy CDO using official source packages or pre-compiled environments:
- Package Managers and Conda: The most widely adopted local deployment uses Conda-forge:
conda install -c conda-forge cdo python-cdoDebian/Ubuntu distributions also provide stable builds via
apt-get install cdo. - HPC Environment Modules: Institutional compute facilities typically provide optimized vendor-compiled builds accessible through environment modules:
module load cdo - Source Compilation: For maximum computational throughput on cluster architectures, CDO can be compiled from source using
./configurewith explicit paths to NetCDF, HDF5, and eccodes libraries, followed bymakeandmake install.
Step-by-step task
This demonstration outlines a common climate research task: inspecting a global temperature file, cropping it to a regional bounding box, converting units from Kelvin to degrees Celsius, and calculating a multi-year monthly mean climatology using operator pipelining.
Step 1: Inspect input file metadata and grid structure
Before modifying variables, inspect the internal dimensions, variable names, and timesteps using the built-in inspection operator:
cdo -info global_tas.nc
To check coordinate and grid attributes directly, use:
cdo -griddes global_tas.nc
Step 2: Sub-region selection and variable extraction
Extract only the 2-meter surface temperature variable (tas) across the Northern Hemisphere (longitude -180 to 180 degrees, latitude 0 to 90 degrees):
cdo -sellonlatbox,-180,180,0,90 -selname,tas global_tas.nc regional_tas.nc
Step 3: Unit conversion and attribute adjustment
Earth system model outputs generally record temperature in Kelvin. Convert values to degrees Celsius by subtracting 273.15, while simultaneously updating the variable units metadata attribute:
cdo -setattribute,tas@units="degC" -addc,-273.15 regional_tas.nc regional_tas_celsius.nc
Step 4: Streamlined operator chaining
CDO allows all single-output operators to chain seamlessly by prefixing upstream operators with a hyphen (-). This eliminates the creation of large intermediate disk files and reduces disk I/O:
cdo -r -setattribute,tas@units="degC" -addc,-273.15 -sellonlatbox,-180,180,0,90 -selname,tas global_tas.nc regional_tas_celsius.nc
Step 5: Compute monthly climatological means
Calculate the monthly average across the time series to produce a twelve-month climatological cycle:
cdo -ymonmean regional_tas_celsius.nc monthly_climatology.nc
Output and how to read it
The resulting NetCDF or GRIB files maintain CF-compliant coordinate dimensions (latitude, longitude, time, and vertical levels). Researchers can verify that output structures conform to expectations using standard command-line flags:
cdo -showname monthly_climatology.ncdisplays the active variable names preserved in the output file.cdo -ntime monthly_climatology.ncconfirms that the time dimension reflects the expected count (e.g., 12 timesteps for a monthly climatological mean).cdo -infov monthly_climatology.ncoutputs statistical metrics (minimum, maximum, mean, and missing value counts) for each timestep and variable, enabling rapid quality control of physical validity.
Troubleshooting
When running CDO on complex climate datasets, several common operational edge cases arise:
- NetCDF-4 and HDF5 Operator Chaining Failures: When pipelining complex operations on compressed NetCDF-4/HDF5 files, segmentation faults or memory allocation errors may occur if internal library buffers clash. Adding the
-f nc4or-k classicflag explicitly resolves compression format conflicts. - Coordinate Variable Renaming: CDO operators like
chnamecan rename data variables, but CDO cannot alter underlying dimension coordinate names. To rename coordinate dimensions, researchers must use NCO’s dedicated utility:ncrename -d ncl1,time -v ncl1,time infile.nc outfile.nc - GRIB Dataset Inconsistency: CDO requires that all GRIB timesteps contain consistent variable inventories. If individual timesteps contain differing parameter sets or duplicated variables, CDO will fail with a message regarding inconsistent grid structures. Filtering input variables beforehand with
-selnameprevents this failure. - Missing Value Representations: If raw model outputs employ non-standard numerical missing flags (e.g., -999.0 instead of standard NaN), arithmetic operations can produce incorrect values. Use
cdo -setctomiss,-999.0 infile.nc outfile.ncbefore numerical computations.
Free alternatives
While CDO is a standard tool in climate science, researchers select among several complementary open-source utilities depending on programming preferences and pipeline architectures:
| Software | Primary Interface | Core Strength | Best Research Use Case | License |
|---|---|---|---|---|
| CDO (Climate Data Operators) | CLI / C++ / Python wrappers | Streamlined streaming pipelines, very low RAM footprint, fast GRIB/NetCDF processing | Massive file manipulation, re-gridding, and routine CLI data cleaning | BSD-3-Clause |
| NCO (netCDF Operators) | CLI commands (ncks, ncra, ncatted) | Granular metadata, attribute, and dimension manipulation | Altering coordinate dimensions, appending variables, and low-level NetCDF header editing | GPL-3.0 |
| xarray | Python Library | N-dimensional labeled arrays integrated with Pandas and Dask | Interactive exploratory data analysis, plotting, and scalable distributed computing | Apache 2.0 |
| Iris | Python Library | Strict CF-metadata data model enforcing spatial and meteorological consistency | Operational weather forecasting pipelines and Met Office model workflows | BSD-3-Clause |
FAQ
What is CDO used for in climate research?
CDO is used to inspect, filter, slice, re-grid, and compute statistical aggregates on multi-gigabyte climate and weather model files in NetCDF and GRIB formats.
Can CDO process files that are larger than system RAM?
Yes. CDO operates as a sequential stream processor with very small memory requirements, enabling it to process files substantially larger than the physical memory of the host workstation.
What data formats does CDO support?
CDO natively supports NetCDF (versions 3 and 4), GRIB (versions 1 and 2), and local MPI-MET binary formats including SERVICE, EXTRA, and IEG via the Climate Data Interface (CDI).
How does operator chaining work in CDO?
Any CDO operator that outputs a single stream can pass its result directly to a subsequent operator by prefixing upstream operators with a hyphen (-). This pipelines execution in memory and avoids writing intermediate files to disk.
Sources
- Max Planck Institute for Meteorology (MPI-M) CDO Project Portal and Documentation: https://code.mpimet.mpg.de/projects/cdo (read 2026-11-08)
- MPI-M CDO Wiki and User Guide: https://code.mpimet.mpg.de/projects/cdo/wiki (read 2026-11-08)
- MPI-M CDO Tutorial: https://code.mpimet.mpg.de/projects/cdo/wiki/Tutorial (read 2026-11-08)
- FSU Research Computing Center Documentation on CDO: https://docs.rcc.fsu.edu/software/cdo/ (read 2026-11-08)







