cdo: Climate Data Operators (CDO)

Description Usage Arguments Details Examples

View source: R/CDO__functions.r

Description

Provides an interface for running commands suitable for use with the (externally installed) Climate Data Operators (CDO)

Usage

1
2
3
4
5
6
7
cdo(..., debug = FALSE)

set.cdo.defaults(defaults = "")

csl(...)

ssl(...)

Arguments

debug

Doesn't run the command, but returns the command that would be run.

defaults

Character string supplying the defaults to be used by CDO

Details

Default options for cdo can be set at the system wide level using the set.cdo.defaults() command. Two of the most useful of these include "-O" (to overwrite files by default) and "-s" to silence the outputs of cdo. See the helpfiles of CDO for more.

csl converts a set of arguments into a comma separated list

ssl converts a set of arguments into a space separated list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# What version of CDO am I running?
cdo("--version")

# Select a variable from a CMIP5 model
# Note, to run this in the wild, remove the debug=TRUE argument
in.fname <- "tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512.nc"
out.fname <- "foo.nc"
cdo("selvar",in.fname,out.fname,debug=TRUE)

# Use the defaults and csl to build up a more complex argument
# Note, to run this in the wild, remove the debug=TRUE argument
in.fname <- "tos_Omon_IPSL-CM5A-LR_historical_r1i1p1_185001-200512.nc"
out.fname <- "foo.nc"
set.cdo.defaults("--silent")
yrs <- seq(1950,2005,by=5) #Every fifth year
cdo(csl("selyear",yrs),in.fname,out.fname,debug=TRUE)

markpayneatwork/ClimateOperators documentation built on June 19, 2021, 7:26 p.m.