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

Added operator gridboxrange.

parent 72097c87
......@@ -3,6 +3,10 @@
* Using CDI library version 1.9.0
* Version 1.9.0 release
2017-06-02 Uwe Schulzweida
* New operator gridboxrange: gridbox range (gribboxmax-gridboxmin)
2017-06-01 Uwe Schulzweida
* New operator yhourrange: Multi-year hourly range (yhourmax-yhourmin)
......
......@@ -290,6 +290,7 @@ Operator catalog:
Merstat merpctl Meridional percentiles
Gridboxstat gridboxmin Gridbox minimum
Gridboxstat gridboxmax Gridbox maximum
Gridboxstat gridboxrange Gridbox range
Gridboxstat gridboxsum Gridbox sum
Gridboxstat gridboxmean Gridbox mean
Gridboxstat gridboxavg Gridbox average
......
......@@ -5,7 +5,7 @@
@Section = Statistical values
@Class = Statistic
@Arguments = infile outfile
@Operators = gridboxmin gridboxmax gridboxsum gridboxmean gridboxavg gridboxstd gridboxstd1 gridboxvar gridboxvar1
@Operators = gridboxmin gridboxmax gridboxrange gridboxsum gridboxmean gridboxavg gridboxstd gridboxstd1 gridboxvar gridboxvar1
@BeginDescription
This module computes statistical values over surrounding grid boxes.
......@@ -36,6 +36,16 @@ Maximum value of the selected grid boxes.
@EndOperator
@BeginOperator_gridboxrange
@Title = Gridbox range
@Parameter = nx ny
@BeginDescription
Range (max-min value) of the selected grid boxes.
@EndDescription
@EndOperator
@BeginOperator_gridboxsum
@Title = Gridbox sum
@Parameter = nx ny
......
......@@ -18,6 +18,7 @@
/*
This module contains the following operators:
Gridboxstat gridboxrange Gridbox range
Gridboxstat gridboxmin Gridbox minimum
Gridboxstat gridboxmax Gridbox maximum
Gridboxstat gridboxsum Gridbox sum
......@@ -551,15 +552,16 @@ void *Gridboxstat(void *argument)
int xinc = parameter2int(operatorArgv()[0]);
int yinc = parameter2int(operatorArgv()[1]);
cdoOperatorAdd("gridboxmin", func_min, 0, NULL);
cdoOperatorAdd("gridboxmax", func_max, 0, NULL);
cdoOperatorAdd("gridboxsum", func_sum, 0, NULL);
cdoOperatorAdd("gridboxmean", func_meanw, 1, NULL);
cdoOperatorAdd("gridboxavg", func_avgw, 1, NULL);
cdoOperatorAdd("gridboxvar", func_varw, 1, NULL);
cdoOperatorAdd("gridboxvar1", func_var1w, 1, NULL);
cdoOperatorAdd("gridboxstd", func_stdw, 1, NULL);
cdoOperatorAdd("gridboxstd1", func_std1w, 1, NULL);
cdoOperatorAdd("gridboxrange", func_range, 0, NULL);
cdoOperatorAdd("gridboxmin", func_min, 0, NULL);
cdoOperatorAdd("gridboxmax", func_max, 0, NULL);
cdoOperatorAdd("gridboxsum", func_sum, 0, NULL);
cdoOperatorAdd("gridboxmean", func_meanw, 1, NULL);
cdoOperatorAdd("gridboxavg", func_avgw, 1, NULL);
cdoOperatorAdd("gridboxvar", func_varw, 1, NULL);
cdoOperatorAdd("gridboxvar1", func_var1w, 1, NULL);
cdoOperatorAdd("gridboxstd", func_stdw, 1, NULL);
cdoOperatorAdd("gridboxstd1", func_std1w, 1, NULL);
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......
......@@ -73,15 +73,15 @@ void *Ydrunstat(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("ydrunmin", func_min, 0, NULL);
cdoOperatorAdd("ydrunmax", func_max, 0, NULL);
cdoOperatorAdd("ydrunsum", func_sum, 0, NULL);
cdoOperatorAdd("ydrunmean", func_mean, 0, NULL);
cdoOperatorAdd("ydrunavg", func_avg, 0, NULL);
cdoOperatorAdd("ydrunvar", func_var, 0, NULL);
cdoOperatorAdd("ydrunvar1", func_var1, 0, NULL);
cdoOperatorAdd("ydrunstd", func_std, 0, NULL);
cdoOperatorAdd("ydrunstd1", func_std1, 0, NULL);
cdoOperatorAdd("ydrunmin", func_min, 0, NULL);
cdoOperatorAdd("ydrunmax", func_max, 0, NULL);
cdoOperatorAdd("ydrunsum", func_sum, 0, NULL);
cdoOperatorAdd("ydrunmean", func_mean, 0, NULL);
cdoOperatorAdd("ydrunavg", func_avg, 0, NULL);
cdoOperatorAdd("ydrunvar", func_var, 0, NULL);
cdoOperatorAdd("ydrunvar1", func_var1, 0, NULL);
cdoOperatorAdd("ydrunstd", func_std, 0, NULL);
cdoOperatorAdd("ydrunstd1", func_std1, 0, NULL);
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
......@@ -155,7 +155,7 @@ void *Ydrunstat(void *argument)
if ( lvarstd )
{
farmoq(pvars2, *pvars1);
for ( inp = 0; inp < tsID; inp++ )
for ( int inp = 0; inp < tsID; inp++ )
{
farsumq(&vars2[inp][varID][levelID], *pvars1);
farsum(&vars1[inp][varID][levelID], *pvars1);
......@@ -163,7 +163,7 @@ void *Ydrunstat(void *argument)
}
else
{
for ( inp = 0; inp < tsID; inp++ )
for ( int inp = 0; inp < tsID; inp++ )
{
farfun(&vars1[inp][varID][levelID], *pvars1, operfunc);
}
......@@ -360,13 +360,13 @@ static
void ydstatUpdate(YDAY_STATS *stats, int vdate, int vtime,
field_type **vars1, field_type **vars2, int nsets, int operfunc)
{
int varID, levelID, nvars, nlevels;
int varID, levelID, nlevels;
int gridsize;
int year, month, day, dayoy;
bool lvarstd = vars2 != NULL;
nvars = vlistNvars(stats->vlist);
int nvars = vlistNvars(stats->vlist);
cdiDecodeDate(vdate, &year, &month, &day);
......@@ -429,11 +429,11 @@ void ydstatUpdate(YDAY_STATS *stats, int vdate, int vtime,
static
void ydstatFinalize(YDAY_STATS *stats, int operfunc)
{
int varID, levelID, nvars, nlevels;
int varID, levelID, nlevels;
int dayoy;
int divisor = operfunc == func_std1 || operfunc == func_var1;
nvars = vlistNvars(stats->vlist);
int nvars = vlistNvars(stats->vlist);
for ( dayoy = 0; dayoy < NDAY; dayoy++ )
if ( stats->nsets[dayoy] )
......
......@@ -339,7 +339,7 @@ void *Samplegrid(void *argument); // "samplegrid", "subgrid"
#define FourierOperators {"fourier"}
#define GengridOperators {"gengrid"}
#define GradsdesOperators {"gradsdes", "dumpmap"}
#define GridboxstatOperators {"gridboxmin", "gridboxmax", "gridboxsum", "gridboxmean", "gridboxavg", "gridboxstd", "gridboxstd1", "gridboxvar", "gridboxvar1"}
#define GridboxstatOperators {"gridboxrange", "gridboxmin", "gridboxmax", "gridboxsum", "gridboxmean", "gridboxavg", "gridboxstd", "gridboxstd1", "gridboxvar", "gridboxvar1"}
#define GridcellOperators {"gridarea", "gridweights", "gridmask", "griddx", "griddy"}
#define GridsearchOperators {"testpointsearch", "testcellsearch"}
#define HarmonicOperators {"harmonic"}
......
......@@ -2126,8 +2126,9 @@ std::vector<std::string> MerstatHelp = {
std::vector<std::string> GridboxstatHelp = {
"NAME",
" gridboxmin, gridboxmax, gridboxsum, gridboxmean, gridboxavg, gridboxstd, ",
" gridboxstd1, gridboxvar, gridboxvar1 - Statistical values over grid boxes",
" gridboxmin, gridboxmax, gridboxrange, gridboxsum, gridboxmean, gridboxavg, ",
" gridboxstd, gridboxstd1, gridboxvar, gridboxvar1 - ",
" Statistical values over grid boxes",
"",
"SYNOPSIS",
" <operator>,nx,ny infile outfile",
......@@ -2139,24 +2140,26 @@ std::vector<std::string> GridboxstatHelp = {
" 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.",
" 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).",
" gridboxmin Gridbox minimum",
" Minimum value of the selected grid boxes.",
" gridboxmax Gridbox maximum",
" Maximum value of the selected grid boxes.",
" gridboxrange Gridbox range",
" Range (max-min value) of the selected grid boxes.",
" gridboxsum Gridbox sum",
" Sum of the selected grid boxes.",
" 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",
......
#! @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
......@@ -9,7 +9,7 @@ CDOERR=cerr$$
FORMAT="-f srv -b 32"
#
TYPE=gridbox
STATS="min max sum avg mean std std1 var var1"
STATS="min max range sum avg mean std std1 var var1"
#
IFILE=$DATAPATH/t21_geosp_tsurf.grb
#
......
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