CDO - 其他操作

本篇随笔将介绍 CDO 的其他功能,如:滤波、平滑、统计等功能

其他操作 Miscellaneous Operators

时间序列滤波

<operator>,parameter infile outfile

OperatorsDescription
bandpass,fmin,fmax带通滤波(通过 fminfmax 之间的频率)
lowpass,fmax低通滤波(通过低于 fmax 的频率)
highpass,fmin高通滤波(通过高于 fmin 的频率)
  • 例子
    假设数据是每小时的,时间周期为 5 年,但日历为 365/366 天,过滤掉 大于等于一年 的时间尺度的变化:

    1
    cdo highpass,1 -del29feb infile outfile  

    假设数据是每小时的,时间周期为 5 年,但日历为 365/366 天,过滤掉 小于等于一年 的时间尺度的变化:

    1
    cdo lowpass,1 -del29feb infile outfile  

    假设数据是每小时的,时间周期为 5 年,但日历为 365/366 天,过滤掉季节循环和年际变化:

    1
    cdo bandpass,0.25,1 -del29feb infile outfile  

空间网格平滑

<operator>[,options] infile outfile

OperatorsDescription
smooth[,options]对所有输入域进行 nsmooth 点平滑,使用的点的数量取决于参数搜索半径 radius 和最大点的数量 maxpoints
OptionsTypeDescription
nsmoothINTEGER平滑次数,默认为 nsmooth=1
radiusSTRING搜索半径,默认为 radius=1deg ;(单位:deg,rad,km,m)
maxpointsINTEGER搜索最大点数,默认为 maxpoints=<gridsize>
formSTRING曲线形式,默认为 form=linear
weight0FLOAT距离为 0 的权重,默认为 weight0=0.25
weightRFLOAT距离为搜索半径的权重,默认为 weightR=0.25

<operator> infile outfile

OperatorsDescription
smooth9九点平滑,每个格点的结果是格点加上周围8个点的加权平均值;
中心点的权重为 1.0,两侧及上下各点的权重为 0.5,角点的权重为 0.3

计算时间步之间的步长

<operator> infile outfile

OperatorsDescription
deltat计算每个时间步之间的差值

Timsort 时间排序

<operator> infile outfile

OperatorsDescription
timsort对每个字段位置的所有时间步按升序对元素进行排序:

Generate a field 生成字段

<operator>,parameter outfile

OperatorsDescription
const,const,grid创建一个常量字段,网格中的所有字段元素都具有相同的值 const
random,grid[,seed]创建一个 [0, 1] 区间内随机分布的字段
topo[,grid]创建一个地形数据的字段,默认网格为全球 0.5° 分辨率
seq,start,end[,inc]创建一个一维的时间序列
stdatm,levels创建 流体静力大气 的气压和温度值字段;这是流体静力学方程的解,只对对流层有效
  • 例子
    要在给定的水平网格上创建标准大气数据集:

    1
    cdo enlarge,gridfile -stdatm,10000,8000,5000,3000,2000,1000,500,200,0 outfile  

Derived model parameters 推导海平面气压和位势高度

<operator> infile outfile

OperatorsDescription
sealevelpressure根据变量 surface_air_pressuresurface_geopotentialair_temperature 计算海平面气压 air_pressure_at_sea_level
gheight根据变量 surface_air_pressuresurface_geopotentialspecific_humidityair_temperature 计算位势高度 geopotential_height

Histogram

<operator>,bounds infile outfile

OperatorsDescription
histcount,bounds统计 bin 范围中的元素数量 ;
参数 bounds 为用逗号分隔的 bin 边界的列表
histsum,bounds统计 bin 范围中的元素的和
histmean,bounds统计 bin 范围中的元素的均值
histfreq,bounds统计 bin 范围中的元素的相对频率