PICT PICT PICT PICT

PICT PICT

CDO User Guide

PICT

Climate Data Operators
Version 1.8.1
April 2017

Uwe Schulzweida MPI for Meteorology

PICT PICT PICT

PICT PICT

Contents

1  Introduction
 1.1  Building from sources
  1.1.1  Compilation
  1.1.2  Installation
 1.2  Usage
  1.2.1  Options
  1.2.2  Environment variables
  1.2.3  Operators
  1.2.4  Operator chaining
  1.2.5  Parallelized operators
  1.2.6  Operator parameter
 1.3  Horizontal grids
  1.3.1  Grid area weights
  1.3.2  Grid description
 1.4  Z-axis description
 1.5  Time axis
  1.5.1  Absolute time
  1.5.2  Relative time
  1.5.3  Conversion of the time
 1.6  Parameter table
 1.7  Missing values
  1.7.1  Mean and average
 1.8  Percentile
  1.8.1  Percentile over timesteps
2  Reference manual
 2.1  Information
  2.1.1  INFO - Information and simple statistics
  2.1.2  SINFO - Short information
  2.1.3  DIFF - Compare two datasets field by field
  2.1.4  NINFO - Print the number of parameters, levels or times PICT PICT
  2.1.5  SHOWINFO - Show variables, levels or times
  2.1.6  FILEDES - Dataset description
 2.2  File operations
  2.2.1  COPY - Copy datasets
  2.2.2  REPLACE - Replace variables
  2.2.3  DUPLICATE - Duplicates a dataset
  2.2.4  MERGEGRID - Merge grid
  2.2.5  MERGE - Merge datasets
  2.2.6  SPLIT - Split a dataset
  2.2.7  SPLITTIME - Split timesteps of a dataset
  2.2.8  SPLITSEL - Split selected timesteps
  2.2.9  DISTGRID - Distribute horizontal grid
  2.2.10  COLLGRID - Collect horizontal grid
 2.3  Selection
  2.3.1  SELECT - Select fields
  2.3.2  SELMULTI - Select multiple fields via GRIB1 parameters
  2.3.3  SELVAR - Select fields
  2.3.4  SELTIME - Select timesteps
  2.3.5  SELBOX - Select a box of a field
  2.3.6  SELGRIDCELL - Select grid cells
  2.3.7  SAMPLEGRID - Resample grid
 2.4  Conditional selection
  2.4.1  COND - Conditional select one field
  2.4.2  COND2 - Conditional select two fields
  2.4.3  CONDC - Conditional select a constant
  2.4.4  MAPREDUCE - Reduce fields to user-defined mask
 2.5  Comparison
  2.5.1  COMP - Comparison of two fields
  2.5.2  COMPC - Comparison of a field with a constant
 2.6  Modification
  2.6.1  SETATTRIBUTE - Set attributes
  2.6.2  SETPARTAB - Set parameter table
  2.6.3  SET - Set field info
  2.6.4  SETTIME - Set time
  2.6.5  CHANGE - Change field header
  2.6.6  SETGRID - Set grid information
  2.6.7  SETZAXIS - Set z-axis information
  2.6.8  INVERT - Invert latitudes PICT PICT
  2.6.9  INVERTLEV - Invert levels
  2.6.10  SHIFTXY - Shift field
  2.6.11  MASKREGION - Mask regions
  2.6.12  MASKBOX - Mask a box
  2.6.13  SETBOX - Set a box to constant
  2.6.14  ENLARGE - Enlarge fields
  2.6.15  SETMISS - Set missing value
 2.7  Arithmetic
  2.7.1  EXPR - Evaluate expressions
  2.7.2  MATH - Mathematical functions
  2.7.3  ARITHC - Arithmetic with a constant
  2.7.4  ARITH - Arithmetic on two datasets
  2.7.5  MONARITH - Monthly arithmetic
  2.7.6  YHOURARITH - Multi-year hourly arithmetic
  2.7.7  YDAYARITH - Multi-year daily arithmetic
  2.7.8  YMONARITH - Multi-year monthly arithmetic
  2.7.9  YSEASARITH - Multi-year seasonal arithmetic
  2.7.10  ARITHDAYS - Arithmetic with days
 2.8  Statistical values
  2.8.1  TIMCUMSUM - Cumulative sum over all timesteps
  2.8.2  CONSECSTAT - Consecute timestep periods
  2.8.3  ENSSTAT - Statistical values over an ensemble
  2.8.4  ENSSTAT2 - Statistical values over an ensemble
  2.8.5  ENSVAL - Ensemble validation tools
  2.8.6  FLDSTAT - Statistical values over a field
  2.8.7  ZONSTAT - Zonal statistical values
  2.8.8  MERSTAT - Meridional statistical values
  2.8.9  GRIDBOXSTAT - Statistical values over grid boxes
  2.8.10  VERTSTAT - Vertical statistical values
  2.8.11  TIMSELSTAT - Time range statistical values
  2.8.12  TIMSELPCTL - Time range percentile values
  2.8.13  RUNSTAT - Running statistical values
  2.8.14  RUNPCTL - Running percentile values
  2.8.15  TIMSTAT - Statistical values over all timesteps
  2.8.16  TIMPCTL - Percentile values over all timesteps
  2.8.17  HOURSTAT - Hourly statistical values
  2.8.18  HOURPCTL - Hourly percentile values
  2.8.19  DAYSTAT - Daily statistical values PICT PICT
  2.8.20  DAYPCTL - Daily percentile values
  2.8.21  MONSTAT - Monthly statistical values
  2.8.22  MONPCTL - Monthly percentile values
  2.8.23  YEARMONSTAT - Yearly mean from monthly data
  2.8.24  YEARSTAT - Yearly statistical values
  2.8.25  YEARPCTL - Yearly percentile values
  2.8.26  SEASSTAT - Seasonal statistical values
  2.8.27  SEASPCTL - Seasonal percentile values
  2.8.28  YHOURSTAT - Multi-year hourly statistical values
  2.8.29  YDAYSTAT - Multi-year daily statistical values
  2.8.30  YDAYPCTL - Multi-year daily percentile values
  2.8.31  YMONSTAT - Multi-year monthly statistical values
  2.8.32  YMONPCTL - Multi-year monthly percentile values
  2.8.33  YSEASSTAT - Multi-year seasonal statistical values
  2.8.34  YSEASPCTL - Multi-year seasonal percentile values
  2.8.35  YDRUNSTAT - Multi-year daily running statistical values
  2.8.36  YDRUNPCTL - Multi-year daily running percentile values
 2.9  Correlation and co.
  2.9.1  FLDCOR - Correlation in grid space
  2.9.2  TIMCOR - Correlation over time
  2.9.3  FLDCOVAR - Covariance in grid space
  2.9.4  TIMCOVAR - Covariance over time
 2.10  Regression
  2.10.1  REGRES - Regression
  2.10.2  DETREND - Detrend time series
  2.10.3  TREND - Trend of time series
  2.10.4  SUBTREND - Subtract a trend
 2.11  EOFs
  2.11.1  EOFS - Empirical Orthogonal Functions
  2.11.2  EOFCOEFF - Principal coefficients of EOFs
 2.12  Interpolation
  2.12.1  REMAPBIL - Bilinear interpolation
  2.12.2  REMAPBIC - Bicubic interpolation
  2.12.3  REMAPNN - Nearest neighbor remapping
  2.12.4  REMAPDIS - Distance-weighted average remapping
  2.12.5  REMAPYCON - First order conservative remapping
  2.12.6  REMAPCON - First order conservative remapping
  2.12.7  REMAPCON2 - Second order conservative remapping PICT PICT
  2.12.8  REMAPLAF - Largest area fraction remapping
  2.12.9  REMAP - Grid remapping
  2.12.10  REMAPETA - Remap vertical hybrid level
  2.12.11  VERTINTML - Vertical interpolation
  2.12.12  VERTINTAP - Vertical interpolation
  2.12.13  INTLEVEL - Linear level interpolation
  2.12.14  INTLEVEL3D - Linear level interpolation from/to 3d vertical coordinates
  2.12.15  INTTIME - Time interpolation
  2.12.16  INTYEAR - Year interpolation
 2.13  Transformation
  2.13.1  SPECTRAL - Spectral transformation
  2.13.2  WIND - Wind transformation
 2.14  Import/Export
  2.14.1  IMPORTBINARY - Import binary data sets
  2.14.2  IMPORTCMSAF - Import CM-SAF HDF5 files
  2.14.3  IMPORTAMSR - Import AMSR binary files
  2.14.4  INPUT - Formatted input
  2.14.5  OUTPUT - Formatted output
  2.14.6  OUTPUTTAB - Table output
  2.14.7  OUTPUTGMT - GMT output
 2.15  Miscellaneous
  2.15.1  GRADSDES - GrADS data descriptor file
  2.15.2  AFTERBURNER - ECHAM standard post processor
  2.15.3  FILTER - Time series filtering
  2.15.4  GRIDCELL - Grid cell quantities
  2.15.5  SMOOTH - Smooth grid points
  2.15.6  REPLACEVALUES - Replace variable values
  2.15.7  TIMSORT - Timsort
  2.15.8  VARGEN - Generate a field
  2.15.9  WINDTRANS - Wind Transformation
  2.15.10  ROTUVB - Rotation
  2.15.11  MASTRFU - Mass stream function
  2.15.12  DERIVEPAR - Sea level pressure
  2.15.13  ADISIT - Potential temperature to in-situ temperature and vice versa
  2.15.14  RHOPOT - Calculates potential density
  2.15.15  HISTOGRAM - Histogram
  2.15.16  SETHALO - Set the left and right bounds of a field
  2.15.17  WCT - Windchill temperature PICT PICT
  2.15.18  FDNS - Frost days where no snow index per time period
  2.15.19  STRWIN - Strong wind days index per time period
  2.15.20  STRBRE - Strong breeze days index per time period
  2.15.21  STRGAL - Strong gale days index per time period
  2.15.22  HURR - Hurricane days index per time period
  2.15.23  CMORLITE - CMOR lite
A  Environment Variables
B  Parallelized operators
C  Standard name table
D  Grid description examples
 D.1  Example of a curvilinear grid description
 D.2  Example description for an unstructured grid
  Operator catalog
  Operator list
PICT PICT

1  Introduction

The Climate Data Operators (CDO) software is a collection of many operators for standard processing of climate and forecast model data. The operators include simple statistical and arithmetic functions, data selection and subsampling tools, and spatial interpolation. CDO was developed to have the same set of processing functions for GRIB [GRIB] and NetCDF [NetCDF] datasets in one package.

The Climate Data Interface [CDI] is used for the fast and file format independent access to GRIB and NetCDF datasets. The local MPI-MET data formats SERVICE, EXTRA and IEG are also supported.

There are some limitations for GRIB and NetCDF datasets. A GRIB dataset has to be consistent, similar to NetCDF. That means all time steps need to have the same variables, and within a time step each variable may occur only once. NetCDF datasets are only supported for the classic data model and arrays up to 4 dimensions. These dimensions should only be used by the horizontal and vertical grid and the time. The NetCDF attributes should follow the GDT, COARDS or CF Conventions.

The user interface and some operators are similar to the PINGO [PINGO] package.

The main CDO features are:

  • More than 700 operators available
  • Modular design and easily extendable with new operators
  • Very simple UNIX command line interface
  • A dataset can be processed by several operators, without storing the interim results in files
  • Most operators handle datasets with missing values
  • Fast processing of large datasets
  • Support of many different grid types
  • Tested on many UNIX/Linux systems, Cygwin, and MacOS-X

1.1  Building from sources

This section describes how to build CDO from the sources on a UNIX system. CDO uses the GNU configure and build system for compilation. The only requirement is a working ANSI C99 compiler.

First go to the download page (https://code.zmaw.de/projects/cdo) to get the latest distribution, if you do not have it yet.

To take full advantage of CDO features the following additional libraries should be installed:

  • Unidata NetCDF library (https://www.unidata.ucar.edu/software/netcdf) version 3 or higher.
    This library is needed to process NetCDF [NetCDF] files with CDO.
  • The ECMWF GRIB_API (http://www.ecmwf.int/products/data/software/grib_api.html) version 1.12 or higher. This library is needed to process GRIB2 files with CDO. PICT PICT
  • HDF5 szip library (http://www.hdfgroup.org/doc_resource/SZIP) version 2.1 or higher.
    This library is needed to process szip compressed GRIB [GRIB] files with CDO.
  • HDF5 library (http://www.hdfgroup.org/HDF5) version 1.6 or higher.
    This library is needed to import CM-SAF [CM-SAF] HDF5 files with the CDO operator import_cmsaf.
  • PROJ.4 library (http://trac.osgeo.org/proj) version 4.6 or higher.
    This library is needed to convert Sinusoidal and Lambert Azimuthal Equal Area coordinates to geographic coordinates, for e.g. remapping.
  • Magics library (https://software.ecmwf.int/wiki/display/MAGP/Magics) version 2.18 or higher.
    This library is needed to create contour, vector and graph plots with CDO.

CDO is a multi-threaded application. Therefor all the above libraries should be compiled thread safe. Using non-threadsafe libraries could cause unexpected errors!

1.1.1  Compilation

Compilation is done by performing the following steps:

  1. Unpack the archive, if you haven’t done that yet: PICT PICT
        gunzip cdo-$VERSION.tar.gz    # uncompress the archive  
        tar xf cdo-$VERSION.tar       # unpack it  
        cd cdo-$VERSION

  2. Run the configure script: PICT PICT
        ./configure

    • Optionaly with NetCDF [NetCDF] support: PICT PICT
      ./configure --with-netcdf=<NetCDF root directory>

    • and with GRIB_API: PICT PICT
      ./configure --with-grib_api=<GRIB_API root directory>

    For an overview of other configuration options use PICT PICT

        ./configure --help

  3. Compile the program by running make: PICT PICT
        make

The program should compile without problems and the binary (cdo) should be available in the src directory of the distribution.

1.1.2  Installation

After the compilation of the source code do a make install, possibly as root if the destination permissions require that. PICT PICT

    make install

The binary is installed into the directory <prefix>/bin. <prefix> defaults to /usr/local but can be changed with the –prefix option of the configure script.

Alternatively, you can also copy the binary from the src directory manually to some bin directory in your search path.

1.2  Usage

This section descibes how to use CDO. The syntax is: PICT PICT

   cdo  [ Options ] Operator1 [ -Operator2 [ -OperatorN ] ]

1.2.1  Options

All options have to be placed before the first operator. The following options are available for all operators:

   -a Generate an absolute time axis.

   -b <nbits> Set the number of bits for the output precision. The valid precisions depend

on the file format:



<format> <nbits>
grb1, grb2 P1 - P24
nc1, nc2, nc4, nc4c I8/I16/I32/F32/F64
grb2, srv, ext, ieg F32/F64


For srv, ext and ieg format the letter L or B can be added to set the byteorder

to Little or Big endian.

   - -cmor CMOR conform NetCDF output.

   -C, - -color Colorized output messages.

   -f <format> Set the output file format. The valid file formats are:



File format <format>
GRIB version 1 grb1/grb
GRIB version 2 grb2
NetCDF nc1
NetCDF version 2 (64-bit) nc2/nc
NetCDF-4 (HDF5) nc4
NetCDF-4 classic nc4c
SERVICE srv
EXTRA ext
IEG ieg


GRIB2 is only available if CDO was compiled with GRIB_API support and all

NetCDF file types are only available if CDO was compiled with NetCDF support!

   -g <grid> Define the default grid description by name or from file (see chapter 1.3 on page 30).

Available grid names are: r<NX>x<NY>, lon=<LON>/lat=<LAT>, n<N>, gme<NI>

   -h, - -help Help information for the operators.

   - -no_history Do not append to NetCDF history global attribute.

   - -netcdf_hdr_pad, - -hdr_pad, - -header_pad <nbr>
PICT PICT

   Pad NetCDF output header with nbr bytes.

   -k <chunktype>NetCDF4 chunk type: auto, grid or lines.

   -L Lock I/O (sequential access).

   -M Switch to indicate that the I/O streams have missing values.

   -m <missval> Set the missing value of non NetCDF files (default: -9e+33).

   -O Overwrite existing output file, if checked.

Existing output file is checked only for: ens<STAT>, merge, mergetime

   - -operators List of all operators.

   -P <nthreads> Set number of OpenMP threads (Only available if OpenMP support was compiled in).

   - -percentile <method>

   Percentile method: nrank nist numpy numpy_lower numpy_higher numpy_nearest

   - -reduce_dim Reduce NetCDF dimensions (module: TIMSTAT, FLDSTAT).

   -R, - -regular Convert GRIB1 data from reduced to regular grid (only with cgribex lib).

   -r Generate a relative time axis.

   -S Create an extra output stream for the module TIMSTAT. This stream contains

the number of non missing values for each output period.

   -s, - -silent Silent mode.

   - -sort Alphanumeric sorting of NetCDF parameter names.

   -t <partab> Set the GRIB1 (cgribex) default parameter table name or file (see chapter 1.6 on page 35).

Predefined tables are: echam4 echam5 echam6 mpiom1 ecmwf remo

   - -timestat_date <srcdate>

   Target timestamp (time statistics): first, middle, midhigh or last source timestep.

   -V, - -version Print the version number.

   -v, - -verbose Print extra details for some operators.

   -W Print extra warning messages.

   -z szip SZIP compression of GRIB1 records.

     jpeg JPEG compression of GRIB2 records.

     zip[_1-9] Deflate compression of NetCDF4 variables.

1.2.2  Environment variables

There are some environment variables which influence the behavior of CDO. An incomplete list can be found in Appendix A.

Here is an example to set the envrionment variable CDO_RESET_HISTORY for different shells:

Bourne shell (sh): CDO_RESET_HISTORY=1 ; export CDO_RESET_HISTORY
Korn shell (ksh): export CDO_RESET_HISTORY=1
C shell (csh): setenv CDO_RESET_HISTORY 1
PICT PICT

1.2.3  Operators

There are more than 700 operators available. A detailed description of all operators can be found in the Reference Manual section.

1.2.4  Operator chaining

All operators with a fixed number of input streams and one output stream can pipe the result directly to an other operator. The operator must begin with "–", in order to combine it with others. This can improve the performance by:

  • reducing unnecessary disk I/O
  • parallel processing

Use PICT PICT

   cdo sub -dayavg infile2 -timavg infile1 outfile

instead of PICT PICT

   cdo timavg infile1 tmp1  
   cdo dayavg infile2 tmp2  
   cdo sub tmp2 tmp1 outfile  
   rm tmp1 tmp2

Note: Operator chaining is implemented over POSIX Threads (pthreads). Therefore this CDO feature is not available on operating systems without POSIX Threads support!

All operators with an arbitrary number of input streams (infiles) can’t be combined with other operators if these operators are used with more than one input stream. Here is an incomplete list of these operators: copy, cat, merge, mergetime, select, ens<STAT >
Use single quotes if the input stream names are generated with wildcards. In this case CDO will do the pattern matching and the output can be combined with other operators. Here is an example for this feature: PICT PICT

   cdo timavg -select,name=temperature ’infile?’ outfile

The CDO internal wildcard expansion is using the glob() function. Therefore internal wildcard expansion is not available on operating systems without the glob() function!

All operators with one input stream will process only one input stream! You need to take care when mixing those operators with operator with an arbitrary number of input streams. The following examples illustrate this problem.

  1. cdo info -timavg infile?
  2. cdo info -timavg infile1 infile2
  3. cdo timavg infile1 tmpfile
    cdo info tmpfile infile2

All three examples produce identical results. The time average will be computed only on the first input file.

1.2.5  Parallelized operators

Some of the CDO operators are shared memory parallelized with OpenMP. An OpenMP-enabled C compiler is needed to use this feature. Users may request a specific number of OpenMP threads nthreads with the ’ -P’ switch.

Here is an example to distribute the bilinear interpolation on 8 OpenMP threads:

  cdo -P 8 remapbil,targetgrid infile outfile

Many CDO operators are I/O-bound. This means most of the time is spend in reading and writing the data. Only compute intensive CDO operators are parallelized. An incomplete list of OpenMP parallelized operators can be found in Appendix B.

1.2.6  Operator parameter

Some operators need one or more parameter. A list of parameter is indicated by the seperator ’,’.

  • STRING

    Unquoted characters without blanks and tabs. The following command select variables with the name pressure and tsurf: PICT PICT

       cdo selvar,pressure,tsurf infile outfile

  • FLOAT

    Floating point number in any representation. The following command sets the range between 0 and 273.15 of all fields to missing value: PICT PICT

       cdo setrtomiss,0,273.15 infile outfile

  • INTEGER

    A range of integer parameter can be specified by first/last[/inc]. To select the days 5, 6, 7, 8 and 9 use: PICT PICT

       cdo selday,5/9 infile outfile

    The result is the same as: PICT PICT

       cdo selday,5,6,7,8,9 infile outfile

1.3  Horizontal grids

Physical quantities of climate models are typically stored on a horizonal grid. The maximum number of supported grid cells is 2147483647 (INT_MAX). This corresponds to a global regular lon/lat grid with 65455x32727 grid cells and a global resolution of 0.0055 degree.

1.3.1  Grid area weights

One single point of a horizontal grid represents the mean of a grid cell. These grid cells are typically of different sizes, because the grid points are of varying distance.

Area weights are individual weights for each grid cell. They are needed to compute the area weighted mean or variance of a set of grid cells (e.g. fldmean - the mean value of all grid cells). In CDO the area weights are derived from the grid cell area. If the cell area is not available then it will be computed from the geographical coordinates via spherical triangles. This is only possible if the geographical coordinates of the grid cell corners are available or derivable. Otherwise CDO gives a warning message and uses constant area weights for all grid cells.

The cell area is read automatically from a NetCDF input file if a variable has the corresponding “cell_measures” attribute, e.g.:

var:cell_measures = "area: cell_area" ;

If the computed cell area is not desired then the CDO operator setgridarea can be used to set or overwrite the grid cell area.

1.3.2  Grid description

In the following situations it is necessary to give a description of a horizontal grid:

  • Changing the grid description (operator: setgrid) PICT PICT
  • Horizontal interpolation (all remapping operators)
  • Generating of variables (operator: const, random)

As now described, there are several possibilities to define a horizontal grid.

1.3.2.1. Predefined grids

Predefined grids are available for global regular, gaussian or icosahedral-hexagonal GME grids.

Global regular grid: global_<DXY>

global_<DXY> defines a global regular lon/lat grid. The grid increment <DXY> can be selected at will. The longitudes start at <DXY>/2 - 180 and the latitudes start at <DXY>/2 - 90.

Global regular grid: r<NX>x<NY>

r<NX>x<NY> defines a global regular lon/lat grid. The number of the longitudes <NX> and the latitudes <NY> can be selected at will. The longitudes start at 0 with an increment of (360/<NX>). The latitudes go from south to north with an increment of (180/<NY>).

One grid point: lon=<LON>/lat=<LAT>

lon=<LON>/lat=<LAT> defines a lon/lat grid with only one grid point.

Global Gaussian grid: n<N>

n<N> defines a global Gaussian grid. N specifies the number of latitudes lines between the Pole and the Equator. The longitudes start at 0 with an increment of (360/nlon). The gaussian latitudes go from north to south. PICT PICT

Global icosahedral-hexagonal GME grid: gme<NI>

gme<NI> defines a global icosahedral-hexagonal GME grid. NI specifies the number of intervals on a main triangle side.

1.3.2.2. Grids from data files

You can use the grid description from an other datafile. The format of the datafile and the grid of the data field must be supported by CDO . Use the operator ’sinfo’ to get short informations about your variables and the grids. If there are more then one grid in the datafile the grid description of the first variable will be used.

1.3.2.3. SCRIP grids

SCRIP (Spherical Coordinate Remapping and Interpolation Package) uses a common grid description for curvilinear and unstructured grids. For more information about the convention see [SCRIP]. This grid description is stored in NetCDF. Therefor it is only available if CDO was compiled with NetCDF support!

SCRIP grid description example of a curvilinear MPIOM [MPIOM] GROB3 grid (only the NetCDF header):

    netcdf grob3s { 
    dimensions: 
            grid_size = 12120 ; 
            grid_xsize = 120 ; 
            grid_ysize = 101 ; 
            grid_corners = 4 ; 
            grid_rank = 2 ; 
    variables: 
            int grid_dims(grid_rank) ; 
            float grid_center_lat(grid_ysize, grid_xsize) ; 
                    grid_center_lat:units = "degrees" ; 
                    grid_center_lat:bounds = "grid_corner_lat" ; 
            float grid_center_lon(grid_ysize, grid_xsize) ; 
                    grid_center_lon:units = "degrees" ; 
                    grid_center_lon:bounds = "grid_corner_lon" ; 
            int grid_imask(grid_ysize, grid_xsize) ; 
                    grid_imask:units = "unitless" ; 
                    grid_imask:coordinates = "grid_center_lon grid_center_lat" ; 
            float grid_corner_lat(grid_ysize, grid_xsize, grid_corners) ; 
                    grid_corner_lat:units = "degrees" ; 
            float grid_corner_lon(grid_ysize, grid_xsize, grid_corners) ; 
                    grid_corner_lon:units = "degrees" ; 
 
    // global attributes: 
                    :title = "grob3s" ; 
    }

1.3.2.4. CDO grids

All supported grids can also be described with the CDO grid description. The following keywords can be used to describe a grid:

Keyword Datatype Description



gridtype STRING Type of the grid (gaussian, lonlat, curvilinear, unstructured).
gridsize INTEGER Size of the grid.
xsize INTEGER Size in x direction (number of longitudes).
ysize INTEGER Size in y direction (number of latitudes).
xvals FLOAT ARRAY X values of the grid cell center.
yvals FLOAT ARRAY Y values of the grid cell center.
nvertex INTEGER Number of the vertices for all grid cells.
xbounds FLOAT ARRAY X bounds of each gridbox.
ybounds FLOAT ARRAY Y bounds of each gridbox.
xfirst, xinc FLOAT, FLOAT Macros to define xvals with a constant increment,
xfirst is the x value of the first grid cell center.
yfirst, yinc FLOAT, FLOAT Macros to define yvals with a constant increment,
yfirst is the y value of the first grid cell center.
xunits STRING units of the x axis
yunits STRING units of the y axis
PICT PICT

Which keywords are necessary depends on the gridtype. The following table gives an overview of the default values or the size with respect to the different grid types.

     







gridtype lonlat gaussian projection curvilinear unstructured






gridsize xsize*ysize xsize*ysize xsize*ysize xsize*ysize ncell






xsize nlon nlon nx nlon gridsize






ysize nlat nlat ny nlat gridsize






xvals xsize xsize xsize gridsize gridsize






yvals ysize ysize ysize gridsize gridsize






nvertex 2 2 2 4 nv






xbounds 2*xsize 2*xsize 2*xsize 4*gridsize nv*gridsize






ybounds 2*ysize 2*ysize 2*xsize 4*gridsize nv*gridsize






xunits degrees degrees m degrees degrees






yunits degrees degrees m degrees degrees






The keywords nvertex, xbounds and ybounds are optional if area weights are not needed. The grid cell corners xbounds and ybounds have to rotate counterclockwise.

CDO grid description example of a T21 gaussian grid:

    gridtype = gaussian 
    xsize    = 64 
    ysize    = 32 
    xfirst   =  0 
    xinc     = 5.625 
    yvals    = 85.76  80.27  74.75  69.21  63.68  58.14  52.61  47.07 
               41.53  36.00  30.46  24.92  19.38  13.84   8.31   2.77 
               -2.77  -8.31 -13.84 -19.38 -24.92 -30.46 -36.00 -41.53 
              -47.07 -52.61 -58.14 -63.68 -69.21 -74.75 -80.27 -85.76

CDO grid description example of a global regular grid with 60x30 points:

    gridtype = lonlat 
    xsize    =   60 
    ysize    =   30 
    xfirst   = -177 
    xinc     =    6 
    yfirst   =  -87 
    yinc     =    6

CDO grid description example of a regional rotated lon/lat grid:

   gridtype = projection 
   xsize    = 81 
   ysize    = 91 
   xunits   = "degrees" 
   yunits   = "degrees" 
   xfirst   =  -19.5 
   xinc     =    0.5 
   yfirst   =  -25.0 
   yinc     =    0.5 
   grid_mapping_name = rotated_latitude_longitude 
   grid_north_pole_longitude = -170 
   grid_north_pole_latitude = 32.5

Example CDO descriptions of a curvilinear and an unstructured grid can be found in Appendix C.

1.4  Z-axis description

Sometimes it is necessary to change the description of a z-axis. This can be done with the operator setzaxis. This operator needs an ASCII formatted file with the description of the z-axis. The following keywords can be used to describe a z-axis:

Keyword Datatype Description



zaxistype STRING type of the z-axis
size INTEGER number of levels
levels FLOAT ARRAY values of the levels
lbounds FLOAT ARRAY lower level bounds
ubounds FLOAT ARRAY upper level bounds
vctsize INTEGER number of vertical coordinate parameters
vct FLOAT ARRAY vertical coordinate table
PICT PICT

The keywords lbounds and ubounds are optional. vctsize and vct are only necessary to define hybrid model levels.

Available z-axis types:

Z-axis type Description Units



surface Surface
pressure Pressure level pascal
hybrid Hybrid model level
height Height above ground meter
depth_below_sea Depth below sea level meter
depth_below_land Depth below land surface centimeter
isentropic Isentropic (theta) level kelvin

Z-axis description example for pressure levels 100, 200, 500, 850 and 1000 hPa:

    zaxistype = pressure 
    size      = 5 
    levels    = 10000 20000 50000 85000 100000

Z-axis description example for ECHAM5 L19 hybrid model levels:

    zaxistype = hybrid 
    size      = 19 
    levels    = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 
    vctsize   = 40 
    vct       = 0 2000 4000 6046.10938 8267.92578 10609.5117 12851.1016 14698.5 
                15861.125 16116.2383 15356.9258 13621.4609 11101.5625 8127.14453 
                5125.14062 2549.96875 783.195068 0 0 0 
                0 0 0 0.000338993268 0.00335718691 0.0130700432 0.0340771675 
                0.0706498027 0.12591666 0.201195419 0.295519829 0.405408859 
                0.524931908 0.646107674 0.759697914 0.856437683 0.928747177 
                0.972985268 0.992281914 1

Note that the vctsize is twice the number of levels plus two and the vertical coordinate table must be specified for the level interfaces.

1.5  Time axis

A time axis describes the time for every timestep. Two time axis types are available: absolute time and relative time axis. CDO tries to maintain the actual type of the time axis for all operators.

1.5.1  Absolute time

An absolute time axis has the current time to each time step. It can be used without knowledge of the calendar. This is preferably used by climate models. In NetCDF files the absolute time axis is represented by the unit of the time: "day as %Y%m%d.%f".

1.5.2  Relative time

PICT PICT

A relative time is the time relative to a fixed reference time. The current time results from the reference time and the elapsed interval. The result depends on the calendar used. CDO supports the standard Gregorian, proleptic Gregorian, 360 days, 365 days and 366 days calendars. The relative time axis is preferably used by numerical weather prediction models. In NetCDF files the relative time axis is represented by the unit of the time: "time-units since reference-time", e.g "days since 1989-6-15 12:00".

1.5.3  Conversion of the time

Some programs which work with NetCDF data can only process relative time axes. Therefore it may be necessary to convert from an absolute into a relative time axis. This conversion can be done for each operator with the CDO option ’-r’. To convert a relative into an absolute time axis use the CDO option ’-a’.

1.6  Parameter table

A parameter table is an ASCII formated file to convert code numbers to variable names. Each variable has one line with its code number, name and a description with optional units in a blank separated list. It can only be used for GRIB, SERVICE, EXTRA and IEG formated files. The CDO option ’-t <partab>’ sets the default parameter table for all input files. Use the operator ’setpartab’ to set the parameter table for a specific file.

Example of a CDO parameter table:

    134  aps      surface pressure [Pa] 
    141  sn       snow depth [m] 
    147  ahfl     latent heat flux [W/m**2] 
    172  slm      land sea mask 
    175  albedo   surface albedo 
    211  siced    ice depth [m]

1.7  Missing values

Most operators can handle missing values. The default missing value for GRIB, SERVICE, EXTRA and IEG files is -9.e33. The CDO option ’-m <missval>’ overwrites the default missing value. In NetCDF files the variable attribute ’_FillValue’ is used as a missing value. The operator ’setmissval’ can be used to set a new missing value.

The CDO use of the missing value is shown in the following tables, where one table is printed for each operation. The operations are applied to arbitrary numbers a, b, the special case 0, and the missing value miss. For example the table named "addition" shows that the sum of an arbitrary number a and the missing value is the missing value, and the table named "multiplication" shows that 0 multiplied by missing value results in 0. PICT PICT

     





addition b miss




a a + b miss




miss miss miss








subtraction b miss




a a - b miss




miss miss miss








multiplication b 0 miss




a a * b 0 miss




0 0 0 0




miss miss 0 miss








division b 0 miss




a a∕b miss miss




0 0 miss miss




miss miss miss miss








maximum b miss




a max(a,b) a




miss b miss








minimum b miss




a min(a,b) a




miss b miss








sum b miss




a a + b a




miss b miss




The handling of missing values by the operations "minimum" and "maximum" may be surprising, but the definition given here is more consistent with that expected in practice. Mathematical functions (e.g. log, sqrt, etc.) return the missing value if an argument is the missing value or an argument is out of range.

All statistical functions ignore missing values, treading them as not belonging to the sample, with the side-effect of a reduced sample size.

1.7.1  Mean and average

An artificial distinction is made between the notions mean and average. The mean is regarded as a statistical function, whereas the average is found simply by adding the sample members and dividing the result by the sample size. For example, the mean of 1, 2, miss and 3 is (1 + 2 + 3)3 = 2, whereas the average is (1 + 2 + miss + 3)4 = miss∕4 = miss. If there are no missing values in the sample, the average and mean are identical.

1.8  Percentile

There is no standard definition of percentile. All definitions yield to similar results when the number of values is very large. The following percentile methods are available in CDO:

     



Percentile
method
Description


nrank Nearest Rank method, the default method used in CDO


nist The primary method recommended by NIST


numpy numpy.percentile with the option interpolation set to ’linear’


numpy_lower numpy.percentile with the option interpolation set to ’lower’


numpy_higher numpy.percentile with the option interpolation set to ’higher’


numpy_nearest numpy.percentile with the option interpolation set to ’nearest’


The percentile method can be selected with the CDO option --percentile. The Nearest Rank method is the default percentile method in CDO. PICT PICT

The different percentile methods can lead to different results, especially for small number of data values. Consider the ordered list {15, 20, 35, 40, 50, 55}, which contains six data values. Here is the result for the 30th, 40th, 50th, 75th and 100th percentiles of this list using the different percentile methods:

     








Percentile numpy numpy numpy
P
nrank
nist
numpy
lower higher nearest







30th 20 21.5 27.5 20 35 35







40th 35 32 35 35 35 35







50th 35 37.5 37.5 35 40 40







75th 50 51.25 47.5 40 50 50







100th 55 55 55 55 55 55







1.8.1  Percentile over timesteps

The amount of data for time series can be very large. All data values need to held in memory to calculate the percentile. The percentile over timesteps uses a histogram algorithm, to limit the amount of required memory. The default number of histogram bins is 101. That means the histogram algorithm is used, when the dataset has more than 101 time steps. The default can be overridden by setting the environment variable CDO_PCTL_NBINS to a different value. The histogram algorithm is implemented only for the Nearest Rank method. PICT PICT

2  Reference manual

This section gives a description of all operators. Related operators are grouped to modules. For easier description all single input files are named infile or infile1, infile2, etc., and an arbitrary number of input files are named infiles. All output files are named outfile or outfile1, outfile2, etc. Further the following notion is introduced:

i(t)

Timestep t  of infile

i(t,x)

Element number x  of the field at timestep t  of infile

o(t)

Timestep t  of outfile

o(t,x )

Element number x  of the field at timestep t  of outfile

PICT PICT

2.1  Information

This section contains modules to print information about datasets. All operators print there results to standard output.

Here is a short overview of all operators in this section:

  info Dataset information listed by parameter identifier
  infon Dataset information listed by parameter name
  map Dataset information and simple map

  sinfo Short information listed by parameter identifier
  sinfon Short information listed by parameter name

  diff Compare two datasets listed by parameter id
  diffn Compare two datasets listed by parameter name

  npar Number of parameters
  nlevel Number of levels
  nyear Number of years
  nmon Number of months
  ndate Number of dates
  ntime Number of timesteps
  ngridpoints Number of gridpoints
  ngrids Number of horizontal grids

  showformat Show file format
  showcode Show code numbers
  showname Show variable names
  showstdname Show standard names
  showlevel Show levels
  showltype Show GRIB level types
  showyear Show years
  showmon Show months
  showdate Show date information
  showtime Show time information
  showtimestamp Show timestamp

  partab Parameter table
  codetab Parameter code table
  griddes Grid description
  zaxisdes Z-axis description
  vct Vertical coordinate table

PICT PICT

2.1.1  INFO - Information and simple statistics

Synopsis

   <operator>  infiles

Description

This module writes information about the structure and contents of all input files to standard output. All input files need to have the same structure with the same variables on different timesteps. The information displayed depends on the chosen operator.

Operators

info  

Dataset information listed by parameter identifier
Prints information and simple statistics for each field of all input datasets. For each field the operator prints one line with the following elements:

  • Date and Time
  • Level, Gridsize and number of Missing values
  • Minimum, Mean and Maximum
    The mean value is computed without the use of area weights!
  • Parameter identifier
infon  

Dataset information listed by parameter name
The same as operator info but using the name instead of the identifier to label the parameter. PICT PICT

map  

Dataset information and simple map
Prints information, simple statistics and a map for each field of all input datasets. The map will be printed only for fields on a regular lon/lat grid.

Example

To print information and simple statistics for each field of a dataset use:

  cdo infon infile

This is an example result of a dataset with one 2D parameter over 12 timesteps:

   -1 :       Date     Time Level  Size  Miss : Minimum    Mean Maximum : Name 
    1 : 1987-01-31 12:00:00     0  2048  1361 :  232.77  266.65  305.31 : SST 
    2 : 1987-02-28 12:00:00     0  2048  1361 :  233.64  267.11  307.15 : SST 
    3 : 1987-03-31 12:00:00     0  2048  1361 :  225.31  267.52  307.67 : SST 
    4 : 1987-04-30 12:00:00     0  2048  1361 :  215.68  268.65  310.47 : SST 
    5 : 1987-05-31 12:00:00     0  2048  1361 :  215.78  271.53  312.49 : SST 
    6 : 1987-06-30 12:00:00     0  2048  1361 :  212.89  272.80  314.18 : SST 
    7 : 1987-07-31 12:00:00     0  2048  1361 :  209.52  274.29  316.34 : SST 
    8 : 1987-08-31 12:00:00     0  2048  1361 :  210.48  274.41  315.83 : SST 
    9 : 1987-09-30 12:00:00     0  2048  1361 :  210.48  272.37  312.86 : SST 
   10 : 1987-10-31 12:00:00     0  2048  1361 :  219.46  270.53  309.51 : SST 
   11 : 1987-11-30 12:00:00     0  2048  1361 :  230.98  269.85  308.61 : SST 
   12 : 1987-12-31 12:00:00     0  2048  1361 :  241.25  269.94  309.27 : SST

PICT PICT

2.1.2  SINFO - Short information

Synopsis

   <operator>  infiles

Description

This module writes information about the structure of infiles to standard output. infiles is an arbitrary number of input files. All input files need to have the same structure with the same variables on different timesteps. The information displayed depends on the chosen operator.

Operators

sinfo  

Short information listed by parameter identifier
Prints short information of a dataset. The information is divided into 4 sections. Section 1 prints one line per parameter with the following information:

  • institute and source
  • timestep type
  • number of levels and z-axis number
  • horizontal grid size and number
  • data type
  • parameter identifier

Section 2 and 3 gives a short overview of all grid and vertical coordinates. And the last section contains short information of the time coordinate. PICT PICT

sinfon  

Short information listed by parameter name
The same as operator sinfo but using the name instead of the identifier to label the parameter.

Example

To print short information of a dataset use:

  cdo sinfon infile

This is the result of an ECHAM5 dataset with 3 parameter over 12 timesteps:

    -1 : Institut Source  Steptype Levels Num   Points Num Dtype : Name 
     1 : MPIMET   ECHAM5  constant      1   1     2048   1  F32  : GEOSP 
     2 : MPIMET   ECHAM5  instant       4   2     2048   1  F32  : T 
     3 : MPIMET   ECHAM5  instant       1   1     2048   1  F32  : TSURF 
   Grid coordinates : 
     1 : gaussian              : points=2048 (64x32)  np=16 
                     longitude : 0 to 354.375 by 5.625 degrees_east  circular 
                      latitude : 85.7606 to -85.7606 degrees_north 
   Vertical coordinates : 
     1 : surface               : levels=1 
     2 : pressure              : levels=4 
                         level : 92500 to 20000 Pa 
   Time coordinate :  12 steps 
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss 
1987-01-31 12:00:00 1987-02-28 12:00:00 1987-03-31 12:00:00 1987-04-30 12:00:00 
1987-05-31 12:00:00 1987-06-30 12:00:00 1987-07-31 12:00:00 1987-08-31 12:00:00 
1987-09-30 12:00:00 1987-10-31 12:00:00 1987-11-30 12:00:00 1987-12-31 12:00:00

PICT PICT

2.1.3  DIFF - Compare two datasets field by field

Synopsis

   <operator>  infile1 infile2

Description

Compares the contents of two datasets field by field. The input datasets need to have the same structure and its fields need to have the same header information and dimensions.

Operators

diff  

Compare two datasets listed by parameter id
Provides statistics on differences between two datasets. For each pair of fields the operator prints one line with the following information:

  • Date and Time
  • Level, Gridsize and number of Missing values
  • Number of different values
  • Occurrence of coefficient pairs with different signs (S)
  • Occurrence of zero values (Z)
  • Maxima of absolute difference of coefficient pairs
  • Maxima of relative difference of non-zero coefficient pairs with equal signs PICT PICT
  • Parameter identifier
Absdif f(t,x) = |i_1 (t,x)- i_2(t,x)|

                |i_1 (t,x)- i_2(t,x)|
Reldiff(t,x) = max(|i_1-(t,x)|,|i_2(t,x)|)

diffn  

Compare two datasets listed by parameter name
The same as operator diff. Using the name instead of the identifier to label the parameter.

Example

To print the difference for each field of two datasets use:

  cdo diffn infile1 infile2

This is an example result of two datasets with one 2D parameter over 12 timesteps:

           Date   Time Level Size Miss Diff : S Z Max_Absdiff Max_Reldiff : Name 
 1 : 1987-01-31 12:00:00   0 2048 1361  273 : F F  0.00010681  4.1660e-07 : SST 
 2 : 1987-02-28 12:00:00   0 2048 1361  309 : F F  6.1035e-05  2.3742e-07 : SST 
 3 : 1987-03-31 12:00:00   0 2048 1361  292 : F F  7.6294e-05  3.3784e-07 : SST 
 4 : 1987-04-30 12:00:00   0 2048 1361  183 : F F  7.6294e-05  3.5117e-07 : SST 
 5 : 1987-05-31 12:00:00   0 2048 1361  207 : F F  0.00010681  4.0307e-07 : SST 
 7 : 1987-07-31 12:00:00   0 2048 1361  317 : F F  9.1553e-05  3.5634e-07 : SST 
 8 : 1987-08-31 12:00:00   0 2048 1361  219 : F F  7.6294e-05  2.8849e-07 : SST 
 9 : 1987-09-30 12:00:00   0 2048 1361  188 : F F  7.6294e-05  3.6168e-07 : SST 
10 : 1987-10-31 12:00:00   0 2048 1361  297 : F F  9.1553e-05  3.5001e-07 : SST 
11 : 1987-11-30 12:00:00   0 2048 1361  234 : F F  6.1035e-05  2.3839e-07 : SST 
12 : 1987-12-31 12:00:00   0 2048 1361  267 : F F  9.3553e-05  3.7624e-07 : SST 
11 of 12 records differ

PICT PICT

2.1.4  NINFO - Print the number of parameters, levels or times

Synopsis

   <operator>  infile

Description

This module prints the number of variables, levels or times of the input dataset.

Operators

npar  

Number of parameters
Prints the number of parameters (variables).

nlevel  

Number of levels
Prints the number of levels for each variable.

nyear  

Number of years
Prints the number of different years.

nmon  

Number of months
Prints the number of different combinations of years and months. PICT PICT

ndate  

Number of dates
Prints the number of different dates.

ntime  

Number of timesteps
Prints the number of timesteps.

ngridpoints  

Number of gridpoints
Prints the number of gridpoints for each variable.

ngrids  

Number of horizontal grids
Prints the number of horizontal grids.

Example

To print the number of parameters (variables) in a dataset use:

  cdo npar infile

To print the number of months in a dataset use:

  cdo nmon infile

PICT PICT

2.1.5  SHOWINFO - Show variables, levels or times

Synopsis

   <operator>  infile

Description

This module prints the format, variables, levels or times of the input dataset.

Operators

showformat  

Show file format
Prints the file format of the input dataset.

showcode  

Show code numbers
Prints the code number of all variables.

showname  

Show variable names
Prints the name of all variables. PICT PICT

showstdname  

Show standard names
Prints the standard name of all variables.

showlevel  

Show levels
Prints all levels for each variable.

showltype  

Show GRIB level types
Prints the GRIB level type for all z-axes.

showyear  

Show years
Prints all years.

showmon  

Show months
Prints all months.

showdate  

Show date information
Prints date information of all timesteps (format YYYY-MM-DD).

showtime  

Show time information
Prints time information of all timesteps (format hh:mm:ss).

showtimestamp  

Show timestamp
Prints timestamp of all timesteps (format YYYY-MM-DDThh:mm:ss).

Example

To print the code number of all variables in a dataset use:

  cdo showcode infile

This is an example result of a dataset with three variables:

   129 130 139 PICT PICT

To print all months in a dataset use:

  cdo showmon infile

This is an examples result of a dataset with an annual cycle:

   1 2 3 4 5 6 7 8 9 10 11 12

PICT PICT

2.1.6  FILEDES - Dataset description

Synopsis

   <operator>  infile

Description

This module provides operators to print meta information about a dataset. The printed meta-data depends on the chosen operator.

Operators

partab  

Parameter table
Prints all available meta information of the variables.

codetab  

Parameter code table
Prints a code table with a description of all variables. For each variable the operator prints one line listing the code, name, description and units.

griddes  

Grid description
Prints the description of all grids.

zaxisdes  

Z-axis description
Prints the description of all z-axes. PICT PICT

vct  

Vertical coordinate table
Prints the vertical coordinate table.

Example

Assume all variables of the dataset are on a Gausssian N16 grid. To print the grid description of this dataset use:

  cdo griddes infile

Result:

   gridtype  : gaussian 
   gridsize  : 2048 
   xname     : lon 
   xlongname : longitude 
   xunits    : degrees_east 
   yname     : lat 
   ylongname : latitude 
   yunits    : degrees_north 
   xsize     : 64 
   ysize     : 32 
   xfirst    : 0 
   xinc      : 5.625 
   yvals     : 85.76058 80.26877 74.74454 69.21297 63.67863 58.1429 52.6065 
               47.06964 41.53246 35.99507 30.4575 24.91992 19.38223 13.84448 
               8.306702 2.768903 -2.768903 -8.306702 -13.84448 -19.38223 
               -24.91992 -30.4575 -35.99507 -41.53246 -47.06964 -52.6065 
               -58.1429 -63.67863 -69.21297 -74.74454 -80.26877 -85.76058

PICT PICT

2.2  File operations

This section contains modules to perform operations on files.

Here is a short overview of all operators in this section:

  copy Copy datasets
  cat Concatenate datasets

  replace Replace variables

  duplicate Duplicates a dataset

  mergegrid Merge grid

  merge Merge datasets with different fields
  mergetime Merge datasets sorted by date and time

  splitcode Split code numbers
  splitparam Split parameter identifiers
  splitname Split variable names
  splitlevel Split levels
  splitgrid Split grids
  splitzaxis Split z-axes
  splittabnum Split parameter table numbers

  splithour Split hours
  splitday Split days
  splitseas Split seasons
  splityear Split years
  splityearmon Split in years and months
  splitmon Split months

  splitsel Split time selection

  distgrid Distribute horizontal grid

  collgrid Collect horizontal grid

PICT PICT

2.2.1  COPY - Copy datasets

Synopsis

   <operator>  infiles outfile

Description

This module contains operators to copy or concatenate datasets. infiles is an arbitrary number of input files. All input files need to have the same structure with the same variables on different timesteps.

Operators

copy  

Copy datasets
Copies all input datasets to outfile.

cat  

Concatenate datasets
Concatenates all input datasets and appends the result to the end of outfile. If outfile does not exist it will be created.

Example

To change the format of a dataset to NetCDF use:

  cdo -f nc copy infile outfile.nc PICT PICT

Add the option ’-r’ to create a relative time axis, as is required for proper recognition by GrADS or Ferret:

  cdo -r -f nc copy infile outfile.nc

To concatenate 3 datasets with different timesteps of the same variables use:

  cdo copy infile1 infile2 infile3 outfile

If the output dataset already exists and you wish to extend it with more timesteps use:

  cdo cat infile1 infile2 infile3 outfile

PICT PICT

2.2.2  REPLACE - Replace variables

Synopsis

   replace  infile1 infile2 outfile

Description

The replace operator replaces variables in infile1 by variables from infile2 and write the result to outfile. Both input datasets need to have the same number of timesteps.

Example

Assume the first input dataset infile1 has three variables with the names geosp, t and tslm1 and the second input dataset infile2 has only the variable tslm1. To replace the variable tslm1 in infile1 by tslm1 from infile2 use:

  cdo replace infile1 infile2 outfile

2.2.3  DUPLICATE - Duplicates a dataset

Synopsis

   duplicate[,ndup]  infile outfile PICT PICT

Description

This operator duplicates the contents of infile and writes the result to outfile. The optional parameter sets the number of duplicates, the default is 2.

Parameter

ndup  

INTEGER Number of duplicates, default is 2.

2.2.4  MERGEGRID - Merge grid

Synopsis

   mergegrid  infile1 infile2 outfile

Description

Merges grid points of all variables from infile2 to infile1 and write the result to outfile. Only the non missing values of infile2 will be used. The horizontal grid of infile2 should be smaller or equal to the grid of infile1 and the resolution must be the same. Only rectilinear grids are supported. Both input files need to have the same variables and the same number of timesteps.

PICT PICT

2.2.5  MERGE - Merge datasets

Synopsis

   <operator>  infiles outfile

Description

This module reads datasets from several input files, merges them and writes the resulting dataset to outfile.

Operators

merge  

Merge datasets with different fields
Merges time series of different fields from several input datasets. The number of fields per timestep written to outfile is the sum of the field numbers per timestep in all input datasets. The time series on all input datasets are required to have different fields and the same number of timesteps. The fields in each different input file either have to be different variables or different levels of the same variable. A mixture of different variables on different levels in different input files is not allowed.

mergetime  

Merge datasets sorted by date and time
Merges all timesteps of all input files sorted by date and time. All input files need to have the same structure with the same variables on different timesteps. After this operation every input timestep is in outfile and all timesteps are sorted by date and time.

PICT PICT

Environment

SKIP_SAME_TIME  

If set to 1, skips all consecutive timesteps with a double entry of the same timestamp.

Note

The operators in this module need to open all input files simultaneously. The maximum number of open files depends on the operating system!

Example

Assume three datasets with the same number of timesteps and different variables in each dataset. To merge these datasets to a new dataset use:

  cdo merge infile1 infile2 infile3 outfile

Assume you split a 6 hourly dataset with splithour. This produces four datasets, one for each hour. The following command merges them together:

  cdo mergetime infile1 infile2 infile3 infile4 outfile

PICT PICT

2.2.6  SPLIT - Split a dataset

Synopsis

   <operator>[,params]  infile obase

Description

This module splits infile into pieces. The output files will be named <obase><xxx><suffix> where suffix is the filename extension derived from the file format. xxx and the contents of the output files depends on the chosen operator. params is a comma separated list of processing parameters.

Operators

splitcode  

Split code numbers
Splits a dataset into pieces, one for each different code number. xxx will have three digits with the code number.

splitparam  

Split parameter identifiers
Splits a dataset into pieces, one for each different parameter identifier. xxx will be a string with the parameter identifier.

splitname  

Split variable names
Splits a dataset into pieces, one for each variable name. xxx will be a string with the variable name. PICT PICT

splitlevel  

Split levels
Splits a dataset into pieces, one for each different level. xxx will have six digits with the level.

splitgrid  

Split grids
Splits a dataset into pieces, one for each different grid. xxx will have two digits with the grid number.

splitzaxis  

Split z-axes
Splits a dataset into pieces, one for each different z-axis. xxx will have two digits with the z-axis number.

splittabnum  

Split parameter table numbers
Splits a dataset into pieces, one for each GRIB1 parameter table number. xxx will have three digits with the GRIB1 parameter table number.

Parameter

swap  

STRING Swap the position of obase and xxx in the output filename

uuid=<attname>  

STRING Add a UUID as global attribute <attname> to each output file

Environment

CDO_FILE_SUFFIX  

Set the default file suffix. This suffix will be added to the output file names instead of the filename extension derived from the file format. Set this variable to NULL to disable the adding of a file suffix.

PICT PICT

Note

The operators in this module need to open all output files simultaneously. The maximum number of open files depends on the operating system!

Example

Assume an input GRIB1 dataset with three variables, e.g. code number 129, 130 and 139. To split this dataset into three pieces, one for each code number use:

  cdo splitcode infile code

Result of ’dir code*’:

   code129.grb code130.grb code139.grb

PICT PICT

2.2.7  SPLITTIME - Split timesteps of a dataset

Synopsis

   <operator>  infile obase

   splitmon[,format]  infile obase

Description

This module splits infile into timesteps pieces. The output files will be named <obase><xxx><suffix> where suffix is the filename extension derived from the file format. xxx and the contents of the output files depends on the chosen operator.

Operators

splithour  

Split hours
Splits a file into pieces, one for each different hour. xxx will have two digits with the hour.

splitday  

Split days
Splits a file into pieces, one for each different day. xxx will have two digits with the day.

splitseas  

Split seasons
Splits a file into pieces, one for each different season. xxx will have three characters with the season. PICT PICT

splityear  

Split years
Splits a file into pieces, one for each different year. xxx will have four digits with the year (YYYY).

splityearmon  

Split in years and months
Splits a file into pieces, one for each different year and month. xxx will have six digits with the year and month (YYYYMM).

splitmon  

Split months
Splits a file into pieces, one for each different month. xxx will have two digits with the month.

Parameter

format  

STRING C-style format for strftime() (e.g. %B for the full month name)

Environment

CDO_FILE_SUFFIX  

Set the default file suffix. This suffix will be added to the output file names instead of the filename extension derived from the file format. Set this variable to NULL to disable the adding of a file suffix.

Note

The operators in this module need to open all output files simultaneously. The maximum number of open files depends on the operating system! PICT PICT

Example

Assume the input GRIB1 dataset has timesteps from January to December. To split each month with all variables into one separate file use:

  cdo splitmon infile mon

Result of ’dir mon*’:

   mon01.grb  mon02.grb  mon03.grb  mon04.grb  mon05.grb  mon06.grb 
   mon07.grb  mon08.grb  mon09.grb  mon10.grb  mon11.grb  mon12.grb

2.2.8  SPLITSEL - Split selected timesteps

Synopsis

   splitsel,nsets[,noffset[,nskip]]  infile obase

Description

This operator splits infile into pieces, one for each adjacent sequence t_1,....,t_n of timesteps of the same selected time range. The output files will be named <obase><nnnnnn><suffix> where nnnnnn is the sequence number and suffix is the filename extension derived from the file format.

Parameter

PICT PICT

nsets  

INTEGER Number of input timesteps for each output file

noffset  

INTEGER Number of input timesteps skipped before the first timestep range (optional)

nskip  

INTEGER Number of input timesteps skipped between timestep ranges (optional)

Environment

CDO_FILE_SUFFIX  

Set the default file suffix. This suffix will be added to the output file names instead of the filename extension derived from the file format. Set this variable to NULL to disable the adding of a file suffix.

PICT PICT

2.2.9  DISTGRID - Distribute horizontal grid

Synopsis

   distgrid,nx[,ny]  infile obase

Description

This operator distributes a dataset into smaller pieces. Each output file contains a different region of the horizontal source grid. A target grid region contains a structured longitude/latitude box of the source grid. Only rectilinear and curvilinear source grids are supported by this operator. The number of different regions can be specified with the parameter nx and ny. The output files will be named <obase><xxx><suffix> where suffix is the filename extension derived from the file format. xxx will have five digits with the number of the target region.

Parameter

nx  

INTEGER Number of regions in x direction

ny  

INTEGER Number of regions in y direction [default: 1]

Note

This operator needs to open all output files simultaneously. The maximum number of open files depends on the operating system! PICT PICT

Example

Distribute a file into 6 smaller files, each output file receives one half of x and a third of y of the source grid:

  cdo distgrid,2,3 infile.nc obase

Below is a schematic illustration of this example:

PIC

On the left side is the data of the input file and on the right side is the data of the six output files.

PICT PICT

2.2.10  COLLGRID - Collect horizontal grid

Synopsis

   collgrid[,nx[,names]]  infiles outfile

Description

This operator collects the data of the input files to one output file. All input files need to have the same variables and the same number of timesteps on a different horizonal grid region. A source region must be a structured longitude/latitude grid box. The parameter nx needs to be specified only for non regular lon/lat grids.

Parameter

nx  

INTEGER Number of regions in x direction [default: number of input files]

names  

STRING Comma separated list of variable names [default: all variables]

Note

This operator needs to open all input files simultaneously. The maximum number of open files depends on the operating system! PICT PICT

Example

Collect the horizonal grid of 6 input files. Each input file contains a lon/lat region of the target grid:

  cdo collgrid infile[1-6] outfile

Below is a schematic illustration of this example:

PIC

On the left side is the data of the six input files and on the right side is the collected data of the output file.

PICT PICT

2.3  Selection

This section contains modules to select time steps, fields or a part of a field from a dataset.

Here is a short overview of all operators in this section:

  select Select fields
  delete Delete fields

  selmulti Select multiple fields
  delmulti Delete multiple fields
  changemulti Change identication of multiple fields

  selparam Select parameters by identifier
  delparam Delete parameters by identifier
  selcode Select parameters by code number
  delcode Delete parameters by code number
  selname Select parameters by name
  delname Delete parameters by name
  selstdname Select parameters by standard name
  sellevel Select levels
  sellevidx Select levels by index
  selgrid Select grids
  selzaxis Select z-axes
  selzaxisname Select z-axes by name
  selltype Select GRIB level types
  seltabnum Select parameter table numbers

  seltimestep Select timesteps
  seltime Select times
  selhour Select hours
  selday Select days
  selmonth Select months
  selyear Select years
  selseason Select seasons
  seldate Select dates
  selsmon Select single month

  sellonlatbox Select a longitude/latitude box
  selindexbox Select an index box

  selgridcell Select grid cells
  delgridcell Delete grid cells

  samplegrid Resample grid

PICT PICT

2.3.1  SELECT - Select fields

Synopsis

   <operator>,params  infiles outfile

Description

This module selects some fields from infiles and writes them to outfile. infiles is an arbitrary number of input files. All input files need to have the same structure with the same variables on different timesteps. The fields selected depends on the chosen parameters. Parameter is a comma separated list of "key=value" pairs. Wildcards can be used for string parameter.

Operators

select  

Select fields
Selects all fields with parameters in a user given list.

delete  

Delete fields
Deletes all fields with parameters in a user given list.

Parameter

PICT PICT

name  

STRING Comma separated list of variable names.

param  

STRING Comma separated list of parameter identifiers.

code  

INTEGER Comma separated list of code numbers.

level  

FLOAT Comma separated list of vertical levels.

levidx  

INTEGER Comma separated list of index of levels.

zaxisname  

STRING Comma separated list of zaxis names.

zaxisnum  

INTEGER Comma separated list of zaxis numbers.

ltype  

INTEGER Comma separated list of GRIB level types.

gridname  

STRING Comma separated list of grid names.

gridnum  

INTEGER Comma separated list of grid numbers.

steptype  

STRING Comma separated list of timestep types.

date  

STRING Comma separated list of dates (format YYYY-MM-DDThh:mm:ss).

startdate  

STRING Start date (format YYYY-MM-DDThh:mm:ss).

enddate  

STRING End date (format YYYY-MM-DDThh:mm:ss). PICT PICT

minute  

INTEGER Comma separated list of minutes.

hour  

INTEGER Comma separated list of hours.

day  

INTEGER Comma separated list of days.

month  

INTEGER Comma separated list of months.

season  

STRING Comma separated list of seasons (substring of DJFMAMJJASOND or ANN).

year  

INTEGER Comma separated list of years.

timestep  

INTEGER Comma separated list of timesteps. Negative values selects timesteps from the end (NetCDF only).

timestep_of_year  

INTEGER Comma separated list of timesteps of year.

timestepmask  

STRING Read timesteps from a mask file.

Example

Assume you have 3 inputfiles. Each inputfile contains the same variables for a different time period. To select the variable T,U and V on the levels 200, 500 and 850 from all 3 input files, use:

  cdo select,name=T,U,V,level=200,500,850 infile1 infile2 infile3 outfile

PICT PICT

2.3.2  SELMULTI - Select multiple fields via GRIB1 parameters

Synopsis

   <operator>,selection-specification  infile outfile

Description

This module selects multiple fields from infile and writes them to outfile. selection-specification is a filename or in-place string with the selection specification. Each selection-specification has the following compact notation format:

  <type>(parameters; leveltype(s); levels)

type  

sel for select or del for delete (optional)

parameters  

GRIB1 parameter code number

leveltype  

GRIB1 level type

levels  

value of each level

Examples:

   (1; 103; 0) 
   (33,34; 105; 10) 
   (11,17; 105; 2) 
   (71,73,74,75,61,62,65,117,67,122,121,11,131,66,84,111,112; 105; 0) PICT PICT

The following descriptive notation can also be used for selection specification from a file:

  SELECT/DELETE, PARAMETER=parameters, LEVTYPE=leveltye(s), LEVEL=levels

Examples:

   SELECT, PARAMETER=1, LEVTYPE=103, LEVEL=0 
   SELECT, PARAMETER=33/34, LEVTYPE=105, LEVEL=10 
   SELECT, PARAMETER=11/17, LEVTYPE=105, LEVEL=2 
   SELECT, PARAMETER=71/73/74/75/61/62/65/117/67/122, LEVTYPE=105, LEVEL=0 
   DELETE, PARAMETER=128, LEVTYPE=109, LEVEL=*

The following will convert Pressure from Pa into hPa; Temp from Kelvin to Celsius:

   SELECT, PARAMETER=1, LEVTYPE= 103, LEVEL=0, SCALE=0.01 
   SELECT, PARAMETER=11, LEVTYPE=105, LEVEL=2, OFFSET=273.15

If SCALE and/or OFFSET are defined, then the data values are scaled as SCALE*(VALUE-OFFSET).

Operators

selmulti  

Select multiple fields

delmulti  

Delete multiple fields

changemulti  

Change identication of multiple fields

Example

Change ECMWF GRIB code of surface pressure to Hirlam notation:

  cdo changemulti,’{(134;1;*|1;105;*)}’ infile outfile

PICT PICT

2.3.3  SELVAR - Select fields

Synopsis

   <operator>,params  infile outfile

   selcode,codes  infile outfile

   delcode,codes  infile outfile

   selname,names  infile outfile

   delname,names  infile outfile

   selstdname,stdnames  infile outfile

   sellevel,levels  infile outfile

   sellevidx,levidx  infile outfile

   selgrid,grids  infile outfile

   selzaxis,zaxes  infile outfile

   selzaxisname,zaxisnames  infile outfile

   selltype,ltypes  infile outfile

   seltabnum,tabnums  infile outfile

Description

This module selects some fields from infile and writes them to outfile. The fields selected depends on the chosen operator and the parameters. PICT PICT

Operators

selparam  

Select parameters by identifier
Selects all fields with parameter identifiers in a user given list.

delparam  

Delete parameters by identifier
Deletes all fields with parameter identifiers in a user given list.

selcode  

Select parameters by code number
Selects all fields with code numbers in a user given list.

delcode  

Delete parameters by code number
Deletes all fields with code numbers in a user given list.

selname  

Select parameters by name
Selects all fields with parameter names in a user given list.

delname  

Delete parameters by name
Deletes all fields with parameter names in a user given list.

selstdname  

Select parameters by standard name
Selects all fields with standard names in a user given list.

sellevel  

Select levels
Selects all fields with levels in a user given list.

sellevidx  

Select levels by index
Selects all fields with index of levels in a user given list.

selgrid  

Select grids
Selects all fields with grids in a user given list. PICT PICT

selzaxis  

Select z-axes
Selects all fields with z-axes in a user given list.

selzaxisname  

Select z-axes by name
Selects all fields with z-axis names in a user given list.

selltype  

Select GRIB level types
Selects all fields with GRIB level type in a user given list.

seltabnum  

Select parameter table numbers
Selects all fields with parameter table numbers in a user given list.

Parameter

params  

INTEGER Comma separated list of parameter identifiers

codes  

INTEGER Comma separated list of code numbers

names  

STRING Comma separated list of variable names

stdnames  

STRING Comma separated list of standard names

levels  

FLOAT Comma separated list of vertical levels

levidx  

INTEGER Comma separated list of index of levels

ltypes  

INTEGER Comma separated list of GRIB level types PICT PICT

grids  

STRING Comma separated list of grid names or numbers

zaxes  

STRING Comma separated list of z-axis types or numbers

zaxisnames  

STRING Comma separated list of z-axis names

tabnums  

INTEGER Comma separated list of parameter table numbers

Example

Assume an input dataset has three variables with the code numbers 129, 130 and 139. To select the variables with the code number 129 and 139 use:

  cdo selcode,129,139 infile outfile

You can also select the code number 129 and 139 by deleting the code number 130 with:

  cdo delcode,130 infile outfile

PICT PICT

2.3.4  SELTIME - Select timesteps

Synopsis

   seltimestep,timesteps  infile outfile

   seltime,times  infile outfile

   selhour,hours  infile outfile

   selday,days  infile outfile

   selmonth,months  infile outfile

   selyear,years  infile outfile

   selseason,seasons  infile outfile

   seldate,date1[,date2]  infile outfile

   selsmon,month[,nts1[,nts2]]  infile outfile

Description

This module selects user specified timesteps from infile and writes them to outfile. The timesteps selected depends on the chosen operator and the parameters.

Operators

seltimestep  

Select timesteps
Selects all timesteps with a timestep in a user given list. PICT PICT

seltime  

Select times
Selects all timesteps with a time in a user given list.

selhour  

Select hours
Selects all timesteps with a hour in a user given list.

selday  

Select days
Selects all timesteps with a day in a user given list.

selmonth  

Select months
Selects all timesteps with a month in a user given list.

selyear  

Select years
Selects all timesteps with a year in a user given list.

selseason  

Select seasons
Selects all timesteps with a month of a season in a user given list.

seldate  

Select dates
Selects all timesteps with a date in a user given range.

selsmon  

Select single month
Selects a month and optional an arbitrary number of timesteps before and after this month.

Parameter

timesteps  

INTEGER Comma separated list of timesteps. Negative values selects timesteps from the end (NetCDF only). PICT PICT

times  

STRING Comma separated list of times (format hh:mm:ss).

hours  

INTEGER Comma separated list of hours.

days  

INTEGER Comma separated list of days.

months  

INTEGER Comma separated list of months.

years  

INTEGER Comma separated list of years.

seasons  

STRING Comma separated list of seasons (substring of DJFMAMJJASOND or ANN).

date1  

STRING Start date (format YYYY-MM-DDThh:mm:ss).

date2  

STRING End date (format YYYY-MM-DDThh:mm:ss) [default: date1].

nts1  

INTEGER Number of timesteps before the selected month [default: 0].

nts2  

INTEGER Number of timesteps after the selected month [default: nts1].

PICT PICT

2.3.5  SELBOX - Select a box of a field

Synopsis

   sellonlatbox,lon1,lon2,lat1,lat2  infile outfile

   selindexbox,idx1,idx2,idy1,idy2  infile outfile

Description

Selects a box of the rectangularly understood field.

Operators

sellonlatbox  

Select a longitude/latitude box
Selects a regular longitude/latitude box. The user has to give the longitudes and latitudes of the edges of the box. Considered are only those grid cells with the grid center inside the lon/lat box. For rotated lon/lat grids the parameter needs to be rotated coordinates.

selindexbox  

Select an index box
Selects an index box. The user has to give the indexes of the edges of the box. The index of the left edge may be greater then that of the right edge.

Parameter

PICT PICT

lon1  

FLOAT Western longitude

lon2  

FLOAT Eastern longitude

lat1  

FLOAT Southern or northern latitude

lat2  

FLOAT Northern or southern latitude

idx1  

INTEGER Index of first longitude (1 - nlon)

idx2  

INTEGER Index of last longitude (1 - nlon)

idy1  

INTEGER Index of first latitude (1 - nlat)

idy2  

INTEGER Index of last latitude (1 - nlat)

Example

To select the region with the longitudes from 30W to 60E and latitudes from 30N to 80S from all input fields use:

  cdo sellonlatbox,-30,60,30,80 infile outfile

If the input dataset has fields on a Gaussian N16 grid, the same box can be selected with selindexbox by:

  cdo selindexbox,60,11,3,11 infile outfile

PICT PICT

2.3.6  SELGRIDCELL - Select grid cells

Synopsis

   <operator>,indexes  infile outfile

Description

Selects grid cells of all fields from infile. The user has to give the indexes of each grid cell. The resulting grid in outfile is unstructured.

Operators

selgridcell  

Select grid cells

delgridcell  

Delete grid cells

Parameter

indexes  

INTEGER Comma separated list of indexes

PICT PICT

2.3.7  SAMPLEGRID - Resample grid

Synopsis

   samplegrid,factor  infile outfile

Description

This is a special operator for resampling the horizontal grid. No interpolation takes place. Resample factor=2 means every second grid point is removed. Only rectilinear and curvilinear source grids are supported by this operator.

Parameter

factor  

INTEGER Resample factor, typically 2, which will half the resolution

PICT PICT

2.4  Conditional selection

This section contains modules to conditional select field elements. The fields in the first input file are handled as a mask. A value not equal to zero is treated as "true", zero is treated as "false".

Here is a short overview of all operators in this section:

  ifthen If then
  ifnotthen If not then

  ifthenelse If then else

  ifthenc If then constant
  ifnotthenc If not then constant

  reducegrid Reduce input file variables to locations, where mask is non-zero.

PICT PICT

2.4.1  COND - Conditional select one field

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module selects field elements from infile2 with respect to infile1 and writes them to outfile. The fields in infile1 are handled as a mask. A value not equal to zero is treated as "true", zero is treated as "false". The number of fields in infile1 has either to be the same as in infile2 or the same as in one timestep of infile2 or only one. The fields in outfile inherit the meta data from infile2.

Operators

ifthen  

If then
o(t,x) = {#i2(t,x)# if i1([t,]x) ⁄= 0 ∧ i1([t,]x) ⁄= miss
 ##miss## if i ([t,]x) = 0 ∨ i ([t,]x) = miss
             1             1

ifnotthen  

If not then
o(t,x) = { i2(t,x)  if i1([t,]x) = 0 ∧ i1([t,]x) ⁄= miss
   miss   if i1([t,]x) ⁄= 0 ∨ i1([t,]x) = miss

PICT PICT

Example

To select all field elements of infile2 if the corresponding field element of infile1 is greater than 0 use:

  cdo ifthen infile1 infile2 outfile

2.4.2  COND2 - Conditional select two fields

Synopsis

   ifthenelse  infile1 infile2 infile3 outfile

Description

This operator selects field elements from infile2 or infile3 with respect to infile1 and writes them to outfile. The fields in infile1 are handled as a mask. A value not equal to zero is treated as "true", zero is treated as "false". The number of fields in infile1 has either to be the same as in infile2 or the same as in one timestep of infile2 or only one. infile2 and infile3 need to have the same number of fields. The fields in outfile inherit the meta data from infile2.

o(t,x) = (
{  i2(t,x) if i1([t,]x) ⁄= 0   ∧  i1([t,]x) ⁄= miss
   i3(t,x) if i1([t,]x) = 0   ∧  i1([t,]x) ⁄= miss
(   miss  if i1([t,]x) = miss PICT PICT

Example

To select all field elements of infile2 if the corresponding field element of infile1 is greater than 0 and from infile3 otherwise use:

  cdo ifthenelse infile1 infile2 infile3 outfile

2.4.3  CONDC - Conditional select a constant

Synopsis

   <operator>,c  infile outfile

Description

This module creates fields with a constant value or missing value. The fields in infile are handled as a mask. A value not equal to zero is treated as "true", zero is treated as "false".

Operators

ifthenc  

If then constant
o(t,x) = {
    c   if i(t,x) ⁄= 0 ∧  i(t,x ) ⁄= miss
  miss  if i(t,x) = 0 ∨  i(t,x ) = miss PICT PICT

ifnotthenc  

If not then constant
o(t,x) = {
    c   if i(t,x) = 0 ∧  i(t,x ) ⁄= miss
  miss  if i(t,x) ⁄= 0 ∨  i(t,x ) = miss

Parameter

c  

FLOAT Constant

Example

To create fields with the constant value 7 if the corresponding field element of infile is greater than 0 use:

  cdo ifthenc,7 infile outfile

PICT PICT

2.4.4  MAPREDUCE - Reduce fields to user-defined mask

Synopsis

   reducegrid,mask[,limitCoordsOutput]  infile outfile

Description

This module holds an operator for data reduction based on a user defined mask. The output grid is unstructured and includes coordinate bounds. Bounds can be avoided by using the additional ’nobounds’ keyword. With ’nocoords’ given, coordinates a completely suppressed.

Parameter

mask  

STRING file which holds the mask field

limitCoordsOutput  

STRING optional parameter to limit coordinates output: ’nobounds’ disables coordinate bounds, ’nocoords’ avoids all coordinate information

Example

To limit data fields to land values, a mask has to be created first with PICT PICT

  cdo -gtc,0 -topo,ni96 lsm_gme96.grb

Here a GME grid is used. Say temp_gme96.grb contains a global temperture field. The following command limits the global grid to landpoints.

  cdo -f nc reduce,lsm_gme96.grb temp_gme96.grb tempOnLand_gme96.nc

Note that output file type is NetCDF, because unstructured grids cannot be stored in GRIB format.

PICT PICT

2.5  Comparison

This section contains modules to compare datasets. The resulting field is a mask containing 1 if the comparison is true and 0 if not.

Here is a short overview of all operators in this section:

  eq Equal
  ne Not equal
  le Less equal
  lt Less than
  ge Greater equal
  gt Greater than

  eqc Equal constant
  nec Not equal constant
  lec Less equal constant
  ltc Less than constant
  gec Greater equal constant
  gtc Greater than constant

PICT PICT

2.5.1  COMP - Comparison of two fields

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module compares two datasets field by field. The resulting field is a mask containing 1 if the comparison is true and 0 if not. The number of fields in infile1 should be the same as in infile2. One of the input files can contain only one timestep or one field. The fields in outfile inherit the meta data from infile1 or infile2. The type of comparison depends on the chosen operator.

Operators

eq  

Equal
o(t,x) = (
{   1    if i1(t,x) = i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
(   0    if i1(t,x) ⁄= i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
   miss  if i1(t,x) = miss  ∨  i2(t,x) = miss

ne  

Not equal
o(t,x) = (
{   1    if i1(t,x) ⁄= i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
(   0    if i1(t,x) = i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
   miss  if i1(t,x) = miss  ∨  i2(t,x) = miss PICT PICT

le  

Less equal
o(t,x) = (
{   1    if i1(t,x) ≤ i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
(   0    if i1(t,x) > i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
   miss  if i1(t,x) = miss  ∨  i2(t,x) = miss

lt  

Less than
o(t,x) = ({   1    if i1(t,x) < i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
    0    if i1(t,x) ≥ i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
(  miss  if i(t,x) = miss  ∨  i(t,x) = miss
           1                 2

ge  

Greater equal
o(t,x) = (
{   1    if i1(t,x) ≥ i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
    0    if i1(t,x) < i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
(  miss  if i1(t,x) = miss  ∨  i2(t,x) = miss

gt  

Greater than
o(t,x) = (   1    if i(t,x) > i(t,x) ∧ i(t,x),i (t,x) ⁄= miss
{          1        2        1      2
(   0    if i1(t,x) ≤ i2(t,x) ∧ i1(t,x),i2(t,x) ⁄= miss
   miss  if i1(t,x) = miss  ∨  i2(t,x) = miss

Example

To create a mask containing 1 if the elements of two fields are the same and 0 if the elements are different use:

  cdo eq infile1 infile2 outfile

PICT PICT

2.5.2  COMPC - Comparison of a field with a constant

Synopsis

   <operator>,c  infile outfile

Description

This module compares all fields of a dataset with a constant. The resulting field is a mask containing 1 if the comparison is true and 0 if not. The type of comparison depends on the chosen operator.

Operators

eqc  

Equal constant
o(t,x) = (
{   1    if i(t,x) = c    ∧ i(t,x),c ⁄= miss
(   0    if i(t,x) ⁄= c    ∧ i(t,x),c ⁄= miss
   miss  if i(t,x) = miss ∨ c = miss

nec  

Not equal constant
o(t,x) = ({   1    if i(t,x) ⁄= c    ∧ i(t,x),c ⁄= miss
    0    if i(t,x) = c    ∧ i(t,x),c ⁄= miss
(  miss  if i(t,x) = miss ∨ c = miss

lec  

Less equal constant
o(t,x) = (
{   1    if i(t,x) ≤ c    ∧ i(t,x),c ⁄= miss
(   0    if i(t,x) > c    ∧ i(t,x),c ⁄= miss
   miss  if i(t,x) = miss ∨ c = miss PICT PICT

ltc  

Less than constant
o(t,x) = (
{   1    if i(t,x) < c    ∧ i(t,x),c ⁄= miss
(   0    if i(t,x) ≥ c    ∧ i(t,x),c ⁄= miss
   miss  if i(t,x) = miss ∨ c = miss

gec  

Greater equal constant
o(t,x) = ({   1    if i(t,x) ≥ c    ∧ i(t,x),c ⁄= miss
    0    if i(t,x) < c    ∧ i(t,x),c ⁄= miss
(  miss  if i(t,x) = miss ∨ c = miss

gtc  

Greater than constant
o(t,x) = (
{   1    if i(t,x) > c    ∧ i(t,x),c ⁄= miss
(   0    if i(t,x) ≤ c    ∧ i(t,x),c ⁄= miss
   miss  if i(t,x) = miss ∨ c = miss

Parameter

c  

FLOAT Constant

Example

To create a mask containing 1 if the field element is greater than 273.15 and 0 if not use:

  cdo gtc,273.15 infile outfile

PICT PICT

2.6  Modification

This section contains modules to modify the metadata, fields or part of a field in a dataset.

Here is a short overview of all operators in this section:

  setattribute Set attributes

  setpartabp Set parameter table
  setpartabn Set parameter table

  setcodetab Set parameter code table
  setcode Set code number
  setparam Set parameter identifier
  setname Set variable name
  setunit Set variable unit
  setlevel Set level
  setltype Set GRIB level type

  setdate Set date
  settime Set time of the day
  setday Set day
  setmon Set month
  setyear Set year
  settunits Set time units
  settaxis Set time axis
  settbounds Set time bounds
  setreftime Set reference time
  setcalendar Set calendar
  shifttime Shift timesteps

  chcode Change code number
  chparam Change parameter identifier
  chname Change variable name
  chunit Change variable unit
  chlevel Change level
  chlevelc Change level of one code
  chlevelv Change level of one variable

  setgrid Set grid
  setgridtype Set grid type
  setgridarea Set grid cell area

  setzaxis Set z-axis
  genlevelbounds Generate level bounds

  invertlat Invert latitudes

  invertlev Invert levels

  shiftx Shift x
  shifty Shift y

  maskregion Mask regions

  masklonlatbox Mask a longitude/latitude box
  maskindexbox Mask an index box
PICT PICT

  setclonlatbox Set a longitude/latitude box to constant
  setcindexbox Set an index box to constant

  enlarge Enlarge fields

  setmissval Set a new missing value
  setctomiss Set constant to missing value
  setmisstoc Set missing value to constant
  setrtomiss Set range to missing value
  setvrange Set valid range
  setmisstonn Set missing value to nearest neighbor
  setmisstodis Set missing value to distance-weighted average

PICT PICT

2.6.1  SETATTRIBUTE - Set attributes

Synopsis

   setattribute,attributes  infile outfile

Description

This operator sets attributes of a dataset. Each attribute has the following structure:

[var_nm@]att_nm=att_val

   var_nm  

Variable name (optional). Example: pressure

   att_nm  

Attribute name. Example: units

   att_val  

Comma separated list of attribute values. Example: pascal

The value of var_nm is the name of the variable containing the attribute (named att_nm) that you want to set. Use wildcards to set the attribute att_nm to more than one variable. A value of var_nm of ’*’ will set the attribute att_nm to all data variables. If var_nm is missing then att_nm refers to a global attribute.

The value of att_nm is the name of the attribute you want to set.

The value of att_val is the contents of the attribute att_nm. att_val may be a single value or one-dimensional array of elements. The type of the attribute value will be detected automaticly from the contents of the value.

A special meaning has the attribute name FILE. If this is the 1st attribute then all attributes are read from a file specified in the value of att_val.

PICT PICT

Parameter

attributes  

STRING Comma separated list of attributes.

Example

To set the units of the variable pressure to pascal use:

  cdo setattribute,pressure@units=pascal infile outfile

To set the global text attribute "my_att" to "my contents", use:

  cdo setattribute,my_att="my contents" infile outfile

Result of ’ncdump -h outfile’:

netcdf outfile { 
dimensions: ... 
 
variables: ... 
 
// global attributes: 
                :my_att = "my contents" ; 
}

PICT PICT

2.6.2  SETPARTAB - Set parameter table

Synopsis

   <operator>,table[,convert]  infile outfile

Description

This module transforms data and metadata of infile via a parameter table and writes the result to outfile. A parameter table is an ASCII formatted file with a set of parameter entries for each variable. Each new set have to start with "&parameter" and to end with "/".

The following parameter table entries are supported:




Entry Type Description



name WORD Name of the variable



out_name WORD New name of the variable



param WORD Parameter identifier (GRIB1: code[.tabnum]; GRIB2: num[.cat[.dis]])



out_param WORD New parameter identifier



type WORD Data type (real or double)



standard_name WORD As defined in the CF standard name table



long_name STRING Describing the variable



units STRING Specifying the units for the variable



comment STRING Information concerning the variable



cell_methods STRING Information concerning calculation of means or climatologies



cell_measures STRING Indicates the names of the variables containing cell areas and volumes



missing_value FLOAT Specifying how missing data will be identified



valid_min FLOAT Minimum valid value



valid_max FLOAT Maximum valid value



ok_min_mean_abs FLOAT Minimum absolute mean



ok_max_mean_abs FLOAT Maximum absolute mean



factor FLOAT Scale factor



delete INTEGER Set to 1 to delete variable



convert INTEGER Set to 1 to convert the unit if necessary



Unsupported parameter table entries are stored as variable attributes. The search key for the variable depends on the operator. Use setpartabn to search variables by the name. This is typically used for NetCDF datasets. The operator setpartabp searches variables by the parameter ID.

Operators

PICT PICT

setpartabp  

Set parameter table
Search variables by the parameter identifier.

setpartabn  

Set parameter table
Search variables by name.

Parameter

table  

STRING Parameter table file or name

convert  

STRING Converts the units if necessary

Example

Here is an example of a parameter table for one variable:

prompt> cat mypartab 
&parameter 
 name         = t 
 out_name     = ta 
 standard_name = air_temperature 
 units        = "K" 
 missing_value = 1e+20 
 valid_min    = 157.1 
 valid_max    = 336.3 
/

To apply this parameter table to a dataset use:

cdo setpartabn,mypartab,convert infile outfile

This command renames the variable t to ta. The standard name of this variable is set to air_temperature and the unit is set to [K] (converts the unit if necessary). The missing value will be set to 1e+20. In addition it will be checked whether the values of the variable are in the range of 157.1 to 336.3.

PICT PICT

2.6.3  SET - Set field info

Synopsis

   setcodetab,table  infile outfile

   setcode,code  infile outfile

   setparam,param  infile outfile

   setname,name  infile outfile

   setunit,unit  infile outfile

   setlevel,level  infile outfile

   setltype,ltype  infile outfile

Description

This module sets some field information. Depending on the chosen operator the parameter table, code number, parameter identifier, variable name or level is set.

Operators

setcodetab  

Set parameter code table
Sets the parameter code table for all variables.

setcode  

Set code number
Sets the code number for all variables to the same given value. PICT PICT

setparam  

Set parameter identifier
Sets the parameter identifier of the first variable.

setname  

Set variable name
Sets the name of the first variable.

setunit  

Set variable unit
Sets the unit of the first variable.

setlevel  

Set level
Sets the first level of all variables.

setltype  

Set GRIB level type
Sets the GRIB level type of all variables.

Parameter

table  

STRING Parameter table file or name

code  

INTEGER Code number

param  

STRING Parameter identifier (GRIB1: code[.tabnum]; GRIB2: num[.cat[.dis]])

name  

STRING Variable name

level  

FLOAT New level

ltype  

INTEGER GRIB level type

PICT PICT

2.6.4  SETTIME - Set time

Synopsis

   setdate,date  infile outfile

   settime,time  infile outfile

   setday,day  infile outfile

   setmon,month  infile outfile

   setyear,year  infile outfile

   settunits,units  infile outfile

   settaxis,date,time[,inc]  infile outfile

   settbounds,frequency  infile outfile

   setreftime,date,time[,units]  infile outfile

   setcalendar,calendar  infile outfile

   shifttime,sval  infile outfile

Description

This module sets the time axis or part of the time axis. Which part of the time axis is overwritten depends on the chosen operator.

Operators

PICT PICT

setdate  

Set date
Sets the date in every timestep to the same given value.

settime  

Set time of the day
Sets the time in every timestep to the same given value.

setday  

Set day
Sets the day in every timestep to the same given value.

setmon  

Set month
Sets the month in every timestep to the same given value.

setyear  

Set year
Sets the year in every timestep to the same given value.

settunits  

Set time units
Sets the base units of a relative time axis.

settaxis  

Set time axis
Sets the time axis.

settbounds  

Set time bounds
Sets the time bounds.

setreftime  

Set reference time
Sets the reference time of a relative time axis.

setcalendar  

Set calendar
Sets the calendar of a relative time axis.

shifttime  

Shift timesteps
Shifts all timesteps by the parameter sval.

PICT PICT

Parameter

day  

INTEGER Value of the new day

month  

INTEGER Value of the new month

year  

INTEGER Value of the new year

units  

STRING Base units of the time axis (seconds, minutes, hours, days, months, years)

date  

STRING Date (format: YYYY-MM-DD)

time  

STRING Time (format: hh:mm:ss)

inc  

STRING Optional increment (seconds, minutes, hours, days, months, years) [default: 1hour]

frequency  

STRING Frequency of the time series (day, month, year)

calendar  

STRING Calendar (standard, proleptic_gregorian, 360_day, 365_day, 366_day)

sval  

STRING Shift value (e.g. -3hour)

Example

PICT PICT To set the time axis to 1987-01-16 12:00:00 with an increment of one month for each timestep use:

  cdo settaxis,1987-01-16,12:00:00,1mon infile outfile

Result of ’cdo showdate outfile’ for a dataset with 12 timesteps:

   1987-01-16 1987-02-16 1987-03-16 1987-04-16 1987-05-16 1987-06-16 \ 
   1987-07-16 1987-08-16 1987-09-16 1987-10-16 1987-11-16 1987-12-16

To shift this time axis by -15 days use:

  cdo shifttime,-15days infile outfile

Result of ’cdo showdate outfile’:

   1987-01-01 1987-02-01 1987-03-01 1987-04-01 1987-05-01 1987-06-01 \ 
   1987-07-01 1987-08-01 1987-09-01 1987-10-01 1987-11-01 1987-12-01

PICT PICT

2.6.5  CHANGE - Change field header

Synopsis

   chcode,oldcode,newcode[,...]  infile outfile

   chparam,oldparam,newparam,...  infile outfile

   chname,oldname,newname,...  infile outfile

   chunit,oldunit,newunit,...  infile outfile

   chlevel,oldlev,newlev,...  infile outfile

   chlevelc,code,oldlev,newlev  infile outfile

   chlevelv,name,oldlev,newlev  infile outfile

Description

This module reads fields from infile, changes some header values and writes the results to outfile. The kind of changes depends on the chosen operator.

Operators

chcode  

Change code number
Changes some user given code numbers to new user given values.

chparam  

Change parameter identifier
Changes some user given parameter identifiers to new user given values. PICT PICT

chname  

Change variable name
Changes some user given variable names to new user given names.

chunit  

Change variable unit
Changes some user given variable units to new user given units.

chlevel  

Change level
Changes some user given levels to new user given values.

chlevelc  

Change level of one code
Changes one level of a user given code number.

chlevelv  

Change level of one variable
Changes one level of a user given variable name.

Parameter

code  

INTEGER Code number

oldcode,newcode,...  

INTEGER Pairs of old and new code numbers

oldparam,newparam,...  

STRING Pairs of old and new parameter identifiers

name  

STRING Variable name

oldname,newname,...  

STRING Pairs of old and new variable names

oldlev  

FLOAT Old level PICT PICT

newlev  

FLOAT New level

oldlev,newlev,...  

FLOAT Pairs of old and new levels

Example

To change the code number 98 to 179 and 99 to 211 use:

  cdo chcode,98,179,99,211 infile outfile

PICT PICT

2.6.6  SETGRID - Set grid information

Synopsis

   setgrid,grid  infile outfile

   setgridtype,gridtype  infile outfile

   setgridarea,gridarea  infile outfile

Description

This module modifies the metadata of the horizontal grid. Depending on the chosen operator a new grid description is set, the coordinates are converted or the grid cell area is added.

Operators

setgrid  

Set grid
Sets a new grid description. The input fields need to have the same grid size as the size of the target grid description.

setgridtype  

Set grid type
Sets the grid type of all input fields. The following grid types are available:

curvilinear  

Converts a regular grid to a curvilinear grid

unstructured  

Converts a regular or curvilinear grid to an unstructured grid PICT PICT

dereference  

Dereference a reference to a grid

regular  

Linear interpolation of a reduced Gaussian grid to a regular Gaussian grid

regularnn  

Nearest neighbor interpolation of a reduced Gaussian grid to a regular Gaussian grid

lonlat  

Converts a regular lonlat grid stored as a curvilinear grid back to a lonlat grid

setgridarea  

Set grid cell area
Sets the grid cell area. The parameter gridarea is the path to a data file, the first field is used as grid cell area. The input fields need to have the same grid size as the grid cell area. The grid cell area is used to compute the weights of each grid cell if needed by an operator, e.g. for fldmean.

Parameter

grid  

STRING Grid description file or name

gridtype  

STRING Grid type (curvilinear, unstructured, regular, lonlat or dereference)

gridarea  

STRING Data file, the first field is used as grid cell area

Example

PICT PICT Assuming a dataset has fields on a grid with 2048 elements without or with wrong grid description. To set the grid description of all input fields to a Gaussian N32 grid (8192 gridpoints) use:

  cdo setgrid,n32 infile outfile

PICT PICT

2.6.7  SETZAXIS - Set z-axis information

Synopsis

   setzaxis,zaxis  infile outfile

   genlevelbounds[,zbot[,ztop]]  infile outfile

Description

This module modifies the metadata of the vertical grid.

Operators

setzaxis  

Set z-axis
This operator sets the z-axis description of all variables with the same number of level as the new z-axis.

genlevelbounds  

Generate level bounds
Generates the layer bounds of the z-axis.

Parameter

PICT PICT

zaxis  

STRING Z-axis description file or name of the target z-axis

zbot  

FLOAT Specifying the bottom of the vertical column. Must have the same units as z-axis.

ztop  

FLOAT Specifying the top of the vertical column. Must have the same units as z-axis.

PICT PICT

2.6.8  INVERT - Invert latitudes

Synopsis

   invertlat  infile outfile

Description

This operator inverts the latitudes of all fields on a rectilinear grid.

Example

To invert the latitudes of a 2D field from N->S to S->N use:

  cdo invertlat infile outfile

2.6.9  INVERTLEV - Invert levels

Synopsis

   invertlev  infile outfile PICT PICT

Description

This operator inverts the levels of all 3D variables.

PICT PICT

2.6.10  SHIFTXY - Shift field

Synopsis

   <operator>,<nshift>,<cyclic>,<coord>  infile outfile

Description

This module contains operators to shift all fields in x or y direction. All fields need to have the same horizontal rectilinear or curvilinear grid.

Operators

shiftx  

Shift x
Shifts all fields in x direction.

shifty  

Shift y
Shifts all fields in y direction.

Parameter

nshift  

INTEGER Number of grid cells to shift (default: 1) PICT PICT

cyclic  

STRING If set, cells are filled up cyclic (default: missing value)

coord  

STRING If set, coordinates are also shifted

Example

To shift all input fields in the x direction by +1 cells and fill the new cells with missing value, use:

  cdo shiftx infile outfile

To shift all input fields in the x direction by +1 cells and fill the new cells cyclic, use:

  cdo shiftx,1,cyclic infile outfile

PICT PICT

2.6.11  MASKREGION - Mask regions

Synopsis

   maskregion,regions  infile outfile

Description

Masks different regions of fields with a regular lon/lat grid. The elements inside a region are untouched, the elements outside are set to missing value. Considered are only those grid cells with the grid center inside the regions. All input fields must have the same horizontal grid. The user has to give ASCII formatted files with different regions. A region is defined by a polygon. Each line of a polygon description file contains the longitude and latitude of one point. Each polygon description file can contain one or more polygons separated by a line with the character &.

Parameter

regions  

STRING Comma separated list of ASCII formatted files with different regions

Example

To mask the region with the longitudes from 120E to 90W and latitudes from 20N to 20S on all input fields use:

  cdo maskregion,myregion infile outfile PICT PICT

For this example the polygon description file myregion should contain the following four coordinates:

  120  20 
  120 -20 
  270 -20 
  270  20

PICT PICT

2.6.12  MASKBOX - Mask a box

Synopsis

   masklonlatbox,lon1,lon2,lat1,lat2  infile outfile

   maskindexbox,idx1,idx2,idy1,idy2  infile outfile

Description

Masked a box of the rectangularly understood field. The elements inside the box are untouched, the elements outside are set to missing value. All input fields need to have the same horizontal grid. Use sellonlatbox or selindexbox if only the data inside the box are needed.

Operators

masklonlatbox  

Mask a longitude/latitude box
Masked a regular longitude/latitude box. The user has to give the longitudes and latitudes of the edges of the box. Considered are only those grid cells with the grid center inside the lon/lat box.

maskindexbox  

Mask an index box
Masked an index box. The user has to give the indexes of the edges of the box. The index of the left edge can be greater then the one of the right edge.

Parameter

PICT PICT

lon1  

FLOAT Western longitude

lon2  

FLOAT Eastern longitude

lat1  

FLOAT Southern or northern latitude

lat2  

FLOAT Northern or southern latitude

idx1  

INTEGER Index of first longitude

idx2  

INTEGER Index of last longitude

idy1  

INTEGER Index of first latitude

idy2  

INTEGER Index of last latitude

Example

To mask the region with the longitudes from 120E to 90W and latitudes from 20N to 20S on all input fields use:

  cdo masklonlatbox,120,-90,20,-20 infile outfile

If the input dataset has fields on a Gaussian N16 grid, the same box can be masked with maskindexbox by:

  cdo maskindexbox,23,48,13,20 infile outfile

PICT PICT

2.6.13  SETBOX - Set a box to constant

Synopsis

   setclonlatbox,c,lon1,lon2,lat1,lat2  infile outfile

   setcindexbox,c,idx1,idx2,idy1,idy2  infile outfile

Description

Sets a box of the rectangularly understood field to a constant value. The elements outside the box are untouched, the elements inside are set to the given constant. All input fields need to have the same horizontal grid.

Operators

setclonlatbox  

Set a longitude/latitude box to constant
Sets the values of a longitude/latitude box to a constant value. The user has to give the longitudes and latitudes of the edges of the box.

setcindexbox  

Set an index box to constant
Sets the values of an index box to a constant value. The user has to give the indexes of the edges of the box. The index of the left edge can be greater than the one of the right edge.

Parameter

PICT PICT

c  

FLOAT Constant

lon1  

FLOAT Western longitude

lon2  

FLOAT Eastern longitude

lat1  

FLOAT Southern or northern latitude

lat2  

FLOAT Northern or southern latitude

idx1  

INTEGER Index of first longitude

idx2  

INTEGER Index of last longitude

idy1  

INTEGER Index of first latitude

idy2  

INTEGER Index of last latitude

Example

To set all values in the region with the longitudes from 120E to 90W and latitudes from 20N to 20S to the constant value -1.23 use:

  cdo setclonlatbox,-1.23,120,-90,20,-20 infile outfile

If the input dataset has fields on a Gaussian N16 grid, the same box can be set with setcindexbox by:

  cdo setcindexbox,-1.23,23,48,13,20 infile outfile

PICT PICT

2.6.14  ENLARGE - Enlarge fields

Synopsis

   enlarge,grid  infile outfile

Description

Enlarge all fields of infile to a user given horizontal grid. Normally only the last field element is used for the enlargement. If however the input and output grid are regular lon/lat grids, a zonal or meridional enlargement is possible. Zonal enlargement takes place, if the xsize of the input field is 1 and the ysize of both grids are the same. For meridional enlargement the ysize have to be 1 and the xsize of both grids should have the same size.

Parameter

grid  

STRING Target grid description file or name

Example

Assumed you want to add two datasets. The first dataset is a field on a global grid (n field elements) and the second dataset is a global mean (1 field element). Before you can add these two datasets the second dataset have to be enlarged to the grid size of the first dataset:

  cdo enlarge,infile1 infile2 tmpfile 
  cdo add infile1 tmpfile outfile PICT PICT

Or shorter using operator piping:

  cdo add infile1 -enlarge,infile1 infile2 outfile

PICT PICT

2.6.15  SETMISS - Set missing value

Synopsis

   setmissval,newmiss  infile outfile

   setctomiss,c  infile outfile

   setmisstoc,c  infile outfile

   setrtomiss,rmin,rmax  infile outfile

   setvrange,rmin,rmax  infile outfile

   setmisstonn  infile outfile

   setmisstodis[,neighbors]  infile outfile

Description

This module sets part of a field to missing value or missing values to a constant value. Which part of the field is set depends on the chosen operator.

Operators

setmissval  

Set a new missing value
o(t,x) = { newmiss  if i(t,x) = miss
   i(t,x)   if i(t,x) ⁄= miss

setctomiss  

Set constant to missing value
o(t,x) = {
   miss  if i(t,x) = c
  i(t,x)  if i(t,x) ⁄= c PICT PICT

setmisstoc  

Set missing value to constant
o(t,x) = {
    c    if i(t,x) = miss
  i(t,x)  if i(t,x) ⁄= miss

setrtomiss  

Set range to missing value
o(t,x) = {
   miss  if i(t,x) ≥ rmin ∧i(t,x) ≤ rmax
  i(t,x)  if i(t,x) < rmin ∨i(t,x) > rmax

setvrange  

Set valid range
o(t,x) = {  miss  if i(t,x) < rmin ∨i(t,x) > rmax
  i(t,x)  if i(t,x) ≥ rmin ∧i(t,x) ≤ rmax

setmisstonn  

Set missing value to nearest neighbor
Set all missing values to the nearest non missing value.

o(t,x) = {
  i(t,y)  if i(t,x) = miss∧ i(t,y) ⁄= miss
  i(t,x)  if i(t,x) ⁄= miss

setmisstodis  

Set missing value to distance-weighted average
Set all missing values to the distance-weighted average of the nearest non missing values. The default number of nearest neighbors is 4.

Parameter

neighbors  

INTEGER Number of nearest neighbors

newmiss  

FLOAT New missing value

c  

FLOAT Constant PICT PICT

rmin  

FLOAT Lower bound

rmax  

FLOAT Upper bound

Example

setrtomiss

Assume an input dataset has one field with temperatures in the range from 246 to 304 Kelvin. To set all values below 273.15 Kelvin to missing value use:

  cdo setrtomiss,0,273.15 infile outfile

Result of ’cdo info infile’:

   -1 :       Date  Time    Code Level  Size  Miss :  Minimum     Mean  Maximum 
    1 : 1987-12-31 12:00:00 139      0  2048     0 :   246.27   276.75   303.71

Result of ’cdo info outfile’:

   -1 :       Date  Time    Code Level  Size  Miss :  Minimum     Mean  Maximum 
    1 : 1987-12-31 12:00:00 139      0  2048   871 :   273.16   287.08   303.71

setmisstonn

Set all missing values to the nearest non missing value:

  cdo setmisstonn infile outfile

Below is a schematic illustration of this example: PICT PICT

PIC

On the left side is input data with missing values in grey and on the right side the result with the filled missing values.

PICT PICT

2.7  Arithmetic

This section contains modules to arithmetically process datasets.

Here is a short overview of all operators in this section:

  expr Evaluate expressions
  exprf Evaluate expressions script
  aexpr Evaluate expressions and append results
  aexprf Evaluate expression script and append results

  abs Absolute value
  int Integer value
  nint Nearest integer value
  pow Power
  sqr Square
  sqrt Square root
  exp Exponential
  ln Natural logarithm
  log10 Base 10 logarithm
  sin Sine
  cos Cosine
  tan Tangent
  asin Arc sine
  acos Arc cosine
  atan Arc tangent
  reci Reciprocal value

  addc Add a constant
  subc Subtract a constant
  mulc Multiply with a constant
  divc Divide by a constant

  add Add two fields
  sub Subtract two fields
  mul Multiply two fields
  div Divide two fields
  min Minimum of two fields
  max Maximum of two fields
  atan2 Arc tangent of two fields

  monadd Add monthly time series
  monsub Subtract monthly time series
  monmul Multiply monthly time series
  mondiv Divide monthly time series

  yhouradd Add multi-year hourly time series
  yhoursub Subtract multi-year hourly time series
  yhourmul Multiply multi-year hourly time series
  yhourdiv Divide multi-year hourly time series

  ydayadd Add multi-year daily time series
  ydaysub Subtract multi-year daily time series
  ydaymul Multiply multi-year daily time series
  ydaydiv Divide multi-year daily time series

  ymonadd Add multi-year monthly time series
  ymonsub Subtract multi-year monthly time series
  ymonmul Multiply multi-year monthly time series
  ymondiv Divide multi-year monthly time series

  yseasadd Add multi-year seasonal time series
  yseassub Subtract multi-year seasonal time series
  yseasmul Multiply multi-year seasonal time series
  yseasdiv Divide multi-year seasonal time series
PICT PICT

  muldpm Multiply with days per month
  divdpm Divide by days per month
  muldpy Multiply with days per year
  divdpy Divide by days per year

PICT PICT

2.7.1  EXPR - Evaluate expressions

Synopsis

   expr,instr  infile outfile

   exprf,filename  infile outfile

   aexpr,instr  infile outfile

   aexprf,filename  infile outfile

Description

This module arithmetically processes every timestep of the input dataset. Each individual assignment statement have to end with a semi-colon. Unlike regular variables, temporary variables are never written to the output stream. To define a temporary variable simply prefix the variable name with an underscore (e.g. _varname) when the variable is declared.

The following operators are supported:





Operator Meaning Example Result




= assignment x = y Assigns y to x




+ addition x + y Sum of x and y




- subtraction x - y Difference of x and y




* multiplication x * y Product of x and y




/ division x / y Quotient of x and y




ˆ  exponentiation x ˆ  y Exponentiates x with y




== equal to x == y 1, if x equal to y; else 0




!= not equal to x != y 1, if x not equal to y; else 0




> greater than x > y 1, if x greater than y; else 0




< less than x < y 1, if x less than y; else 0




>= greater equal x >= y 1, if x greater equal y; else 0




<= less equal x <= y 1, if x less equal y; else 0




<=> less equal greater x <=> y -1, if x less y; 1, if x greater y; else 0




&& logical AND x && y 1, if x and y not equal 0; else 0




|| logical OR x || y 1, if x or y not equal 0; else 0




?: ternary conditional x ? y : z y, if x not equal 0, else z




The following functions are supported:

Math intrinsics:

abs(x)  

Absolute value of x PICT PICT

floor(x)  

Round to largest integral value not greater than x

ceil(x)  

Round to smallest integral value not less than x

int(x)  

Integer value of x

nint(x)  

Nearest integer value of x

sqr(x)  

Square of x

sqrt(x)  

Square Root of x

exp(x)  

Exponential of x

ln(x)  

Natural logarithm of x

log10(x)  

Base 10 logarithm of x

sin(x)  

Sine of x, where x is specified in radians

cos(x)  

Cosine of x, where x is specified in radians

tan(x)  

Tangent of x, where x is specified in radians

asin(x)  

Arc-sine of x, where x is specified in radians

acos(x)  

Arc-cosine of x, where x is specified in radians PICT PICT

atan(x)  

Arc-tangent of x, where x is specified in radians

rad(x)  

Convert x from degrees to radians

deg(x)  

Convert x from radians to degrees

Coordinates:

clon(x)  

Longitude coordinate of x (available only if x has geographical coordinates)

clat(x)  

Latitude coordinate of x (available only if x has geographical coordinates)

gridarea(x)  

Grid cell area of x (available only if x has geographical coordinates)

clev(x)  

Level coordinate of x (0, if x is a 2D surface variable)

Constants:

ngp(x)  

Number of horizontal grid points

nlev(x)  

Number of vertical levels

size(x)  

Total number of elements (ngp(x)*nlev(x))

missval(x)  

Returns the missing value of variable x

Statistical values over a field:

fldmin(x), fldmax(x), fldsum(x), fldmean(x), fldavg(x), fldstd(x), fldstd1(x), fldvar(x), fldvar1(x)

Vertical statistical values:

vertmin(x), vertmax(x), vertsum(x), vertmean(x), vertavg(x), vertstd(x), vertstd1(x), vertvar(x), vertvar1(x)

Miscellaneous:

PICT PICT

sellevel(x,k)  

Select level k of variable x

sellevidx(x,k)  

Select level index k of variable x

remove(x)  

Remove variable x from output stream

Operators

expr  

Evaluate expressions
The processing instructions are read from the parameter.

exprf  

Evaluate expressions script
Contrary to expr the processing instructions are read from a file.

aexpr  

Evaluate expressions and append results
Same as expr, but keep input variables and append results

aexprf  

Evaluate expression script and append results
Same as exprf, but keep input variables and append results

Parameter

instr  

STRING Processing instructions (need to be ’quoted’ in most cases)

filename  

STRING File with processing instructions

PICT PICT

Note

The expr commands sellevel(x,k) and sellevidx(x,k) are only available with exprf/aexprf. If the input stream contains duplicate entries of the same variable name then the last one is used.

Example

Assume an input dataset contains at least the variables ’aprl’, ’aprc’ and ’ts’. To create a new variable ’var1’ with the sum of ’aprl’ and ’aprc’ and a variable ’var2’ which convert the temperature ’ts’ from Kelvin to Celsius use:

  cdo expr,’var1=aprl+aprc;var2=ts-273.15;’ infile outfile

The same example, but the instructions are read from a file:

  cdo exprf,myexpr infile outfile

The file myexpr contains:

   var1 = aprl + aprc; 
   var2 = ts - 273.15;

PICT PICT

2.7.2  MATH - Mathematical functions

Synopsis

   <operator>  infile outfile

Description

This module contains some standard mathematical functions. All trigonometric functions calculate with radians.

Operators

abs  

Absolute value
o(t,x) = abs(i(t,x))

int  

Integer value
o(t,x) = int(i(t,x)) PICT PICT

nint  

Nearest integer value
o(t,x) = nint(i(t,x))

pow  

Power
o(t,x) = i(t,x)y

sqr  

Square
o(t,x) = i(t,x)2

sqrt  

Square root
o(t,x) = ∘ -----
  i(t,x)

exp  

Exponential
o(t,x) = ei(t,x)

ln  

Natural logarithm
o(t,x) = ln(i(t,x))

log10  

Base 10 logarithm
o(t,x) = log 10(i(t,x))

sin  

Sine
o(t,x) = sin(i(t,x))

cos  

Cosine
o(t,x) = cos(i(t,x))

tan  

Tangent
o(t,x) = tan(i(t,x)) PICT PICT

asin  

Arc sine
o(t,x) = arcsin(i(t,x))

acos  

Arc cosine
o(t,x) = arccos(i(t,x))

atan  

Arc tangent
o(t,x) = arctan(i(t,x))

reci  

Reciprocal value
o(t,x) = 1∕i(t,x)

Example

To calculate the square root for all field elements use:

  cdo sqrt infile outfile

PICT PICT

2.7.3  ARITHC - Arithmetic with a constant

Synopsis

   <operator>,c  infile outfile

Description

This module performs simple arithmetic with all field elements of a dataset and a constant. The fields in outfile inherit the meta data from infile.

Operators

addc  

Add a constant
o(t,x) = i(t,x) + c

subc  

Subtract a constant
o(t,x) = i(t,x) - c

mulc  

Multiply with a constant
o(t,x) = i(t,x) * c

divc  

Divide by a constant
o(t,x) = i(t,x)∕c

PICT PICT

Parameter

c  

FLOAT Constant

Example

To sum all input fields with the constant -273.15 use:

  cdo addc,-273.15 infile outfile

PICT PICT

2.7.4  ARITH - Arithmetic on two datasets

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of two datasets. The number of fields in infile1 should be the same as in infile2. The fields in outfile inherit the meta data from infile1. One of the input files can contain only one timestep or one variable.

Operators

add  

Add two fields
o(t,x) = i1(t,x) + i2(t,x)

sub  

Subtract two fields
o(t,x) = i1(t,x) - i2(t,x)

mul  

Multiply two fields
o(t,x) = i1(t,x) * i2(t,x) PICT PICT

div  

Divide two fields
o(t,x) = i1(t,x)∕i2(t,x)

min  

Minimum of two fields
o(t,x) = min(i1(t,x),i2(t,x))

max  

Maximum of two fields
o(t,x) = max(i1(t,x),i2(t,x))

atan2  

Arc tangent of two fields
The atan2 operator calculates the arc tangent of two fields. The result is in radians, which is between -PI and PI (inclusive).

o(t,x) = atan2(i1(t,x),i2(t,x))

Example

To sum all fields of the first input file with the corresponding fields of the second input file use:

  cdo add infile1 infile2 outfile

PICT PICT

2.7.5  MONARITH - Monthly arithmetic

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of a time series and one timestep with the same month and year. For each field in infile1 the corresponding field of the timestep in infile2 with the same month and year is used. The header information in infile1 have to be the same as in infile2. Usually infile2 is generated by an operator of the module MONSTAT.

Operators

monadd  

Add monthly time series
Adds a time series and a monthly time series.

monsub  

Subtract monthly time series
Subtracts a time series and a monthly time series.

monmul  

Multiply monthly time series
Multiplies a time series and a monthly time series.

mondiv  

Divide monthly time series
Divides a time series and a monthly time series.

PICT PICT

Example

To subtract a monthly time average from a time series use:

  cdo monsub infile -monavg infile outfile

PICT PICT

2.7.6  YHOURARITH - Multi-year hourly arithmetic

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of a time series and one timestep with the same hour and day of year. For each field in infile1 the corresponding field of the timestep in infile2 with the same hour and day of year is used. The header information in infile1 have to be the same as in infile2. Usually infile2 is generated by an operator of the module YHOURSTAT.

Operators

yhouradd  

Add multi-year hourly time series
Adds a time series and a multi-year hourly time series.

yhoursub  

Subtract multi-year hourly time series
Subtracts a time series and a multi-year hourly time series.

yhourmul  

Multiply multi-year hourly time series
Multiplies a time series and a multi-year hourly time series.

yhourdiv  

Divide multi-year hourly time series
Divides a time series and a multi-year hourly time series.

PICT PICT

Example

To subtract a multi-year hourly time average from a time series use:

  cdo yhoursub infile -yhouravg infile outfile

PICT PICT

2.7.7  YDAYARITH - Multi-year daily arithmetic

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of a time series and one timestep with the same day of year. For each field in infile1 the corresponding field of the timestep in infile2 with the same day of year is used. The header information in infile1 have to be the same as in infile2. Usually infile2 is generated by an operator of the module YDAYSTAT.

Operators

ydayadd  

Add multi-year daily time series
Adds a time series and a multi-year daily time series.

ydaysub  

Subtract multi-year daily time series
Subtracts a time series and a multi-year daily time series.

ydaymul  

Multiply multi-year daily time series
Multiplies a time series and a multi-year daily time series.

ydaydiv  

Divide multi-year daily time series
Divides a time series and a multi-year daily time series.

PICT PICT

Example

To subtract a multi-year daily time average from a time series use:

  cdo ydaysub infile -ydayavg infile outfile

PICT PICT

2.7.8  YMONARITH - Multi-year monthly arithmetic

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of a time series and one timestep with the same month of year. For each field in infile1 the corresponding field of the timestep in infile2 with the same month of year is used. The header information in infile1 have to be the same as in infile2. Usually infile2 is generated by an operator of the module YMONSTAT.

Operators

ymonadd  

Add multi-year monthly time series
Adds a time series and a multi-year monthly time series.

ymonsub  

Subtract multi-year monthly time series
Subtracts a time series and a multi-year monthly time series.

ymonmul  

Multiply multi-year monthly time series
Multiplies a time series and a multi-year monthly time series.

ymondiv  

Divide multi-year monthly time series
Divides a time series and a multi-year monthly time series.

PICT PICT

Example

To subtract a multi-year monthly time average from a time series use:

  cdo ymonsub infile -ymonavg infile outfile

PICT PICT

2.7.9  YSEASARITH - Multi-year seasonal arithmetic

Synopsis

   <operator>  infile1 infile2 outfile

Description

This module performs simple arithmetic of a time series and one timestep with the same season. For each field in infile1 the corresponding field of the timestep in infile2 with the same season is used. The header information in infile1 have to be the same as in infile2. Usually infile2 is generated by an operator of the module YSEASSTAT.

Operators

yseasadd  

Add multi-year seasonal time series
Adds a time series and a multi-year seasonal time series.

yseassub  

Subtract multi-year seasonal time series
Subtracts a time series and a multi-year seasonal time series.

yseasmul  

Multiply multi-year seasonal time series
Multiplies a time series and a multi-year seasonal time series.

yseasdiv  

Divide multi-year seasonal time series
Divides a time series and a multi-year seasonal time series.

PICT PICT

Example

To subtract a multi-year seasonal time average from a time series use:

  cdo yseassub infile -yseasavg infile outfile

2.7.10  ARITHDAYS - Arithmetic with days

Synopsis

   <operator>  infile outfile

Description

This module multiplies or divides each timestep of a dataset with the corresponding days per month or days per year. The result of these functions depends on the used calendar of the input data.

Operators

muldpm  

Multiply with days per month
o(t,x) = i(t,x) * days_per_month PICT PICT

divdpm  

Divide by days per month
o(t,x) = i(t,x)∕days_per_month

muldpy  

Multiply with days per year
o(t,x) = i(t,x) * days_per_year

divdpy  

Divide by days per year
o(t,x) = i(t,x)∕days_per_year

PICT PICT

2.8  Statistical values

This section contains modules to compute statistical values of datasets. In this program there is the different notion of "mean" and "average" to distinguish two different kinds of treatment of missing values. While computing the mean, only the not missing values are considered to belong to the sample with the side effect of a probably reduced sample size. Computing the average is just adding the sample members and divide the result by the sample size. For example, the mean of 1, 2, miss and 3 is (1+2+3)/3 = 2, whereas the average is (1+2+miss+3)/4 = miss/4 = miss. If there are no missing values in the sample, the average and the mean are identical.
This program is using the verification time to identify the time range for time-statistics. The time bounds are never used!

In this section the abbreviations as in the following table are used: PICT PICT

                      n∑
sum                      xi
                      i=1
                       -1∑n
mean  resp. avg       n     xi
                      (  i=1)
mean  resp. avg        ∑n     -1∑n
weighted by           (   wj)       wixi
{wi,i = 1,...,n}        j=1       i=1
                          n
Variance               -1∑       -2
var                   n     (xi - x)
                         i=1   n
var1                  (n - 1)- 1∑  (xi - x)2
                              i=1
                      (     ) -1      (     (      )- 1       ) 2
var weighted by         ∑n       ∑n    |       n∑        ∑n     |
{w ,i = 1,...,n}       (   wj)       wi(xi - (    wj)      wjxj)
   i                   j=1       i=1           j=1       j=1
                      ┌ --------------
Standard deviation      ││    ∑n      --
std                   ∘ n-1   (xi - x)2
                      ┌ ---i=1-------------
                      ││         ∑n
std1                  ∘ (n - 1)- 1   (xi - x)2
                                i=1
                      ┌│ (-----)---------(-----(------)----------)-2-
                      ││  ∑n     -1∑n            n∑     - 1∑n
std weighted by        │∘ (   wj)       wi|(xi - (    wj)      wjxj|)
{wi,i = 1,...,n}          j=1       i=1           j=1       j=1

Cumulative Ranked     ∫ ∞
Probability Score          [H (x1)- cdf({x2...xn})|r]2dr
crps                   -∞
   with cdf(X )|r  being the cumulative distribution function of {xi,i = 2...n} at r
   and H (x )  the Heavyside function jumping at x  .

Here is a short overview of all operators in this section:

  timcumsum Cumulative sum over all timesteps

  consecsum Consecutive Sum
  consects Consecutive Timesteps
PICT PICT

  ensmin Ensemble minimum
  ensmax Ensemble maximum
  enssum Ensemble sum
  ensmean Ensemble mean
  ensavg Ensemble average
  ensstd Ensemble standard deviation
  ensstd1 Ensemble standard deviation (n-1)
  ensvar Ensemble variance
  ensvar1 Ensemble variance (n-1)
  enspctl Ensemble percentiles

  ensrkhistspace Ranked Histogram averaged over time
  ensrkhisttime Ranked Histogram averaged over space
  ensroc Ensemble Receiver Operating characteristics

  enscrps Ensemble CRPS and decomposition
  ensbrs Ensemble Brier score

  fldmin Field minimum
  fldmax Field maximum
  fldsum Field sum
  fldmean Field mean
  fldavg Field average
  fldstd Field standard deviation
  fldstd1 Field standard deviation (n-1)
  fldvar Field variance
  fldvar1 Field variance (n-1)
  fldpctl Field percentiles

  zonmin Zonal minimum
  zonmax Zonal maximum
  zonsum Zonal sum
  zonmean Zonal mean
  zonavg Zonal average
  zonstd Zonal standard deviation
  zonstd1 Zonal standard deviation (n-1)
  zonvar Zonal variance
  zonvar1 Zonal variance (n-1)
  zonpctl Zonal percentiles

  mermin Meridional minimum
  mermax Meridional maximum
  mersum Meridional sum
  mermean Meridional mean
  meravg Meridional average
  merstd Meridional standard deviation
  merstd1 Meridional standard deviation (n-1)
  mervar Meridional variance
  mervar1 Meridional variance (n-1)
  merpctl Meridional percentiles

  gridboxmin Gridbox minimum
  gridboxmax Gridbox maximum
  gridboxsum Gridbox sum
  gridboxmean Gridbox mean
  gridboxavg Gridbox average
  gridboxstd Gridbox standard deviation
  gridboxstd1 Gridbox standard deviation (n-1)
  gridboxvar Gridbox variance
  gridboxvar1 Gridbox variance (n-1)

  vertmin Vertical minimum
  vertmax Vertical maximum
  vertsum Vertical sum
  vertmean Vertical mean
  vertavg Vertical average
  vertstd Vertical standard deviation
  vertstd1 Vertical standard deviation (n-1)
  vertvar Vertical variance
  vertvar1 Vertical variance (n-1)
PICT PICT

  timselmin Time range minimum
  timselmax Time range maximum
  timselsum Time range sum
  timselmean Time range mean
  timselavg Time range average
  timselstd Time range standard deviation
  timselstd1 Time range standard deviation (n-1)
  timselvar Time range variance
  timselvar1 Time range variance (n-1)

  timselpctl Time range percentiles

  runmin Running minimum
  runmax Running maximum
  runsum Running sum
  runmean Running mean
  runavg Running average
  runstd Running standard deviation
  runstd1 Running standard deviation (n-1)
  runvar Running variance
  runvar1 Running variance (n-1)

  runpctl Running percentiles

  timmin Time minimum
  timmax Time maximum
  timsum Time sum
  timmean Time mean
  timavg Time average
  timstd Time standard deviation
  timstd1 Time standard deviation (n-1)
  timvar Time variance
  timvar1 Time variance (n-1)

  timpctl Time percentiles

  hourmin Hourly minimum
  hourmax Hourly maximum
  hoursum Hourly sum
  hourmean Hourly mean
  houravg Hourly average
  hourstd Hourly standard deviation
  hourstd1 Hourly standard deviation (n-1)
  hourvar Hourly variance
  hourvar1 Hourly variance (n-1)

  hourpctl Hourly percentiles

  daymin Daily minimum
  daymax Daily maximum
  daysum Daily sum
  daymean Daily mean
  dayavg Daily average
  daystd Daily standard deviation
  daystd1 Daily standard deviation (n-1)
  dayvar Daily variance
  dayvar1 Daily variance (n-1)

  daypctl Daily percentiles
PICT PICT

  monmin Monthly minimum
  monmax Monthly maximum
  monsum Monthly sum
  monmean Monthly mean
  monavg Monthly average
  monstd Monthly standard deviation
  monstd1 Monthly standard deviation (n-1)
  monvar Monthly variance
  monvar1 Monthly variance (n-1)

  monpctl Monthly percentiles

  yearmonmean Yearly mean from monthly data

  yearmin Yearly minimum
  yearmax Yearly maximum
  yearsum Yearly sum
  yearmean Yearly mean
  yearavg Yearly average
  yearstd Yearly standard deviation
  yearstd1 Yearly standard deviation (n-1)
  yearvar Yearly variance
  yearvar1 Yearly variance (n-1)

  yearpctl Yearly percentiles

  seasmin Seasonal minimum
  seasmax Seasonal maximum
  seassum Seasonal sum
  seasmean Seasonal mean
  seasavg Seasonal average
  seasstd Seasonal standard deviation
  seasstd1 Seasonal standard deviation (n-1)
  seasvar Seasonal variance
  seasvar1 Seasonal variance (n-1)

  seaspctl Seasonal percentiles

  yhourmin Multi-year hourly minimum
  yhourmax Multi-year hourly maximum
  yhoursum Multi-year hourly sum
  yhourmean Multi-year hourly mean
  yhouravg Multi-year hourly average
  yhourstd Multi-year hourly standard deviation
  yhourstd1 Multi-year hourly standard deviation (n-1)
  yhourvar Multi-year hourly variance
  yhourvar1 Multi-year hourly variance (n-1)

  ydaymin Multi-year daily minimum
  ydaymax Multi-year daily maximum
  ydaysum Multi-year daily sum
  ydaymean Multi-year daily mean
  ydayavg Multi-year daily average
  ydaystd Multi-year daily standard deviation
  ydaystd1 Multi-year daily standard deviation (n-1)
  ydayvar Multi-year daily variance
  ydayvar1 Multi-year daily variance (n-1)

  ydaypctl Multi-year daily percentiles
PICT PICT

  ymonmin Multi-year monthly minimum
  ymonmax Multi-year monthly maximum
  ymonsum Multi-year monthly sum
  ymonmean Multi-year monthly mean
  ymonavg Multi-year monthly average
  ymonstd Multi-year monthly standard deviation
  ymonstd1 Multi-year monthly standard deviation (n-1)
  ymonvar Multi-year monthly variance
  ymonvar1 Multi-year monthly variance (n-1)

  ymonpctl Multi-year monthly percentiles

  yseasmin Multi-year seasonal minimum
  yseasmax Multi-year seasonal maximum
  yseassum Multi-year seasonal sum
  yseasmean Multi-year seasonal mean
  yseasavg Multi-year seasonal average
  yseasstd Multi-year seasonal standard deviation
  yseasstd1 Multi-year seasonal standard deviation (n-1)
  yseasvar Multi-year seasonal variance
  yseasvar1 Multi-year seasonal variance (n-1)

  yseaspctl Multi-year seasonal percentiles

  ydrunmin Multi-year daily running minimum
  ydrunmax Multi-year daily running maximum
  ydrunsum Multi-year daily running sum
  ydrunmean Multi-year daily running mean
  ydrunavg Multi-year daily running average
  ydrunstd Multi-year daily running standard deviation
  ydrunstd1 Multi-year daily running standard deviation (n-1)
  ydrunvar Multi-year daily running variance
  ydrunvar1 Multi-year daily running variance (n-1)

  ydrunpctl Multi-year daily running percentiles

PICT PICT

2.8.1  TIMCUMSUM - Cumulative sum over all timesteps

Synopsis

   timcumsum  infile outfile

Description

The timcumsum operator calculates the cumulative sum over all timesteps. Missing values are treated as numeric zero when summing.

 
o(t,x) = sum{i(t,x),0 < t′≤ t}

2.8.2  CONSECSTAT - Consecute timestep periods

Synopsis

   <operator>  infile outfile

Description

This module computes periods over all timesteps in infile where a certain property is valid. The propery can be chosen by creating a mask from the original data, which is the expected input format for operators of this module. Depending on the operator full information about each period or just its length and ending date are computed. PICT PICT

Operators

consecsum  

Consecutive Sum
This operator computes periods of consecutive timesteps similar to a runsum, but periods are finished, when the mask value is 0. That way multiple periods can be found. Timesteps from the input are preserved. Missing values are handled like 0, i.e. finish periods of consecutive timesteps.

consects  

Consecutive Timesteps
In contrast to the operator above consects only computes the lenght of each period together with its last timestep. To be able to perform statistical analysis like min, max or mean, everything else is set to missing value.

Example

For a given time series of daily temperatures, the periods of summer days can be calculated with inplace maskting the input field:

  cdo consects -gtc,20.0 infile1 outfile

PICT PICT

2.8.3  ENSSTAT - Statistical values over an ensemble

Synopsis

   <operator>  infiles outfile

   enspctl,p  infiles outfile

Description

This module computes statistical values over an ensemble of input files. Depending on the chosen operator the minimum, maximum, sum, average, variance, standard deviation or a certain percentile over all input files is written to outfile. All input files need to have the same structure with the same variables. The date information of a timestep in outfile is the date of the first input file.

Operators

ensmin  

Ensemble minimum
o(t,x) = min{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensmax  

Ensemble maximum
o(t,x) = max{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)} PICT PICT

enssum  

Ensemble sum
o(t,x) = sum{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensmean  

Ensemble mean
o(t,x) = mean{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensavg  

Ensemble average
o(t,x) = avg{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensstd  

Ensemble standard deviation
Normalize by n.

o(t,x) = std{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensstd1  

Ensemble standard deviation (n-1)
Normalize by (n-1).

o(t,x) = std1{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensvar  

Ensemble variance
Normalize by n.

o(t,x) = var{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

ensvar1  

Ensemble variance (n-1)
Normalize by (n-1).

o(t,x) = var1{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

enspctl  

Ensemble percentiles
o(t,x) = pth percentile{i1(t,x),i2(t,x),⋅⋅⋅,in(t,x)}

PICT PICT

Parameter

p  

FLOAT Percentile number in 0, ..., 100

Note

This operator needs to open all input files simultaneously. The maximum number of open files depends on the operating system!

Example

To compute the ensemble mean over 6 input files use:

  cdo ensmean infile1 infile2 infile3 infile4 infile5 infile6 outfile

Or shorter with filename substitution:

  cdo ensmean infile[1-6] outfile

To compute the 50th percentile (median) over 6 input files use:

  cdo enspctl,50 infile1 infile2 infile3 infile4 infile5 infile6 outfile

PICT PICT

2.8.4  ENSSTAT2 - Statistical values over an ensemble

Synopsis

   <operator>  obsfile ensfiles outfile

Description

This module computes statistical values over the ensemble of ensfiles using obsfile as a reference. Depending on the operator a ranked Histogram or a roc-curve over all Ensembles ensfiles with reference to obsfile is written to outfile. The date and grid information of a timestep in outfile is the date of the first input file. Thus all input files are required to have the same structure in terms of the gridsize, variable definitions and number of timesteps.

All Operators in this module use obsfile as the reference (for instance an observation) whereas ensfiles are understood as an ensemble consisting of n (where n is the number of ensfiles) members.

The operators ensrkhistspace and ensrkhisttime compute Ranked Histograms. Therefor the vertical axis is utilized as the Histogram axis, which prohibits the use of files containing more than one level. The histogram axis has nensfiles+1 bins with level 0 containing for each grid point the number of observations being smaller as all ensembles and level nensfiles+1 indicating the number of observations being larger than all ensembles.

ensrkhistspace computes a ranked histogram at each timestep reducing each horizontal grid to a 1x1 grid and keeping the time axis as in obsfile. Contrary ensrkhistspace computes a histogram at each grid point keeping the horizontal grid for each variable and reducing the time-axis. The time information is that from the last timestep in obsfile.

Operators

ensrkhistspace  

Ranked Histogram averaged over time
PICT PICT

ensrkhisttime  

Ranked Histogram averaged over space

ensroc  

Ensemble Receiver Operating characteristics

Example

To compute a rank histogram over 5 input files ensfile1-ensfile5 given an observation in obsfile use:

  cdo ensrkhisttime obsfile ensfile1 ensfile2 ensfile3 ensfile4 ensfile5 outfile

Or shorter with filename substitution:

  cdo ensrkhisttime obsfile ensfile[1-5] outfile

PICT PICT

2.8.5  ENSVAL - Ensemble validation tools

Synopsis

   enscrps  rfile infiles outfilebase

   ensbrs,x  rfile infiles outfilebase

Description

This module computes ensemble validation scores and their decomposition such as the Brier and cumulative ranked probability score (CRPS). The first file is used as a reference it can be a climatology, observation or reanalysis against which the skill of the ensembles given in infiles is measured. Depending on the operator a number of output files is generated each containing the skill score and its decomposition corresponding to the operator. The output is averaged over horizontal fields using appropriate weights for each level and timestep in rfile.

All input files need to have the same structure with the same variables. The date information of a timestep in outfile is the date of the first input file. The output files are named as <outfilebase>.<type>.<filesuffix> where <type> depends on the operator and <filesuffix> is determined from the output file type. There are three output files for operator enscrps and four output files for operator ensbrs.

The CRPS and its decomposition into Reliability and the potential CRPS are calculated by an appropriate averaging over the field members (note, that the CRPS does *not* average linearly). In the three output files <type> has the following meaning: crps for the CRPS, reli for the reliability and crpspot for the potential crps. The relation CRPS = CRPSpot + RELI

holds.

The Brier score of the Ensemble given by infiles with respect to the reference given in rfile and the threshold x is calculated. In the four output files <type> has the following meaning: brs for the Brier score wrt threshold x; brsreli for the Brier score reliability wrt threshold x; brsreso for the Brier score resolution wrt threshold x; brsunct for the Brier score uncertainty wrt threshold x. In analogy to the CRPS the following relation holds: BRS(x) = RELI(x) - RESO(x) + UNCT(x).

The implementation of the decomposition of the CRPS and Brier Score follows Hans Hersbach (2000): Decomposition of the Continuous Ranked Probability Score for Ensemble Prediction Systems, in: Weather and Forecasting (15) pp. 559-570.

The CRPS code decomposition has been verified against the CRAN - ensemble validation package from R. Differences occur when grid-cell area is not uniform as the implementation in R does not account for that. PICT PICT

Operators

enscrps  

Ensemble CRPS and decomposition

ensbrs  

Ensemble Brier score
Ensemble Brier Score and Decomposition

Example

To compute the field averaged Brier score at x=5 over an ensemble with 5 members ensfile1-5 w.r.t. the reference rfile and write the results to files obase.brs.<suff>, obase.brsreli<suff>, obase.brsreso<suff>, obase.brsunct<suff> where <suff> is determined from the output file type, use

  cdo ensbrs,5 rfile ensfile1 ensfile2 ensfile3 ensfile4 ensfile5 obase

or shorter using file name substitution:

  cdo ensbrs,5 rfile ensfile[1-5] obase

PICT PICT

2.8.6  FLDSTAT - Statistical values over a field

Synopsis

   <operator>  infile outfile

   fldpctl,p  infile outfile

Description

This module computes statistical values of the input fields. According to the chosen operator the field minimum, maximum, sum, average, variance, standard deviation or a certain percentile is written to outfile.

Operators

fldmin  

Field minimum
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = min{i(t,x),x1 < x′≤ xn}

fldmax  

Field maximum
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = max{i(t,x),x1 < x′≤ xn} PICT PICT

fldsum  

Field sum
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = sum{i(t,x),x1 < x′≤ xn}

fldmean  

Field mean
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = mean{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldavg  

Field average
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = avg{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldstd  

Field standard deviation
Normalize by n. For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = std{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldstd1  

Field standard deviation (n-1)
Normalize by (n-1). For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = std1{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldvar  

Field variance
Normalize by n. For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = var{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldvar1  
PICT PICT

Field variance (n-1)
Normalize by (n-1). For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = var1{i(t,x),x1 < x′≤ xn}

weighted by area weights obtained by the input field.

fldpctl  

Field percentiles
For every gridpoint x_1,...,x_n of the same field it is:
o(t,1) = pth percentile{i(t,x),x1 < x′≤ xn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

Example

To compute the field mean of all input fields use:

  cdo fldmean infile outfile

To compute the 90th percentile of all input fields use:

  cdo fldpctl,90 infile outfile

PICT PICT

2.8.7  ZONSTAT - Zonal statistical values

Synopsis

   <operator>  infile outfile

   zonpctl,p  infile outfile

Description

This module computes zonal statistical values of the input fields. According to the chosen operator the zonal minimum, maximum, sum, average, variance, standard deviation or a certain percentile is written to outfile. This operator requires all variables on the same regular lon/lat grid.

Operators

zonmin  

Zonal minimum
For every latitude the minimum over all longitudes is computed.

zonmax  

Zonal maximum
For every latitude the maximum over all longitudes is computed.

zonsum  

Zonal sum
For every latitude the sum over all longitudes is computed. PICT PICT

zonmean  

Zonal mean
For every latitude the mean over all longitudes is computed.

zonavg  

Zonal average
For every latitude the average over all longitudes is computed.

zonstd  

Zonal standard deviation
For every latitude the standard deviation over all longitudes is computed. Normalize by n.

zonstd1  

Zonal standard deviation (n-1)
For every latitude the standard deviation over all longitudes is computed. Normalize by (n-1).

zonvar  

Zonal variance
For every latitude the variance over all longitudes is computed. Normalize by n.

zonvar1  

Zonal variance (n-1)
For every latitude the variance over all longitudes is computed. Normalize by (n-1).

zonpctl  

Zonal percentiles
For every latitude the pth percentile over all longitudes is computed.

Parameter

p  

FLOAT Percentile number in 0, ..., 100

PICT PICT

Example

To compute the zonal mean of all input fields use:

  cdo zonmean infile outfile

To compute the 50th meridional percentile (median) of all input fields use:

  cdo zonpctl,50 infile outfile

PICT PICT

2.8.8  MERSTAT - Meridional statistical values

Synopsis

   <operator>  infile outfile

   merpctl,p  infile outfile

Description

This module computes meridional statistical values of the input fields. According to the chosen operator the meridional minimum, maximum, sum, average, variance, standard deviation or a certain percentile is written to outfile. This operator requires all variables on the same regular lon/lat grid.

Operators

mermin  

Meridional minimum
For every longitude the minimum over all latitudes is computed.

mermax  

Meridional maximum
For every longitude the maximum over all latitudes is computed.

mersum  

Meridional sum
For every longitude the sum over all latitudes is computed. PICT PICT

mermean  

Meridional mean
For every longitude the area weighted mean over all latitudes is computed.

meravg  

Meridional average
For every longitude the area weighted average over all latitudes is computed.

merstd  

Meridional standard deviation
For every longitude the standard deviation over all latitudes is computed. Normalize by n.

merstd1  

Meridional standard deviation (n-1)
For every longitude the standard deviation over all latitudes is computed. Normalize by (n-1).

mervar  

Meridional variance
For every longitude the variance over all latitudes is computed. Normalize by n.

mervar1  

Meridional variance (n-1)
For every longitude the variance over all latitudes is computed. Normalize by (n-1).

merpctl  

Meridional percentiles
For every longitude the pth percentile over all latitudes is computed.

Parameter

p  

FLOAT Percentile number in 0, ..., 100

PICT PICT

Example

To compute the meridional mean of all input fields use:

  cdo mermean infile outfile

To compute the 50th meridional percentile (median) of all input fields use:

  cdo merpctl,50 infile outfile

PICT PICT

2.8.9  GRIDBOXSTAT - Statistical values over grid boxes

Synopsis

   <operator>,nx,ny  infile outfile

Description

This module computes statistical values over surrounding grid boxes. According to the chosen operator the minimum, maximum, sum, average, variance, or standard deviation of the neighboring grid boxes is written to outfile. All gridbox operators only works on quadrilateral curvilinear grids.

Operators

gridboxmin  

Gridbox minimum
Minimum value of the selected grid boxes.

gridboxmax  

Gridbox maximum
Maximum value of the selected grid boxes.

gridboxsum  

Gridbox sum
Sum of the selected grid boxes. PICT PICT

gridboxmean  

Gridbox mean
Mean of the selected grid boxes.

gridboxavg  

Gridbox average
Average of the selected grid boxes.

gridboxstd  

Gridbox standard deviation
Standard deviation of the selected grid boxes. Normalize by n.

gridboxstd1  

Gridbox standard deviation (n-1)
Standard deviation of the selected grid boxes. Normalize by (n-1).

gridboxvar  

Gridbox variance
Variance of the selected grid boxes. Normalize by n.

gridboxvar1  

Gridbox variance (n-1)
Variance of the selected grid boxes. Normalize by (n-1).

Parameter

nx  

INTEGER Number of grid boxes in x direction

ny  

INTEGER Number of grid boxes in y direction

Example

PICT PICT To compute the mean over 10x10 grid boxes of the input field use:

  cdo gridboxmean,10,10 infile outfile

PICT PICT

2.8.10  VERTSTAT - Vertical statistical values

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over all levels of the input variables. According to chosen operator the vertical minimum, maximum, sum, average, variance or standard deviation is written to outfile.

Operators

vertmin  

Vertical minimum
For every gridpoint the minimum over all levels is computed.

vertmax  

Vertical maximum
For every gridpoint the maximum over all levels is computed.

vertsum  

Vertical sum
For every gridpoint the sum over all levels is computed. PICT PICT

vertmean  

Vertical mean
For every gridpoint the layer weighted mean over all levels is computed.

vertavg  

Vertical average
For every gridpoint the layer weighted average over all levels is computed.

vertstd  

Vertical standard deviation
For every gridpoint the standard deviation over all levels is computed. Normalize by n.

vertstd1  

Vertical standard deviation (n-1)
For every gridpoint the standard deviation over all levels is computed. Normalize by (n-1).

vertvar  

Vertical variance
For every gridpoint the variance over all levels is computed. Normalize by n.

vertvar1  

Vertical variance (n-1)
For every gridpoint the variance over all levels is computed. Normalize by (n-1).

Example

To compute the vertical sum of all input variables use:

  cdo vertsum infile outfile

PICT PICT

2.8.11  TIMSELSTAT - Time range statistical values

Synopsis

   <operator>,nsets[,noffset[,nskip]]  infile outfile

Description

This module computes statistical values for a selected number of timesteps. According to the chosen operator the minimum, maximum, sum, average, variance or standard deviation of the selected timesteps is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

timselmin  

Time range minimum
For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = min{i(t,x),t1 < t′≤ tn}

timselmax  

Time range maximum
For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = max{i(t,x),t1 < t′≤ tn} PICT PICT

timselsum  

Time range sum
For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = sum{i(t,x),t1 < t′≤ tn}

timselmean  

Time range mean
For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

timselavg  

Time range average
For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = avg{i(t,x),t1 < t′≤ tn}

timselstd  

Time range standard deviation
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = std{i(t,x),t1 < t′≤ tn}

timselstd1  

Time range standard deviation (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = std1{i(t,x),t1 < t′≤ tn}

timselvar  

Time range variance
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = var{i(t,x),t1 < t′≤ tn}

timselvar1  

Time range variance (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:
o(t,x) = var1{i(t,x),t1 < t′≤ tn}

PICT PICT

Parameter

nsets  

INTEGER Number of input timesteps for each output timestep

noffset  

INTEGER Number of input timesteps skipped before the first timestep range (optional)

nskip  

INTEGER Number of input timesteps skipped between timestep ranges (optional)

Example

Assume an input dataset has monthly means over several years. To compute seasonal means from monthly means the first two month have to be skipped:

  cdo timselmean,3,2 infile outfile

2.8.12  TIMSELPCTL - Time range percentile values

Synopsis

   timselpctl,p,nsets[,noffset[,nskip]]  infile1 infile2 infile3 outfile PICT PICT

Description

This operator computes percentile values over a selected number of timesteps in infile1. The algorithm uses histograms with minimum and maximum bounds given in infile2 and infile3, respectively. The default number of histogram bins is 101. The default can be overridden by setting the environment variable CDO_PCTL_NBINS to a different value. The files infile2 and infile3 should be the result of corresponding timselmin and timselmax operations, respectively. The time of outfile is determined by the time in the middle of all contributing timesteps of infile1.

For every adjacent sequence t_1,...,t_n of timesteps of the same selected time range it is:

o(t,x) = pth percentile{i(t,x),t1 < t′≤ tn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

nsets  

INTEGER Number of input timesteps for each output timestep

noffset  

INTEGER Number of input timesteps skipped before the first timestep range (optional)

nskip  

INTEGER Number of input timesteps skipped between timestep ranges (optional)

Environment

PICT PICT

CDO_PCTL_NBINS  

Sets the number of histogram bins. The default number is 101.

PICT PICT

2.8.13  RUNSTAT - Running statistical values

Synopsis

   <operator>,nts  infile outfile

Description

This module computes running statistical values over a selected number of timesteps. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of a selected number of consecutive timesteps read from infile is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

runmin  

Running minimum
o(t + (nts - 1)2,x) = min{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runmax  

Running maximum
o(t + (nts - 1)2,x) = max{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runsum  

Running sum
o(t + (nts - 1)2,x) = sum{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)} PICT PICT

runmean  

Running mean
o(t + (nts - 1)2,x) = mean{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runavg  

Running average
o(t + (nts - 1)2,x) = avg{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runstd  

Running standard deviation
Normalize by n.

o(t + (nts - 1)2,x) = std{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runstd1  

Running standard deviation (n-1)
Normalize by (n-1).

o(t + (nts - 1)2,x) = std1{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runvar  

Running variance
Normalize by n.

o(t + (nts - 1)2,x) = var{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

runvar1  

Running variance (n-1)
Normalize by (n-1).

o(t + (nts - 1)2,x) = var1{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)}

Parameter

nts  

INTEGER Number of timesteps

PICT PICT

Environment

CDO_TIMESTAT_DATE  

Sets the time stamp in outfile to the "first", "middle" or "last" contributing timestep of infile.

Example

To compute the running mean over 9 timesteps use:

  cdo runmean,9 infile outfile

2.8.14  RUNPCTL - Running percentile values

Synopsis

   runpctl,p,nts  infile outfile

Description

This module computes running percentiles over a selected number of timesteps in infile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

o(t + (nts - 1)2,x) = pth percentile{i(t,x),i(t + 1,x),...,i(t + nts - 1,x)} PICT PICT

Parameter

p  

FLOAT Percentile number in 0, ..., 100

nts  

INTEGER Number of timesteps

Example

To compute the running 50th percentile (median) over 9 timesteps use:

  cdo runpctl,50,9 infile outfile

PICT PICT

2.8.15  TIMSTAT - Statistical values over all timesteps

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over all timesteps in infile. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of all timesteps read from infile is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

timmin  

Time minimum
o(1,x) = min{i(t,x),t1 < t′≤ tn}

timmax  

Time maximum
o(1,x) = max{i(t,x),t1 < t′≤ tn}

timsum  

Time sum
o(1,x) = sum{i(t,x),t1 < t′≤ tn} PICT PICT

timmean  

Time mean
o(1,x) = mean{i(t,x),t1 < t′≤ tn}

timavg  

Time average
o(1,x) = avg{i(t,x),t1 < t′≤ tn}

timstd  

Time standard deviation
Normalize by n.

o(1,x) = std{i(t,x),t1 < t′≤ tn}

timstd1  

Time standard deviation (n-1)
Normalize by (n-1).

o(1,x) = std1{i(t,x),t1 < t′≤ tn}

timvar  

Time variance
Normalize by n.

o(1,x) = var{i(t,x),t1 < t′≤ tn}

timvar1  

Time variance (n-1)
Normalize by (n-1).

o(1,x) = var1{i(t,x),t1 < t′≤ tn}

Example

To compute the mean over all input timesteps use:

  cdo timmean infile outfile

PICT PICT

2.8.16  TIMPCTL - Percentile values over all timesteps

Synopsis

   timpctl,p  infile1 infile2 infile3 outfile

Description

This operator computes percentiles over all timesteps in infile1. The algorithm uses histograms with minimum and maximum bounds given in infile2 and infile3, respectively. The default number of histogram bins is 101. The default can be overridden by defining the environment variable CDO_PCTL_NBINS. The files infile2 and infile3 should be the result of corresponding timmin and timmax operations, respectively. The time of outfile is determined by the time in the middle of all contributing timesteps of infile1.

o(1,x) = pth percentile{i(t,x),t1 < t′≤ tn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

Environment

PICT PICT

CDO_PCTL_NBINS  

Sets the number of histogram bins. The default number is 101.

Example

To compute the 90th percentile over all input timesteps use:

  cdo timmin infile minfile 
  cdo timmax infile maxfile 
  cdo timpctl,90 infile minfile maxfile outfile

Or shorter using operator piping:

  cdo timpctl,90 infile -timmin infile -timmax infile outfile

PICT PICT

2.8.17  HOURSTAT - Hourly statistical values

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over timesteps of the same hour. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of timesteps of the same hour is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

hourmin  

Hourly minimum
For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = min{i(t,x),t1 < t′≤ tn}

hourmax  

Hourly maximum
For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = max{i(t,x),t1 < t′≤ tn} PICT PICT

hoursum  

Hourly sum
For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = sum{i(t,x),t1 < t′≤ tn}

hourmean  

Hourly mean
For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

houravg  

Hourly average
For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = avg{i(t,x),t1 < t′≤ tn}

hourstd  

Hourly standard deviation
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = std{i(t,x),t1 < t′≤ tn}

hourstd1  

Hourly standard deviation (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = std1{i(t,x),t1 < t′≤ tn}

hourvar  

Hourly variance
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = var{i(t,x),t1 < t′≤ tn}

hourvar1  

Hourly variance (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:
o(t,x) = var1{i(t,x),t1 < t′≤ tn}

PICT PICT

Example

To compute the hourly mean of a time series use:

  cdo hourmean infile outfile

PICT PICT

2.8.18  HOURPCTL - Hourly percentile values

Synopsis

   hourpctl,p  infile1 infile2 infile3 outfile

Description

This operator computes percentiles over all timesteps of the same hour in infile1. The algorithm uses histograms with minimum and maximum bounds given in infile2 and infile3, respectively. The default number of histogram bins is 101. The default can be overridden by defining the environment variable CDO_PCTL_NBINS. The files infile2 and infile3 should be the result of corresponding hourmin and hourmax operations, respectively. The time of outfile is determined by the time in the middle of all contributing timesteps of infile1.

For every adjacent sequence t_1,...,t_n of timesteps of the same hour it is:

o(t,x) = pth percentile{i(t,x),t1 < t′≤ tn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

PICT PICT

Environment

CDO_PCTL_NBINS  

Sets the number of histogram bins. The default number is 101.

Example

To compute the hourly 90th percentile of a time series use:

  cdo hourmin infile minfile 
  cdo hourmax infile maxfile 
  cdo hourpctl,90 infile minfile maxfile outfile

Or shorter using operator piping:

  cdo hourpctl,90 infile -hourmin infile -hourmax infile outfile

PICT PICT

2.8.19  DAYSTAT - Daily statistical values

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over timesteps of the same day. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of timesteps of the same day is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

daymin  

Daily minimum
For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = min{i(t,x),t1 < t′≤ tn}

daymax  

Daily maximum
For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = max{i(t,x),t1 < t′≤ tn} PICT PICT

daysum  

Daily sum
For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = sum{i(t,x),t1 < t′≤ tn}

daymean  

Daily mean
For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

dayavg  

Daily average
For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = avg{i(t,x),t1 < t′≤ tn}

daystd  

Daily standard deviation
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = std{i(t,x),t1 < t′≤ tn}

daystd1  

Daily standard deviation (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = std1{i(t,x),t1 < t′≤ tn}

dayvar  

Daily variance
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = var{i(t,x),t1 < t′≤ tn}

dayvar1  

Daily variance (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:
o(t,x) = var1{i(t,x),t1 < t′≤ tn}

PICT PICT

Example

To compute the daily mean of a time series use:

  cdo daymean infile outfile

PICT PICT

2.8.20  DAYPCTL - Daily percentile values

Synopsis

   daypctl,p  infile1 infile2 infile3 outfile

Description

This operator computes percentiles over all timesteps of the same day in infile1. The algorithm uses histograms with minimum and maximum bounds given in infile2 and infile3, respectively. The default number of histogram bins is 101. The default can be overridden by defining the environment variable CDO_PCTL_NBINS. The files infile2 and infile3 should be the result of corresponding daymin and daymax operations, respectively. The time of outfile is determined by the time in the middle of all contributing timesteps of infile1.

For every adjacent sequence t_1,...,t_n of timesteps of the same day it is:

o(t,x) = pth percentile{i(t,x),t1 < t′≤ tn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

PICT PICT

Environment

CDO_PCTL_NBINS  

Sets the number of histogram bins. The default number is 101.

Example

To compute the daily 90th percentile of a time series use:

  cdo daymin infile minfile 
  cdo daymax infile maxfile 
  cdo daypctl,90 infile minfile maxfile outfile

Or shorter using operator piping:

  cdo daypctl,90 infile -daymin infile -daymax infile outfile

PICT PICT

2.8.21  MONSTAT - Monthly statistical values

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over timesteps of the same month. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of timesteps of the same month is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

monmin  

Monthly minimum
For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = min{i(t,x),t1 < t′≤ tn}

monmax  

Monthly maximum
For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = max{i(t,x),t1 < t′≤ tn} PICT PICT

monsum  

Monthly sum
For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = sum{i(t,x),t1 < t′≤ tn}

monmean  

Monthly mean
For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

monavg  

Monthly average
For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = avg{i(t,x),t1 < t′≤ tn}

monstd  

Monthly standard deviation
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = std{i(t,x),t1 < t′≤ tn}

monstd1  

Monthly standard deviation (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = std1{i(t,x),t1 < t′≤ tn}

monvar  

Monthly variance
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = var{i(t,x),t1 < t′≤ tn}

monvar1  

Monthly variance (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:
o(t,x) = var1{i(t,x),t1 < t′≤ tn}

PICT PICT

Example

To compute the monthly mean of a time series use:

  cdo monmean infile outfile

PICT PICT

2.8.22  MONPCTL - Monthly percentile values

Synopsis

   monpctl,p  infile1 infile2 infile3 outfile

Description

This operator computes percentiles over all timesteps of the same month in infile1. The algorithm uses histograms with minimum and maximum bounds given in infile2 and infile3, respectively. The default number of histogram bins is 101. The default can be overridden by defining the environment variable CDO_PCTL_NBINS. The files infile2 and infile3 should be the result of corresponding monmin and monmax operations, respectively. The time of outfile is determined by the time in the middle of all contributing timesteps of infile1.

For every adjacent sequence t_1,...,t_n of timesteps of the same month it is:

o(t,x) = pth percentile{i(t,x),t1 < t′≤ tn}

Parameter

p  

FLOAT Percentile number in 0, ..., 100

PICT PICT

Environment

CDO_PCTL_NBINS  

Sets the number of histogram bins. The default number is 101.

Example

To compute the monthly 90th percentile of a time series use:

  cdo monmin infile minfile 
  cdo monmax infile maxfile 
  cdo monpctl,90 infile minfile maxfile outfile

Or shorter using operator piping:

  cdo monpctl,90 infile -monmin infile -monmax infile outfile

PICT PICT

2.8.23  YEARMONSTAT - Yearly mean from monthly data

Synopsis

   yearmonmean  infile outfile

Description

This operator computes the yearly mean of a monthly time series. Each month is weighted with the number of days per month. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

Environment

CDO_TIMESTAT_DATE  

Sets the date information in outfile to the "first", "middle" or "last" contributing timestep of infile.

Example

To compute the yearly mean of a monthly time series use:

  cdo yearmonmean infile outfile

PICT PICT

2.8.24  YEARSTAT - Yearly statistical values

Synopsis

   <operator>  infile outfile

Description

This module computes statistical values over timesteps of the same year. Depending on the chosen operator the minimum, maximum, sum, average, variance or standard deviation of timesteps of the same year is written to outfile. The time of outfile is determined by the time in the middle of all contributing timesteps of infile.

Operators

yearmin  

Yearly minimum
For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = min{i(t,x),t1 < t′≤ tn}

yearmax  

Yearly maximum
For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = max{i(t,x),t1 < t′≤ tn} PICT PICT

yearsum  

Yearly sum
For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = sum{i(t,x),t1 < t′≤ tn}

yearmean  

Yearly mean
For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = mean{i(t,x),t1 < t′≤ tn}

yearavg  

Yearly average
For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = avg{i(t,x),t1 < t′≤ tn}

yearstd  

Yearly standard deviation
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = std{i(t,x),t1 < t′≤ tn}

yearstd1  

Yearly standard deviation (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = std1{i(t,x),t1 < t′≤ tn}

yearvar  

Yearly variance
Normalize by n. For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = var{i(t,x),t1 < t′≤ tn}

yearvar1  

Yearly variance (n-1)
Normalize by (n-1). For every adjacent sequence t_1,...,t_n of timesteps of the same year it is:
o(t,x) = var1{i(t,x),t1 < t′≤ tn}

PICT PICT

Note

The operators yearmean and yearavg compute only arithmetical means!

Example

To compute the yearly mean of a time series use:

  cdo yearmean infile outfile

To compute the yearly mean from the correct weighted monthly mean use:

  cdo yearmonmean infile outfile