Learn R Programming

⚠️There's a newer version (0.3.2) of this package.Take me there.

rcdo

rcdo is a wrapper around Climate Data Operators.

Installation

You can install rcdo from CRAN with

install.packages("rcdo")

or the development version of rcdo from GitHub with:

# install.packages("pak")
pak::pak("eliocamp/rcdo")

Most operators are supported and are partially documented. The functions start with cdo_ an the name of the operator (e.g. the selname operator is the cdo_selname() function)

Example

library(rcdo)
cdo_use("packaged")  # use package version of cdo that can be installed with `cdo_install()`. 
ncep <- "hgt_ncep.nc"

The ymonmean operator computes monthly annual cycle. The rcdo function is cdo_ymonmean()

ncep |> 
  cdo_ymonmean() 

The output just prints the command with a place holder output. Use cdo_execute() to actually run the command. If no output file is specified, then the result is saved in a tempfile.

ncep |> 
  cdo_ymonmean() |> 
  cdo_execute()

Operators can be chained. Lets select just the Southern Hemisphere first.

ncep |> 
  cdo_sellonlatbox(lon1 = 0, lon2 = 360, lat1 = -90, lat2 = 0) |> 
  cdo_ymonmean() 

Now also select the 500 hPa level

ncep |> 
  cdo_sellonlatbox(lon1 = 0, lon2 = 360, lat1 = -90, lat2 = 0) |> 
  cdo_sellevel(level = 500) |> 
  cdo_ymonmean() 
ncep |> 
  cdo_sellonlatbox(lon1 = 0, lon2 = 360, lat1 = -90, lat2 = 0) |> 
  cdo_sellevel(level = 500) |> 
  cdo_ymonmean() 

Prior art

The ClimateOperators package also wrapps CDO, but it’s approach is different. Instead of wrapping each operator as its own function with parameters as arguments, it provides a generic cdo() function that runs the operators that the user needs to write as strings. Instead of

ncep |> 
  rcdo::cdo_sellonlatbox(lon1 = 0, lon2 = 360, lat1 = -90, lat2 = 0) 

one would write

ClimateOperators::cdo("sellonlatbox,0,360,-90,0", ncep, output_file)

Copy Link

Version

Install

install.packages('rcdo')

Monthly Downloads

2,173

Version

0.3.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Elio Campitelli

Last Published

November 24th, 2025

Functions in rcdo (0.3.1)

bitrounding

Bit rounding
afterburner

ECHAM standard post processor
adisit

Potential temperature to insitu temperature and vice versa
cdo_set_output

Set output and options
cdo_options_use

Manage CDO options
cdo_use

Chose CDO version to use
change

Change field header
deltat

Difference between timesteps
daypctl

Daily percentile values
condc

Conditional select a constant
consecstat

Consecute timestep periods
daystat

Daily statistics
derivepar

Derived model parameters
cmorlite

CMOR lite
collgrid

Collect horizontal grid
dhourstat

Multiday hourly statistics
ecacsu

Consecutive summer days index per time period
ecaid

Ice days index per time period
detrend

Detrend time series
dminutestat

Multiday by the minute statistics
duplicate

Duplicates a dataset
ecacwfi

Coldspell days index wrt 10th percentile of reference period
ecacwdi

Cold wave duration index wrt mean of reference period
copy

Copy datasets
ecacdd

Consecutive dry days index per time period
comp

Comparison of two fields
dayarith

Daily arithmetic
compc

Comparison of a field with a constant
ecar75ptot

Precipitation percent due to R75p days
ecar75p

Moderate wet days wrt 75th percentile of reference period
ecacwd

Consecutive wet days index per time period
ecahwfi

Warm spell days index wrt 90th percentile of reference period
ecahwdi

Heat wave duration index wrt mean of reference period
ecagsl

Thermal Growing season length index
ecasu

Summer days index per time period
ecatg10p

Cold days percent wrt 10th percentile of reference period
ecacfd

Consecutive frost days index per time period
ecatr

Tropical nights index per time period
ecatn90p

Warm nights percent wrt 90th percentile of reference period
ecatx10p

Very cold days percent wrt 10th percentile of reference period
eofcoeff

Principal coefficients of EOFs
eofs

Empirical Orthogonal Functions
ecar99p

Extremely wet days wrt 99th percentile of reference period
ecatx90p

Very warm days percent wrt 90th percentile of reference period
ecar99ptot

Precipitation percent due to R99p days
distgrid

Distribute horizontal grid
cdo_install

Install the supported CDO version
cdo_execute

Execute a CDO operation
diff

Compare two datasets field by field
cond2

Conditional select two fields
cond

Conditional select one field
ecar90p

Wet days wrt 90th percentile of reference period
ecahd

Heating degree days per time period
filedes

Dataset description
ecaetr

Intraperiod extreme temperature range
ecar90ptot

Precipitation percent due to R90p days
enlarge

Enlarge fields
ecafd

Frost days index per time period
getgridcell

Get grid cell index
ensstat

Statistical values over an ensemble
ecarx1day

Highest one day precipitation amount per time period
ecarx5day

Highest fiveday precipitation amount per time period
ecapd

Precipitation days index per time period
ecasdii

Simple daily intensity index per time period
ecarr1

Wet days index per time period
info

Information and simple statistics
gradsdes

GrADS data descriptor file
ecatn10p

Cold nights percent wrt 10th percentile of reference period
input

Formatted input
ecar95ptot

Precipitation percent due to R95p days
expr

Evaluate expressions
ecar95p

Very wet days wrt 95th percentile of reference period
ecatg90p

Warm days percent wrt 90th percentile of reference period
ensstat2

Statistical values over an ensemble
fldstat

Statistical values over a field
hourstat

Hourly statistics
hourpctl

Hourly percentile values
fourier

Fourier transformation
ensval

Ensemble validation tools
fdns

Frost days where no snow index per time period
invert

Invert latitudes
invertlev

Invert levels
filter

Time series filtering
importbinary

Import binary data sets
fldcovar

Covariance in grid space
fldcor

Correlation in grid space
intlevel

Linear level interpolation
magvector

Lat/Lon vector plot
intlevel3d

Linear level interpolation from/to 3D vertical coordinates
gridcell

Grid cell quantities
gridboxstat

Statistical values over grid boxes
merge

Merge datasets
maggraph

Line graph plot
importcmsaf

Import CMSAF HDF5 files
magplot

Lat/Lon plot
monpctl

Monthly percentile values
mastrfu

Mass stream function
mapreduce

Reduce fields to userdefined mask
healpix

Change healpix resolution
pack

Pack data
math

Mathematical functions
pressure

Pressure on model levels
output

Formatted output
monstat

Monthly statistics
ninfo

Print the number of parameters, levels or times
remapstat

Remaps source points to target cells
remapnn

Nearest neighbor remapping
hurr

Hurricane days index per time period
rhopot

Calculates potential density
rotuvb

Rotation
regres

Regression
selregion

Select horizontal regions
selmulti

Select multiple fields via GRIB1 parameters
maskbox

Mask a box
remap

Grid remapping
remapcon

First order conservative remapping
importamsr

Import AMSR binary files
monarith

Monthly arithmetic
merstat

Meridional statistics
maskregion

Mask regions
remapdis

Distance weighted average remapping
samplegrid

Resample grid
set

Set field info
seaspctl

Seasonal percentile values
selyearidx

Select year by index
setgridcell

Set the value of a grid cell
sethalo

Set the bounds of a field
selsurface

Extract surface
runpctl

Running percentile values
histogram

Histogram
intyear

Year interpolation
inttime

Time interpolation
spectral

Spectral transformation
mrotuvb

Backward rotation of MPIOM data
remapbil

Bilinear interpolation
remapbic

Bicubic interpolation
ncl_wind

Wind transformation
split

Split a dataset
setmiss

Set missing value
setpartab

Set parameter table
selbox

Select a box
seasstat

Seasonal statistics
setbox

Set a box to constant
setattribute

Set attributes
remapeta

Remap vertical hybrid level
remaplaf

Largest area fraction remapping
splittime

Split timesteps of a dataset
seltime

Select timesteps
shiftxy

Shift field
showattribute

Show attributes
smooth

Smooth grid points
specconv

Spectral conversion
strbre

Strong breeze days index per time period
mergegrid

Merge grid
outputgmt

GMT output
replacevalues

Replace variable values
select

Select fields
outputtab

Table output
replace

Replace variables
timstat

Statistical values over all timesteps
ydaypctl

Multiyear daily percentile values
timsort

Timsort
splitsel

Split selected timesteps
ydaystat

Multiyear daily statistics
splitdate

Splits a file into dates
timselpctl

Time range percentile values
timselstat

Time range statistics
runstat

Running statistics
vertintgh

Vertical height interpolation
ydrunpctl

Multiyear daily running percentile values
vertintml

Vertical interpolation
selgridcell

Select grid cells
ydrunstat

Multiyear daily running statistics
yseasarith

Multiyear seasonal arithmetic
yearpctl

Yearly percentile values
yearstat

Yearly statistics
zonstat

Zonal statistics
yseasstat

Multiyear seasonal statistics
timcor

Correlation over time
varsstat

Statistical values over all variables
verifygrid

Verify grid coordinates
tee

Duplicate a data stream and write it to file
timpctl

Percentile values over all timesteps
unpack

Unpack data
yhourarith

Multiyear hourly arithmetic
timfillmiss

Temporal filling of missing values
vargen

Generate a field
setfilter

Set NetCDF4 filter
wind

Wind transformation
ymonarith

Multiyear monthly arithmetic
wind2

D and V to velocity potential and stream function
ymoncomp

Multiyear monthly comparison
setgrid

Set grid information
showinfo

Show variables, levels or times
yhourstat

Multiyear hourly statistics
setzaxis

Set zaxis information
settime

Set time
selvar

Select fields
yseaspctl

Multiyear seasonal percentile values
seltimeidx

Select timestep by index
timcovar

Covariance over time
wct

Windchill temperature
vertstat

Vertical statistics
trendarith

Add or subtract a trend
trend

Trend of time series
yearmonstat

Yearly mean from monthly data
timcumsum

Cumulative sum over all timesteps
sinfo

Short information
yeararith

Yearly arithmetic
strgal

Strong gale days index per time period
xsinfo

Extra short information
ydayarith

Multiyear daily arithmetic
strwin

Strong wind days index per time period
vertintap

Vertical pressure interpolation
vertfillmiss

Vertical filling of missing values
ymonpctl

Multiyear monthly percentile values
ymonstat

Multiyear monthly statistics
cdo

Execute a custom operator
cdo_cache_set

Manages the cache
arith

Arithmetic on two datasets
apply

Apply operators
arithc

Arithmetic with a constant
arithdays

Arithmetic with days
arithlat

Arithmetic with latitude