# Standard operators and functions¶

CliMAF includes a number of ‘Standard Operators’ and of ‘Object Functions’, which implement more or less basic climate diagnostics or utilities:

- All do return CliMAF objects.
- Operators are implemented as external scripts or binaries, while ‘object functions’ are implemented as python functions.
- operators can be used to define derived variables using function
`derive()`

, while ‘object functions’ cannot

Other functions exists, which do not return CliMAF objects (and are not called ‘object functions’) - see Available functions

The set of standard operators grows with scientists contributions (see ..contribute a diagnostic module). They are
documented here, through individual documentation files in
REStructured Text format and following
`this example`

which renders as shows here. For each
operator, the content of the doc file is also made available in the Python on-line help (see
..know which CliMAF operators are available and what they do).

Documented operators and ‘object functions’ as of today:

- arithmetic operations provided as ‘object functions’:

- climate data operators:

- spatial operations:

- regridll : regrid an object to a lat-lon box of a CDO regular grid

- object function
`lonlatpres_interpolation()`

- ml2pl : interpolates a field from model levels to pressure levels

- object functions computing a difference with regridding (typically to compute model biases):

- temporal operations:

- time_average : compute time average for all time steps
- object function
`clim_average()`

- object function
`annual_cycle()`

- statistical operators:
operators for creating figures:

Note

Overview on the output format to be used for ‘plot’ and ‘curves’ operators w.r.t. figure trimming:

- If you want a
PNGfigure,you just have to call ‘plot’ or ‘curves’, and argument ‘trim’ allows toremove extra white space. Note that resolution unit is in pixels

- If you want a
EPSoutput figure,you may need a further stepto remove extra whitespace: you have to use ‘cpdfcrop’ or ‘cepscrop’ operator (which are slow) respectively, after the figure plot. Note that resolution unit is in inches or using a standard paper size by name

Note

Overview on method to create

a page with several CliMAF figures:

`cpage()`

: this operator creates a PNG or PDF page of figures array using‘ImageMagick’, figures adjustment in the page is adapted to figures size. If you use ‘cpage’, you don’t need any pre-processing because:

- 1/ argument ‘fig_trim’ allows to trim extra white space of each figure;
- 2/ argument ‘page_trim’ allows to trim extra white space for the page

`cpage_pdf()`

: this operator creates a PDF page of figures array using ‘pdfjam’,figures adjustment in each array cell is automatically centered, you can’t adjust figures differently. So if you use ‘cpage_pdf’, you may need to do pre and post-treatment because:

- 1/ there is no argument ‘fig_trim’ allowing you to trim extra white space when generating pdf figures, so you must apply ‘cpdfcrop’ before cpage_pdf (on all figures)
- 2/ there is no argument ‘page_trim’ allowing you to trim extra white space when generating the page, so you must use ‘cpdfcrop’ on its output

So, to create an array of figures:

- If you want an
PNGoutput figure: you should use‘cpage’. If quality is not sufficient, increaseresolution of each figure (with argument ‘resolution’ of ‘curves’ or ‘plot’ operator) and also page resolution (with arguments ‘page_width’ and ‘page_height’ of ‘cpage’)

- If you want an

‘cpage_pdf’is highly recommended- if you want to have more control on figures adjustment in the page, use
‘cpage’and increase resolution of each figure and also of output page

- plot: map, cross-section and profile plot of one or two fields, and vectors plot over a map
`plot_params()`

- curves : plot multiple profiles (along p, lat, lon, time, …)
- ensemble_ts_plot : plot time series
- :py:func::~climaf.function.ts_plot
- hovm: plot Hovmöller diagrams on a given or global domain (SST/climate boxes, … )
`hovm_params()`

- cpdfcrop : crop pdf figures to their minimal size
- cepscrop : crop eps figures to their minimal size

- example for two outputs:

Albeit this is not a proper practice, **some more operators may exist in your CliMAF release** which would not be
documented here. Please see ..know which CliMAF operators are available and what they do for such cases

A name-sorted list:

- cLinearRegression : performs a linear regression between X and Y
- ccdfheatc : computes the heat content in the specified area (multi-variable input file)
- ccdfheatcm : computes the heat content in the specified area (mono-variable input file)
- ccdfmean : computes the mean value of the field (on full space domain, weighted)
- ccdfmean_profile : computes the vertical profile of horizontal means for 3D fields
- ccdfmean_profile_box : computes the vertical profile of horizontal means for 3D fields on a given geographical domain
- ccdfmxlheatc : computes the heat content in the mixed layer (multi-variable input file)
- ccdfmxlheatcm : computes the heat content in the mixed layer (mono-variable input file)
- ccdfsaltc : computes the salt content in the specified area
- ccdfsections : computes some variables (Uorth, Utang,…) along a section made of Nsec linear segments (multi-variable input file)
- ccdfsectionsm : computes some variables (Uorth, Utang,…) along a section made of Nsec linear segments (mono-variable input file)
- ccdfstd : computes the standard deviation of any variable
- ccdfstdmoy : computes the standard deviation and mean value of any variable
- ccdftransport : computes the transports accross a section
- ccdfvT : computes the time average values for V.T, V.S, U.T and U.S
- ccdfvar : computes the spatial variance of field (2D or 3D)
- ccdfvar_profile : computes the vertical profile of spatial variance for 3D fields
- ccdfzonalmean : compute the global zonal mean of the given variable
- ccdfzonalmean_bas : compute the zonal mean of the given variable in a specified sub-basin
- ccdo : invoke CDO with a unary operator
- ccdo2 : invoke CDO with a bianry operator (i.e. on two datasets)
- ccdo_ens : invoke CDO with a unary operator on an ensemble of datasets
- cepscrop : crop eps figures to their minimal size
- cpdfcrop : crop pdf figures to their minimal size
- curl_tau_atm : computes wind stress curl on regular grid (usually atmosphere)
- curves : plot multiple profiles (along p, lat, lon, time, …)
- divide : division between two CliMAF objects
- ensemble_ts_plot : plot time series
- hovm: plot Hovmöller diagrams on a given or global domain (SST/climate boxes, … )
- llbox : extract a latitude-longitude box
- mask : set a given value as missing value
- mean_and_std : field mean and standard deviation
- minus : difference of two fields using CDO operator sub
- ml2pl : interpolates a field from model levels to pressure levels
- multiply : multiplication between two CliMAF objects
- ncdump : show only the header information of a netCDF file
- ncpdq: netCDF Permute Dimensions Quickly
- ncview : launch ncview on a dataset
- plot: map, cross-section and profile plot of one or two fields, and vectors plot over a map
- plus : Addition of two fields using CDO operator add
- regrid : regrid an object to the grid of another one
- regridll : regrid an object to a lat-lon box of a CDO regular grid
- regridn : regrid an object to a named grid
- slice : extract a slice at a given dimension’s range
- space_average : compute space average
- time_average : compute time average for all time steps