Wrapper of 'CDO' Operators

Provides a translation layer between 'R' and 'CDO' operators. Each operator is it's own function with documentation. Nested or piped functions will be translated into 'CDO' chains.


rcdo rcdo website

Lifecycle:stable CRANstatus Codecov testcoverage R-CMD-check

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)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rcdo")

0.3.2 by Elio Campitelli, 10 months ago


https://eliocamp.github.io/rcdo/, https://github.com/eliocamp/rcdo


Report a bug at https://github.com/eliocamp/rcdo/issues


Browse source code at https://github.com/cran/rcdo


Authors: Elio Campitelli [cre, aut, cph] (ORCID: , MPI für Meteorologie [cph]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports cli, R6, rlang

Suggests glue, knitr, markdown, testthat

System requirements: cdo


Suggested by icecdr, metR.


See at CRAN