Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
70bd11f2
Commit
70bd11f2
authored
May 26, 2015
by
Uwe Schulzweida
Browse files
New operator: vertstd1 - Vertical standard deviation [Divisor is (n-1)]
parent
25b0e819
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
70bd11f2
...
...
@@ -5,6 +5,8 @@
2015-05-26 Uwe Schulzweida
* New operator: vertstd1 - Vertical standard deviation [Divisor is (n-1)]
* New operator: vertvar1 - Vartical variance [Divisor is (n-1)]
* New operator: gridboxstd1 - Gridbox standard deviation [Divisor is (n-1)]
* New operator: gridboxvar1 - Gridbox variance [Divisor is (n-1)]
* New operator: merstd1 - Meridional standard deviation [Divisor is (n-1)]
...
...
OPERATORS
View file @
70bd11f2
...
...
@@ -284,8 +284,10 @@ Operator catalog:
Vertstat vertsum Vertical sum
Vertstat vertmean Vertical mean
Vertstat vertavg Vertical average
Vertstat vertvar Vertical variance
Vertstat vertstd Vertical standard deviation
Vertstat vertstd1 Vertical standard deviation
Vertstat vertvar Vertical variance
Vertstat vertvar1 Vertical variance
Timselstat timselmin Time range minimum
Timselstat timselmax Time range maximum
Timselstat timselsum Time range sum
...
...
doc/tex/mod/Vertstat
View file @
70bd11f2
...
...
@@ -5,7 +5,7 @@
@Section = Statistical values
@Class = Statistic
@Arguments = ifile ofile
@Operators = vertmin vertmax vertsum vertmean vertavg vert
var
vertstd
@Operators = vertmin vertmax vertsum vertmean vertavg vert
std
vertstd
1 vertvar vertvar1
@BeginDescription
This module computes statistical values over all levels of the input variables.
...
...
@@ -64,7 +64,16 @@ For every gridpoint the layer weighted average over all levels is computed.
@Title = Vertical variance
@BeginDescription
For every gridpoint the variance over all levels is computed.
For every gridpoint the variance over all levels is computed. Divisor is n.
@EndDescription
@EndOperator
@BeginOperator_vertvar1
@Title = Vertical variance
@BeginDescription
For every gridpoint the variance over all levels is computed. Divisor is (n-1).
@EndDescription
@EndOperator
...
...
@@ -73,7 +82,16 @@ For every gridpoint the variance over all levels is computed.
@Title = Vertical standard deviation
@BeginDescription
For every gridpoint the standard deviation over all levels is computed.
For every gridpoint the standard deviation over all levels is computed. Divisor is n.
@EndDescription
@EndOperator
@BeginOperator_vertstd1
@Title = Vertical standard deviation
@BeginDescription
For every gridpoint the standard deviation over all levels is computed. Divisor is (n-1).
@EndDescription
@EndOperator
...
...
src/Vertstat.c
View file @
70bd11f2
...
...
@@ -25,7 +25,9 @@
Vertstat vertmean Vertical mean
Vertstat vertavg Vertical average
Vertstat vertvar Vertical variance
Vertstat vertvar1 Vertical variance [Divisor is (n-1)]
Vertstat vertstd Vertical standard deviation
Vertstat vertstd1 Vertical standard deviation [Divisor is (n-1)]
*/
...
...
@@ -178,12 +180,19 @@ void *Vertstat(void *argument)
int
VERTMEAN
=
cdoOperatorAdd
(
"vertmean"
,
func_mean
,
1
,
NULL
);
int
VERTAVG
=
cdoOperatorAdd
(
"vertavg"
,
func_avg
,
1
,
NULL
);
cdoOperatorAdd
(
"vertvar"
,
func_var
,
0
,
NULL
);
cdoOperatorAdd
(
"vertvar1"
,
func_var1
,
0
,
NULL
);
cdoOperatorAdd
(
"vertstd"
,
func_std
,
0
,
NULL
);
cdoOperatorAdd
(
"vertstd1"
,
func_std1
,
0
,
NULL
);
int
operatorID
=
cdoOperatorID
();
int
operfunc
=
cdoOperatorF1
(
operatorID
);
int
needWeights
=
cdoOperatorF2
(
operatorID
);
int
lmean
=
operfunc
==
func_mean
||
operfunc
==
func_avg
;
int
lstd
=
operfunc
==
func_std
||
operfunc
==
func_std1
;
int
lvarstd
=
operfunc
==
func_std
||
operfunc
==
func_var
||
operfunc
==
func_std1
||
operfunc
==
func_var1
;
double
divisor
=
operfunc
==
func_std1
||
operfunc
==
func_var1
;
int
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
int
vlistID1
=
streamInqVlist
(
streamID1
);
...
...
@@ -252,7 +261,7 @@ void *Vertstat(void *argument)
field_t
*
vars1
=
(
field_t
*
)
malloc
(
nvars
*
sizeof
(
field_t
));
field_t
*
samp1
=
(
field_t
*
)
malloc
(
nvars
*
sizeof
(
field_t
));
field_t
*
vars2
=
NULL
;
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
if
(
lvarstd
)
vars2
=
(
field_t
*
)
malloc
(
nvars
*
sizeof
(
field_t
));
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
...
...
@@ -274,7 +283,7 @@ void *Vertstat(void *argument)
samp1
[
varID
].
nmiss
=
0
;
samp1
[
varID
].
missval
=
missval
;
samp1
[
varID
].
ptr
=
NULL
;
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
if
(
lvarstd
)
{
field_init
(
&
vars2
[
varID
]);
vars2
[
varID
].
grid
=
gridID
;
...
...
@@ -332,7 +341,7 @@ void *Vertstat(void *argument)
if
(
(
operatorID
==
VERTMEAN
||
operatorID
==
VERTAVG
)
&&
IS_NOT_EQUAL
(
layer_weight
,
1
.
0
)
)
farcmul
(
&
vars1
[
varID
],
layer_weight
);
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
if
(
lvarstd
)
farmoq
(
&
vars2
[
varID
],
vars1
[
varID
]);
if
(
nmiss
>
0
||
samp1
[
varID
].
ptr
||
needWeights
)
...
...
@@ -371,7 +380,7 @@ void *Vertstat(void *argument)
samp1
[
varID
].
ptr
[
i
]
+=
layer_weight
;
}
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
if
(
lvarstd
)
{
farsumq
(
&
vars2
[
varID
],
field
);
farsum
(
&
vars1
[
varID
],
field
);
...
...
@@ -387,29 +396,28 @@ void *Vertstat(void *argument)
{
if
(
vars1
[
varID
].
nsamp
)
{
if
(
operfunc
==
func_mean
||
operfunc
==
func_avg
)
if
(
lmean
)
{
if
(
samp1
[
varID
].
ptr
==
NULL
)
farcmul
(
&
vars1
[
varID
],
1
.
0
/
vars1
[
varID
].
nsamp
);
else
fardiv
(
&
vars1
[
varID
],
samp1
[
varID
]);
}
else
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
else
if
(
lvarstd
)
{
if
(
samp1
[
varID
].
ptr
==
NULL
)
{
if
(
operfunc
==
func_
std
)
farcstd
(
&
vars1
[
varID
],
vars2
[
varID
],
1
.
0
/
vars1
[
varID
].
nsamp
);
if
(
l
std
)
farcstd
x
(
&
vars1
[
varID
],
vars2
[
varID
],
vars1
[
varID
].
nsamp
,
divisor
);
else
farcvar
(
&
vars1
[
varID
],
vars2
[
varID
],
1
.
0
/
vars1
[
varID
].
nsamp
);
farcvar
x
(
&
vars1
[
varID
],
vars2
[
varID
],
vars1
[
varID
].
nsamp
,
divisor
);
}
else
{
farinv
(
&
samp1
[
varID
]);
if
(
operfunc
==
func_std
)
farstd
(
&
vars1
[
varID
],
vars2
[
varID
],
samp1
[
varID
]);
if
(
lstd
)
farstdx
(
&
vars1
[
varID
],
vars2
[
varID
],
samp1
[
varID
],
divisor
);
else
farvar
(
&
vars1
[
varID
],
vars2
[
varID
],
samp1
[
varID
]);
farvar
x
(
&
vars1
[
varID
],
vars2
[
varID
],
samp1
[
varID
]
,
divisor
);
}
}
...
...
@@ -426,12 +434,12 @@ void *Vertstat(void *argument)
{
free
(
vars1
[
varID
].
ptr
);
if
(
samp1
[
varID
].
ptr
)
free
(
samp1
[
varID
].
ptr
);
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
free
(
vars2
[
varID
].
ptr
);
if
(
lvarstd
)
free
(
vars2
[
varID
].
ptr
);
}
free
(
vars1
);
free
(
samp1
);
if
(
operfunc
==
func_std
||
operfunc
==
func_var
)
free
(
vars2
);
if
(
lvarstd
)
free
(
vars2
);
if
(
field
.
ptr
)
free
(
field
.
ptr
);
...
...
src/modules.c
View file @
70bd11f2
...
...
@@ -461,7 +461,7 @@ void *Maggraph(void *argument);
#define VarrmsOperators {"varrms"}
#define VertintmlOperators {"ml2pl", "ml2hl", "ml2plx", "ml2hlx", "ml2pl_lp", "ml2hl_lp", "ml2plx_lp", "ml2hlx_lp"}
#define VertintapOperators {"ap2pl", "ap2plx", "ap2pl_lp", "ap2plx_lp"}
#define VertstatOperators {"vertmin", "vertmax", "vertsum", "vertint", "vertmean", "vertavg", "vert
var
", "vertstd"}
#define VertstatOperators {"vertmin", "vertmax", "vertsum", "vertint", "vertmean", "vertavg", "vert
std
", "vertstd
1", "vertvar", "vertvar1
"}
#define VertwindOperators {"vertwind"}
#define WindOperators {"uv2dv", "uv2dvl", "dv2uv", "dv2uvl", "dv2ps"}
#define WritegridOperators {"writegrid"}
...
...
src/operator_help.h
View file @
70bd11f2
...
...
@@ -1977,8 +1977,8 @@ static char *GridboxstatHelp[] = {
static
char
*
VertstatHelp
[]
=
{
"NAME"
,
" vertmin, vertmax, vertsum, vertmean, vertavg, vert
var
, vertstd
-
"
,
" Vertical statistical values"
,
" vertmin, vertmax, vertsum, vertmean, vertavg, vert
std
, vertstd
1, vertvar,
"
,
"
vertvar1 -
Vertical statistical values"
,
""
,
"SYNOPSIS"
,
" <operator> ifile ofile"
,
...
...
@@ -1999,10 +1999,14 @@ static char *VertstatHelp[] = {
" For every gridpoint the layer weighted mean over all levels is computed."
,
" vertavg Vertical average"
,
" For every gridpoint the layer weighted average over all levels is computed."
,
" vertvar Vertical variance"
,
" For every gridpoint the variance over all levels is computed."
,
" vertstd Vertical standard deviation"
,
" For every gridpoint the standard deviation over all levels is computed."
,
" For every gridpoint the standard deviation over all levels is computed. Divisor is n."
,
" vertstd1 Vertical standard deviation"
,
" For every gridpoint the standard deviation over all levels is computed. Divisor is (n-1)."
,
" vertvar Vertical variance"
,
" For every gridpoint the variance over all levels is computed. Divisor is n."
,
" vertvar1 Vertical variance"
,
" For every gridpoint the variance over all levels is computed. Divisor is (n-1)."
,
NULL
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment