Commit 52796f5a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed fldstd() to fldstdw() and fldvar() to fldvarw().

parent ac753d03
...@@ -56,10 +56,10 @@ void *Ensstat(void *argument) ...@@ -56,10 +56,10 @@ void *Ensstat(void *argument)
cdoOperatorAdd("enssum", func_sum, 0, NULL); cdoOperatorAdd("enssum", func_sum, 0, NULL);
cdoOperatorAdd("ensmean", func_mean, 0, NULL); cdoOperatorAdd("ensmean", func_mean, 0, NULL);
cdoOperatorAdd("ensavg", func_avg, 0, NULL); cdoOperatorAdd("ensavg", func_avg, 0, NULL);
cdoOperatorAdd("ensstd", func_std, 0, NULL); cdoOperatorAdd("ensstd", func_stdw, 0, NULL);
cdoOperatorAdd("ensstd1", func_std1, 0, NULL); cdoOperatorAdd("ensstd1", func_std1w, 0, NULL);
cdoOperatorAdd("ensvar", func_var, 0, NULL); cdoOperatorAdd("ensvar", func_varw, 0, NULL);
cdoOperatorAdd("ensvar1", func_var1, 0, NULL); cdoOperatorAdd("ensvar1", func_var1w, 0, NULL);
cdoOperatorAdd("enspctl", func_pctl, 0, NULL); cdoOperatorAdd("enspctl", func_pctl, 0, NULL);
int operatorID = cdoOperatorID(); int operatorID = cdoOperatorID();
......
...@@ -100,10 +100,10 @@ void *Fldstat(void *argument) ...@@ -100,10 +100,10 @@ void *Fldstat(void *argument)
cdoOperatorAdd("fldsum", func_sum, 0, NULL); cdoOperatorAdd("fldsum", func_sum, 0, NULL);
cdoOperatorAdd("fldmean", func_meanw, 1, NULL); cdoOperatorAdd("fldmean", func_meanw, 1, NULL);
cdoOperatorAdd("fldavg", func_avgw, 1, NULL); cdoOperatorAdd("fldavg", func_avgw, 1, NULL);
cdoOperatorAdd("fldstd", func_std, 1, NULL); cdoOperatorAdd("fldstd", func_stdw, 1, NULL);
cdoOperatorAdd("fldstd1", func_std1, 1, NULL); cdoOperatorAdd("fldstd1", func_std1w, 1, NULL);
cdoOperatorAdd("fldvar", func_var, 1, NULL); cdoOperatorAdd("fldvar", func_varw, 1, NULL);
cdoOperatorAdd("fldvar1", func_var1, 1, NULL); cdoOperatorAdd("fldvar1", func_var1w, 1, NULL);
cdoOperatorAdd("fldpctl", func_pctl, 0, NULL); cdoOperatorAdd("fldpctl", func_pctl, 0, NULL);
int operatorID = cdoOperatorID(); int operatorID = cdoOperatorID();
......
...@@ -556,10 +556,10 @@ void *Gridboxstat(void *argument) ...@@ -556,10 +556,10 @@ void *Gridboxstat(void *argument)
cdoOperatorAdd("gridboxsum", func_sum, 0, NULL); cdoOperatorAdd("gridboxsum", func_sum, 0, NULL);
cdoOperatorAdd("gridboxmean", func_meanw, 1, NULL); cdoOperatorAdd("gridboxmean", func_meanw, 1, NULL);
cdoOperatorAdd("gridboxavg", func_avgw, 1, NULL); cdoOperatorAdd("gridboxavg", func_avgw, 1, NULL);
cdoOperatorAdd("gridboxvar", func_var, 1, NULL); cdoOperatorAdd("gridboxvar", func_varw, 1, NULL);
cdoOperatorAdd("gridboxvar1", func_var1, 1, NULL); cdoOperatorAdd("gridboxvar1", func_var1w, 1, NULL);
cdoOperatorAdd("gridboxstd", func_std, 1, NULL); cdoOperatorAdd("gridboxstd", func_stdw, 1, NULL);
cdoOperatorAdd("gridboxstd1", func_std1, 1, NULL); cdoOperatorAdd("gridboxstd1", func_std1w, 1, NULL);
int operatorID = cdoOperatorID(); int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID); int operfunc = cdoOperatorF1(operatorID);
......
...@@ -46,7 +46,6 @@ void *Merstat(void *argument) ...@@ -46,7 +46,6 @@ void *Merstat(void *argument)
int nmiss; int nmiss;
int nrecs; int nrecs;
int varID, levelID; int varID, levelID;
bool needWeights = false;
char varname[CDI_MAX_NAME]; char varname[CDI_MAX_NAME];
cdoInitialize(argument); cdoInitialize(argument);
...@@ -54,16 +53,17 @@ void *Merstat(void *argument) ...@@ -54,16 +53,17 @@ void *Merstat(void *argument)
cdoOperatorAdd("mermin", func_min, 0, NULL); cdoOperatorAdd("mermin", func_min, 0, NULL);
cdoOperatorAdd("mermax", func_max, 0, NULL); cdoOperatorAdd("mermax", func_max, 0, NULL);
cdoOperatorAdd("mersum", func_sum, 0, NULL); cdoOperatorAdd("mersum", func_sum, 0, NULL);
cdoOperatorAdd("mermean", func_meanw, 0, NULL); cdoOperatorAdd("mermean", func_meanw, 1, NULL);
cdoOperatorAdd("meravg", func_avgw, 0, NULL); cdoOperatorAdd("meravg", func_avgw, 1, NULL);
cdoOperatorAdd("mervar", func_var, 0, NULL); cdoOperatorAdd("mervar", func_varw, 1, NULL);
cdoOperatorAdd("mervar1", func_var1, 0, NULL); cdoOperatorAdd("mervar1", func_var1w, 1, NULL);
cdoOperatorAdd("merstd", func_std, 0, NULL); cdoOperatorAdd("merstd", func_stdw, 1, NULL);
cdoOperatorAdd("merstd1", func_std1, 0, NULL); cdoOperatorAdd("merstd1", func_std1w, 1, NULL);
cdoOperatorAdd("merpctl", func_pctl, 0, NULL); cdoOperatorAdd("merpctl", func_pctl, 0, NULL);
int operatorID = cdoOperatorID(); int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID); int operfunc = cdoOperatorF1(operatorID);
bool needWeights = cdoOperatorF2(operatorID) != 0;
double pn = 0; double pn = 0;
if ( operfunc == func_pctl ) if ( operfunc == func_pctl )
...@@ -73,11 +73,6 @@ void *Merstat(void *argument) ...@@ -73,11 +73,6 @@ void *Merstat(void *argument)
percentile_check_number(pn); percentile_check_number(pn);
} }
if ( operfunc == func_meanw || operfunc == func_avgw ||
operfunc == func_var || operfunc == func_std ||
operfunc == func_var1 || operfunc == func_std1 )
needWeights = true;
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = streamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1); int vlistID1 = streamInqVlist(streamID1);
......
...@@ -119,10 +119,10 @@ static func_t fun_sym_tbl[] = ...@@ -119,10 +119,10 @@ static func_t fun_sym_tbl[] =
{FT_FLD, 0, "fldsum", (double (*)()) fldsum}, {FT_FLD, 0, "fldsum", (double (*)()) fldsum},
{FT_FLD, 1, "fldmean", (double (*)()) fldmeanw}, {FT_FLD, 1, "fldmean", (double (*)()) fldmeanw},
{FT_FLD, 1, "fldavg", (double (*)()) fldavgw}, {FT_FLD, 1, "fldavg", (double (*)()) fldavgw},
{FT_FLD, 1, "fldstd", (double (*)()) fldstd}, {FT_FLD, 1, "fldstd", (double (*)()) fldstdw},
{FT_FLD, 1, "fldstd1", (double (*)()) fldstd1}, {FT_FLD, 1, "fldstd1", (double (*)()) fldstd1w},
{FT_FLD, 1, "fldvar", (double (*)()) fldvar}, {FT_FLD, 1, "fldvar", (double (*)()) fldvarw},
{FT_FLD, 1, "fldvar1", (double (*)()) fldvar1}, {FT_FLD, 1, "fldvar1", (double (*)()) fldvar1w},
// cdo field functions (Reduce level to point) // cdo field functions (Reduce level to point)
{FT_VERT, 0, "vertmin", (double (*)()) fldmin}, {FT_VERT, 0, "vertmin", (double (*)()) fldmin},
...@@ -130,10 +130,10 @@ static func_t fun_sym_tbl[] = ...@@ -130,10 +130,10 @@ static func_t fun_sym_tbl[] =
{FT_VERT, 0, "vertsum", (double (*)()) fldsum}, {FT_VERT, 0, "vertsum", (double (*)()) fldsum},
{FT_VERT, 1, "vertmean", (double (*)()) fldmeanw}, {FT_VERT, 1, "vertmean", (double (*)()) fldmeanw},
{FT_VERT, 1, "vertavg", (double (*)()) fldavgw}, {FT_VERT, 1, "vertavg", (double (*)()) fldavgw},
{FT_VERT, 1, "vertstd", (double (*)()) fldstd}, {FT_VERT, 1, "vertstd", (double (*)()) fldstdw},
{FT_VERT, 1, "vertstd1", (double (*)()) fldstd1}, {FT_VERT, 1, "vertstd1", (double (*)()) fldstd1w},
{FT_VERT, 1, "vertvar", (double (*)()) fldvar}, {FT_VERT, 1, "vertvar", (double (*)()) fldvarw},
{FT_VERT, 1, "vertvar1", (double (*)()) fldvar1}, {FT_VERT, 1, "vertvar1", (double (*)()) fldvar1w},
{FT_COORD, 0, "clon", NULL}, {FT_COORD, 0, "clon", NULL},
{FT_COORD, 0, "clat", NULL}, {FT_COORD, 0, "clat", NULL},
......
...@@ -37,10 +37,10 @@ double fldfun(field_type field, int function) ...@@ -37,10 +37,10 @@ double fldfun(field_type field, int function)
case func_meanw: rval = fldmeanw(field); break; case func_meanw: rval = fldmeanw(field); break;
case func_avg: rval = fldavg(field); break; case func_avg: rval = fldavg(field); break;
case func_avgw: rval = fldavgw(field); break; case func_avgw: rval = fldavgw(field); break;
case func_std: rval = fldstd(field); break; case func_stdw: rval = fldstdw(field); break;
case func_std1: rval = fldstd1(field); break; case func_std1w: rval = fldstd1w(field); break;
case func_var: rval = fldvar(field); break; case func_varw: rval = fldvarw(field); break;
case func_var1: rval = fldvar1(field); break; case func_var1w: rval = fldvar1w(field); break;
case func_crps: rval = fldcrps(field); break; case func_crps: rval = fldcrps(field); break;
case func_brs: rval = fldbrs(field); break; case func_brs: rval = fldbrs(field); break;
case func_rank: rval = fldrank(field); break; case func_rank: rval = fldrank(field); break;
...@@ -440,7 +440,7 @@ void prevarsumw(const double *restrict array, const double *restrict w, size_t l ...@@ -440,7 +440,7 @@ void prevarsumw(const double *restrict array, const double *restrict w, size_t l
} }
double fldvar(field_type field) double fldvarw(field_type field)
{ {
const int nmiss = field.nmiss > 0; const int nmiss = field.nmiss > 0;
const size_t len = field.size; const size_t len = field.size;
...@@ -457,7 +457,7 @@ double fldvar(field_type field) ...@@ -457,7 +457,7 @@ double fldvar(field_type field)
} }
double fldvar1(field_type field) double fldvar1w(field_type field)
{ {
const int nmiss = field.nmiss > 0; const int nmiss = field.nmiss > 0;
const size_t len = field.size; const size_t len = field.size;
...@@ -490,15 +490,15 @@ double var_to_std(double rvar, double missval) ...@@ -490,15 +490,15 @@ double var_to_std(double rvar, double missval)
return rstd; return rstd;
} }
double fldstd(field_type field) double fldstdw(field_type field)
{ {
return var_to_std(fldvar(field), field.missval); return var_to_std(fldvarw(field), field.missval);
} }
double fldstd1(field_type field) double fldstd1w(field_type field)
{ {
return var_to_std(fldvar1(field), field.missval); return var_to_std(fldvar1w(field), field.missval);
} }
......
...@@ -115,10 +115,10 @@ double fldavg(field_type field); ...@@ -115,10 +115,10 @@ double fldavg(field_type field);
double fldavgw(field_type field); double fldavgw(field_type field);
double fldmean(field_type field); double fldmean(field_type field);
double fldmeanw(field_type field); double fldmeanw(field_type field);
double fldstd(field_type field); double fldstdw(field_type field);
double fldstd1(field_type field); double fldstd1w(field_type field);
double fldvar(field_type field); double fldvarw(field_type field);
double fldvar1(field_type field); double fldvar1w(field_type field);
double fldpctl(field_type field, const double pn); double fldpctl(field_type field, const double pn);
void fldunm(field_type *field); void fldunm(field_type *field);
int fldhvs(field_type *field, const size_t nlevels); int fldhvs(field_type *field, const size_t nlevels);
...@@ -152,10 +152,10 @@ void mermax(field_type field1, field_type *field2); ...@@ -152,10 +152,10 @@ void mermax(field_type field1, field_type *field2);
void mersum(field_type field1, field_type *field2); void mersum(field_type field1, field_type *field2);
void meravgw(field_type field1, field_type *field2); void meravgw(field_type field1, field_type *field2);
void mermeanw(field_type field1, field_type *field2); void mermeanw(field_type field1, field_type *field2);
void merstd(field_type field1, field_type *field2); void merstdw(field_type field1, field_type *field2);
void merstd1(field_type field1, field_type *field2); void merstd1w(field_type field1, field_type *field2);
void mervar(field_type field1, field_type *field2); void mervarw(field_type field1, field_type *field2);
void mervar1(field_type field1, field_type *field2); void mervar1w(field_type field1, field_type *field2);
void merpctl(field_type field1, field_type *field2, const int k); void merpctl(field_type field1, field_type *field2, const int k);
void fldrms(field_type field1, field_type field2, field_type *field3); void fldrms(field_type field1, field_type field2, field_type *field3);
......
...@@ -30,10 +30,10 @@ void merfun(field_type field1, field_type *field2, int function) ...@@ -30,10 +30,10 @@ void merfun(field_type field1, field_type *field2, int function)
case func_sum: mersum(field1, field2); break; case func_sum: mersum(field1, field2); break;
case func_meanw: mermeanw(field1, field2); break; case func_meanw: mermeanw(field1, field2); break;
case func_avgw: meravgw(field1, field2); break; case func_avgw: meravgw(field1, field2); break;
case func_std: merstd(field1, field2); break; case func_stdw: merstdw(field1, field2); break;
case func_std1: merstd1(field1, field2); break; case func_std1w: merstd1w(field1, field2); break;
case func_var: mervar(field1, field2); break; case func_varw: mervarw(field1, field2); break;
case func_var1: mervar1(field1, field2); break; case func_var1w: mervar1w(field1, field2); break;
default: cdoAbort("function %d not implemented!", function); default: cdoAbort("function %d not implemented!", function);
} }
} }
...@@ -267,8 +267,8 @@ void meravgw(field_type field1, field_type *field2) ...@@ -267,8 +267,8 @@ void meravgw(field_type field1, field_type *field2)
} }
static static
void prevarsum_mer(const double *restrict array, const double *restrict w, int nx, int ny, int nmiss, void prevarsum_merw(const double *restrict array, const double *restrict w, int nx, int ny, int nmiss,
double missval, double *restrict rsum, double *restrict rsumw, double *restrict rsumq, double *restrict rsumwq) double missval, double *restrict rsum, double *restrict rsumw, double *restrict rsumq, double *restrict rsumwq)
{ {
*rsum = 0; *rsum = 0;
*rsumq = 0; *rsumq = 0;
...@@ -300,7 +300,7 @@ void prevarsum_mer(const double *restrict array, const double *restrict w, int n ...@@ -300,7 +300,7 @@ void prevarsum_mer(const double *restrict array, const double *restrict w, int n
} }
void mervar(field_type field1, field_type *field2) void mervarw(field_type field1, field_type *field2)
{ {
int rnmiss = 0; int rnmiss = 0;
int grid = field1.grid; int grid = field1.grid;
...@@ -316,7 +316,7 @@ void mervar(field_type field1, field_type *field2) ...@@ -316,7 +316,7 @@ void mervar(field_type field1, field_type *field2)
for ( int i = 0; i < nx; i++ ) for ( int i = 0; i < nx; i++ )
{ {
prevarsum_mer(array+i, w+i, nx, ny, nmiss, missval, &rsum, &rsumw, &rsumq, &rsumwq); prevarsum_merw(array+i, w+i, nx, ny, nmiss, missval, &rsum, &rsumw, &rsumq, &rsumwq);
rvar = IS_NOT_EQUAL(rsumw, 0) ? (rsumq*rsumw - rsum*rsum) / (rsumw*rsumw) : missval; rvar = IS_NOT_EQUAL(rsumw, 0) ? (rsumq*rsumw - rsum*rsum) / (rsumw*rsumw) : missval;
if ( rvar < 0 && rvar > -1.e-5 ) rvar = 0; if ( rvar < 0 && rvar > -1.e-5 ) rvar = 0;
...@@ -330,7 +330,7 @@ void mervar(field_type field1, field_type *field2) ...@@ -330,7 +330,7 @@ void mervar(field_type field1, field_type *field2)
} }
void mervar1(field_type field1, field_type *field2) void mervar1w(field_type field1, field_type *field2)
{ {
int rnmiss = 0; int rnmiss = 0;
int grid = field1.grid; int grid = field1.grid;
...@@ -346,7 +346,7 @@ void mervar1(field_type field1, field_type *field2) ...@@ -346,7 +346,7 @@ void mervar1(field_type field1, field_type *field2)
for ( int i = 0; i < nx; i++ ) for ( int i = 0; i < nx; i++ )
{ {
prevarsum_mer(array+i, w+i, nx, ny, nmiss, missval, &rsum, &rsumw, &rsumq, &rsumwq); prevarsum_merw(array+i, w+i, nx, ny, nmiss, missval, &rsum, &rsumw, &rsumq, &rsumwq);
rvar = (rsumw*rsumw > rsumwq) ? (rsumq*rsumw - rsum*rsum) / (rsumw*rsumw - rsumwq) : missval; rvar = (rsumw*rsumw > rsumwq) ? (rsumq*rsumw - rsum*rsum) / (rsumw*rsumw - rsumwq) : missval;
if ( rvar < 0 && rvar > -1.e-5 ) rvar = 0; if ( rvar < 0 && rvar > -1.e-5 ) rvar = 0;
...@@ -360,7 +360,7 @@ void mervar1(field_type field1, field_type *field2) ...@@ -360,7 +360,7 @@ void mervar1(field_type field1, field_type *field2)
} }
void merstd(field_type field1, field_type *field2) void merstdw(field_type field1, field_type *field2)
{ {
int rnmiss = 0; int rnmiss = 0;
int grid = field1.grid; int grid = field1.grid;
...@@ -369,7 +369,7 @@ void merstd(field_type field1, field_type *field2) ...@@ -369,7 +369,7 @@ void merstd(field_type field1, field_type *field2)
int nx = gridInqXsize(grid); int nx = gridInqXsize(grid);
mervar(field1, field2); mervarw(field1, field2);
for ( int i = 0; i < nx; i++ ) for ( int i = 0; i < nx; i++ )
{ {
...@@ -384,7 +384,7 @@ void merstd(field_type field1, field_type *field2) ...@@ -384,7 +384,7 @@ void merstd(field_type field1, field_type *field2)
} }
void merstd1(field_type field1, field_type *field2) void merstd1w(field_type field1, field_type *field2)
{ {
int rnmiss = 0; int rnmiss = 0;
int grid = field1.grid; int grid = field1.grid;
...@@ -393,7 +393,7 @@ void merstd1(field_type field1, field_type *field2) ...@@ -393,7 +393,7 @@ void merstd1(field_type field1, field_type *field2)
int nx = gridInqXsize(grid); int nx = gridInqXsize(grid);
mervar1(field1, field2); mervar1w(field1, field2);
for ( int i = 0; i < nx; i++ ) for ( int i = 0; i < nx; i++ )
{ {
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
#define func_covar 22 #define func_covar 22
#define func_avgw 23 #define func_avgw 23
#define func_meanw 24 #define func_meanw 24
#define func_stdw 25
#define func_std1w 26
#define func_varw 27
#define func_var1w 28
#define func_crps 30 #define func_crps 30
#define func_brs 31 #define func_brs 31
......
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