Commit e305b290 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added operator ensrange.

parent 810745ec
......@@ -5,6 +5,7 @@
2017-06-02 Uwe Schulzweida
* New operator ensrange: Ensemble range (ensmax-ensmin)
* New operator vertrange: Vertical range (vertmax-vertmin)
* New operator merrange: Meridional range (mermax-mermin)
* New operator gridboxrange: Gridbox range (gribboxmax-gridboxmin)
......
......@@ -243,6 +243,7 @@ Operator catalog:
Consecstat consects Consecutive Timesteps
Ensstat ensmin Ensemble minimum
Ensstat ensmax Ensemble maximum
Ensstat ensrange Ensemble range
Ensstat enssum Ensemble sum
Ensstat ensmean Ensemble mean
Ensstat ensavg Ensemble average
......
......@@ -5,11 +5,11 @@
@Section = Statistical values
@Class = Statistic
@Arguments = infiles outfile
@Operators = ensmin ensmax enssum ensmean ensavg ensstd ensstd1 ensvar ensvar1 enspctl
@Operators = ensmin ensmax ensrange enssum ensmean ensavg ensstd ensstd1 ensvar ensvar1 enspctl
@BeginDescription
This module computes statistical values over an ensemble of input files.
Depending on the chosen operator the minimum, maximum, sum, average, variance,
Depending on the chosen operator the minimum, maximum, range, sum, average, variance,
standard deviation or a certain percentile over all input files is written
to @file{outfile}.
All input files need to have the same structure with the same variables.
......@@ -33,6 +33,7 @@ o(t,x) = \mbox{\textbf{min}}\{i_1(t,x), i_2(t,x), \cdots, i_n(t,x)\}
@EndDescription
@EndOperator
@BeginOperator_ensmax
@Title = Ensemble maximum
......@@ -49,6 +50,22 @@ o(t,x) = \mbox{\textbf{max}}\{i_1(t,x), i_2(t,x), \cdots, i_n(t,x)\}
@EndOperator
@BeginOperator_ensrange
@Title = Ensemble range
@BeginDescription
@IfMan
o(t,x) = range{i1(t,x), i2(t,x), ..., in(t,x)}
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \mbox{\textbf{range}}\{i_1(t,x), i_2(t,x), \cdots, i_n(t,x)\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator
@BeginOperator_enssum
@Title = Ensemble sum
......
......@@ -18,6 +18,7 @@
/*
This module contains the following operators:
Ensstat ensrange Ensemble range
Ensstat ensmin Ensemble minimum
Ensstat ensmax Ensemble maximum
Ensstat enssum Ensemble sum
......@@ -141,16 +142,17 @@ void *Ensstat(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("ensmin", func_min, 0, NULL);
cdoOperatorAdd("ensmax", func_max, 0, NULL);
cdoOperatorAdd("enssum", func_sum, 0, NULL);
cdoOperatorAdd("ensmean", func_mean, 0, NULL);
cdoOperatorAdd("ensavg", func_avg, 0, NULL);
cdoOperatorAdd("ensstd", func_std, 0, NULL);
cdoOperatorAdd("ensstd1", func_std1, 0, NULL);
cdoOperatorAdd("ensvar", func_var, 0, NULL);
cdoOperatorAdd("ensvar1", func_var1, 0, NULL);
cdoOperatorAdd("enspctl", func_pctl, 0, NULL);
cdoOperatorAdd("ensrange", func_range, 0, NULL);
cdoOperatorAdd("ensmin", func_min, 0, NULL);
cdoOperatorAdd("ensmax", func_max, 0, NULL);
cdoOperatorAdd("enssum", func_sum, 0, NULL);
cdoOperatorAdd("ensmean", func_mean, 0, NULL);
cdoOperatorAdd("ensavg", func_avg, 0, NULL);
cdoOperatorAdd("ensstd", func_std, 0, NULL);
cdoOperatorAdd("ensstd1", func_std1, 0, NULL);
cdoOperatorAdd("ensvar", func_var, 0, NULL);
cdoOperatorAdd("ensvar1", func_var1, 0, NULL);
cdoOperatorAdd("enspctl", func_pctl, 0, NULL);
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......@@ -370,16 +372,17 @@ void *Ensstat(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("ensmin", func_min, 0, NULL);
cdoOperatorAdd("ensmax", func_max, 0, NULL);
cdoOperatorAdd("enssum", func_sum, 0, NULL);
cdoOperatorAdd("ensmean", func_mean, 0, NULL);
cdoOperatorAdd("ensavg", func_avg, 0, NULL);
cdoOperatorAdd("ensstd", func_std, 0, NULL);
cdoOperatorAdd("ensstd1", func_std1, 0, NULL);
cdoOperatorAdd("ensvar", func_var, 0, NULL);
cdoOperatorAdd("ensvar1", func_var1, 0, NULL);
cdoOperatorAdd("enspctl", func_pctl, 0, NULL);
cdoOperatorAdd("ensrange", func_range, 0, NULL);
cdoOperatorAdd("ensmin", func_min, 0, NULL);
cdoOperatorAdd("ensmax", func_max, 0, NULL);
cdoOperatorAdd("enssum", func_sum, 0, NULL);
cdoOperatorAdd("ensmean", func_mean, 0, NULL);
cdoOperatorAdd("ensavg", func_avg, 0, NULL);
cdoOperatorAdd("ensstd", func_std, 0, NULL);
cdoOperatorAdd("ensstd1", func_std1, 0, NULL);
cdoOperatorAdd("ensvar", func_var, 0, NULL);
cdoOperatorAdd("ensvar1", func_var1, 0, NULL);
cdoOperatorAdd("enspctl", func_pctl, 0, NULL);
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......
......@@ -319,7 +319,7 @@ void *Samplegrid(void *argument); // "samplegrid", "subgrid"
#define Echam5iniOperators {"import_e5ml", "import_e5res", "export_e5ml", "export_e5res"}
#define EnlargeOperators {"enlarge"}
#define EnlargegridOperators {"enlargegrid"}
#define EnsstatOperators {"ensmin", "ensmax", "enssum", "ensmean", "ensavg", "ensvar", "ensvar1", "ensstd", "ensstd1", "enspctl"}
#define EnsstatOperators {"ensrange", "ensmin", "ensmax", "enssum", "ensmean", "ensavg", "ensvar", "ensvar1", "ensstd", "ensstd1", "enspctl"}
#define Ensstat3Operators {"ensrkhistspace", "ensrkhisttime", "ensroc"}
#define EnsvalOperators {"enscrps", "ensbrs"}
#define EofcoeffOperators {"eofcoeff"}
......
......@@ -1816,8 +1816,8 @@ std::vector<std::string> ConsecstatHelp = {
std::vector<std::string> EnsstatHelp = {
"NAME",
" ensmin, ensmax, enssum, ensmean, ensavg, ensstd, ensstd1, ensvar, ensvar1, ",
" enspctl - Statistical values over an ensemble",
" ensmin, ensmax, ensrange, enssum, ensmean, ensavg, ensstd, ensstd1, ensvar, ",
" ensvar1, enspctl - Statistical values over an ensemble",
"",
"SYNOPSIS",
" <operator> infiles outfile",
......@@ -1825,41 +1825,43 @@ std::vector<std::string> EnsstatHelp = {
"",
"DESCRIPTION",
" This module computes statistical values over an ensemble of input files.",
" Depending on the chosen operator the minimum, maximum, sum, average, variance,",
" Depending on the chosen operator the minimum, maximum, range, 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)}",
" 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)}",
" 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)}",
" ensrange Ensemble range",
" o(t,x) = range{i1(t,x), i2(t,x), ..., in(t,x)}",
" 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)}",
"",
"PARAMETER",
" p FLOAT Percentile number in {0, ..., 100}",
......
#! @BASH@
echo 1..9 # Number of tests to be executed.
echo 1..10 # Number of tests to be executed.
#
test -n "$CDO" || CDO=cdo
test -n "$DATAPATH" || DATAPATH=./data
#
CDOOUT=cout$$
CDOERR=cerr$$
STATS="min max sum avg mean std std1 var var1"
STATS="min max range sum avg mean std std1 var var1"
#
IFILE=$DATAPATH/ts_mm_5years
export CDO_FILE_SUFFIX=NULL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment