Skip to content
GitLab
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
25b0e819
Commit
25b0e819
authored
May 26, 2015
by
Uwe Schulzweida
Browse files
New operator: gridboxstd1 - Gridbox standard deviation [Divisor is (n-1)]
parent
4e55e4a7
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
25b0e819
...
...
@@ -5,6 +5,8 @@
2015-05-26 Uwe Schulzweida
* 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)]
* New operator: mervar1 - Meridional variance [Divisor is (n-1)]
* New operator: zonstd1 - Zonal standard deviation [Divisor is (n-1)]
...
...
OPERATORS
View file @
25b0e819
...
...
@@ -275,8 +275,10 @@ Operator catalog:
Gridboxstat gridboxsum Gridbox sum
Gridboxstat gridboxmean Gridbox mean
Gridboxstat gridboxavg Gridbox average
Gridboxstat gridboxvar Gridbox variance
Gridboxstat gridboxstd Gridbox standard deviation
Gridboxstat gridboxstd1 Gridbox standard deviation
Gridboxstat gridboxvar Gridbox variance
Gridboxstat gridboxvar1 Gridbox variance
Vertstat vertmin Vertical minimum
Vertstat vertmax Vertical maximum
Vertstat vertsum Vertical sum
...
...
doc/cdo_refcard.pdf
View file @
25b0e819
No preview for this file type
doc/tex/mod/Gridboxstat
View file @
25b0e819
...
...
@@ -5,7 +5,7 @@
@Section = Statistical values
@Class = Statistic
@Arguments = ifile ofile
@Operators = gridboxmin gridboxmax gridboxsum gridboxmean gridboxavg gridbox
var
gridboxstd
@Operators = gridboxmin gridboxmax gridboxsum gridboxmean gridboxavg gridbox
std
gridboxstd
1 gridboxvar gridboxvar1
@BeginDescription
This module computes statistical values over surrounding grid boxes.
...
...
@@ -21,6 +21,7 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Minimum value of the selected grid boxes.
@EndDescription
@EndOperator
...
...
@@ -30,6 +31,7 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Maximum value of the selected grid boxes.
@EndDescription
@EndOperator
...
...
@@ -39,6 +41,7 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Sum of the selected grid boxes.
@EndDescription
@EndOperator
...
...
@@ -48,6 +51,7 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Mean of the selected grid boxes.
@EndDescription
@EndOperator
...
...
@@ -57,6 +61,7 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Average of the selected grid boxes.
@EndDescription
@EndOperator
...
...
@@ -66,6 +71,17 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Variance of the selected grid boxes. Divisor is n.
@EndDescription
@EndOperator
@BeginOperator_gridboxvar1
@Title = Gridbox variance
@Parameter = nx ny
@BeginDescription
Variance of the selected grid boxes. Divisor is (n-1).
@EndDescription
@EndOperator
...
...
@@ -75,6 +91,17 @@ All gridbox operators only works on quadrilateral curvilinear grids.
@Parameter = nx ny
@BeginDescription
Standard deviation of the selected grid boxes. Divisor is n.
@EndDescription
@EndOperator
@BeginOperator_gridboxstd1
@Title = Gridbox standard deviation
@Parameter = nx ny
@BeginDescription
Standard deviation of the selected grid boxes. Divisor is (n-1).
@EndDescription
@EndOperator
...
...
src/Gridboxstat.c
View file @
25b0e819
...
...
@@ -24,7 +24,9 @@
Gridboxstat gridboxmean Gridbox mean
Gridboxstat gridboxavg Gridbox average
Gridboxstat gridboxstd Gridbox standard deviation
Gridboxstat gridboxstd1 Gridbox standard deviation [Divisor is (n-1)]
Gridboxstat gridboxvar Gridbox variance
Gridboxstat gridboxvar1 Gridbox variance [Divisor is (n-1)]
*/
...
...
@@ -469,7 +471,7 @@ void gridboxstat(field_t *field1, field_t *field2, int xinc, int yinc, int statf
*/
if
(
field1
->
weight
)
useWeight
=
TRUE
;
gridsize
=
xinc
*
yinc
;
gridsize
=
xinc
*
yinc
;
field
=
(
field_t
*
)
malloc
(
ompNumThreads
*
sizeof
(
field_t
));
for
(
i
=
0
;
i
<
ompNumThreads
;
i
++
)
{
...
...
@@ -555,29 +557,20 @@ void gridboxstat(field_t *field1, field_t *field2, int xinc, int yinc, int statf
void
*
Gridboxstat
(
void
*
argument
)
{
int
operatorID
;
int
operfunc
;
int
streamID1
,
streamID2
;
int
vlistID1
,
vlistID2
;
int
lastgrid
=
-
1
;
int
wstatus
=
FALSE
;
int
index
,
ngrids
;
int
index
;
int
recID
,
nrecs
;
int
tsID
,
varID
,
levelID
;
int
varID
,
levelID
;
int
needWeights
=
FALSE
;
int
gridID1
,
gridID2
;
int
gridsize1
,
gridsize2
;
int
taxisID1
,
taxisID2
;
int
xinc
,
yinc
;
field_t
field1
,
field2
;
char
varname
[
CDI_MAX_NAME
];
cdoInitialize
(
argument
);
operatorInputArg
(
"xinc, yinc"
);
operatorCheckArgc
(
2
);
xinc
=
parameter2int
(
operatorArgv
()[
0
]);
yinc
=
parameter2int
(
operatorArgv
()[
1
]);
int
xinc
=
parameter2int
(
operatorArgv
()[
0
]);
int
yinc
=
parameter2int
(
operatorArgv
()[
1
]);
cdoOperatorAdd
(
"gridboxmin"
,
func_min
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxmax"
,
func_max
,
0
,
NULL
);
...
...
@@ -585,53 +578,57 @@ void *Gridboxstat(void *argument)
cdoOperatorAdd
(
"gridboxmean"
,
func_mean
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxavg"
,
func_avg
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxvar"
,
func_var
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxvar1"
,
func_var1
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxstd"
,
func_std
,
0
,
NULL
);
cdoOperatorAdd
(
"gridboxstd1"
,
func_std1
,
0
,
NULL
);
operatorID
=
cdoOperatorID
();
operfunc
=
cdoOperatorF1
(
operatorID
);
int
operatorID
=
cdoOperatorID
();
int
operfunc
=
cdoOperatorF1
(
operatorID
);
if
(
operfunc
==
func_mean
||
operfunc
==
func_avg
||
operfunc
==
func_var
||
operfunc
==
func_std
)
operfunc
==
func_var
||
operfunc
==
func_std
||
operfunc
==
func_var1
||
operfunc
==
func_std1
)
needWeights
=
TRUE
;
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
int
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
vlistID1
=
streamInqVlist
(
streamID1
);
vlistID2
=
vlistDuplicate
(
vlistID1
);
int
vlistID1
=
streamInqVlist
(
streamID1
);
int
vlistID2
=
vlistDuplicate
(
vlistID1
);
taxisID1
=
vlistInqTaxis
(
vlistID1
);
taxisID2
=
taxisDuplicate
(
taxisID1
);
int
taxisID1
=
vlistInqTaxis
(
vlistID1
);
int
taxisID2
=
taxisDuplicate
(
taxisID1
);
vlistDefTaxis
(
vlistID2
,
taxisID2
);
ngrids
=
vlistNgrids
(
vlistID1
);
int
ngrids
=
vlistNgrids
(
vlistID1
);
if
(
ngrids
>
1
)
cdoAbort
(
"Too many different grids!"
);
gridID1
=
vlistGrid
(
vlistID1
,
0
);
int
gridID1
=
vlistGrid
(
vlistID1
,
0
);
if
(
gridInqType
(
gridID1
)
==
GRID_GAUSSIAN_REDUCED
)
cdoAbort
(
"Gaussian reduced grid found. Use option -R to convert it to a regular grid!"
);
gridID2
=
genBoxGrid
(
gridID1
,
xinc
,
yinc
);
int
gridID2
=
genBoxGrid
(
gridID1
,
xinc
,
yinc
);
for
(
index
=
0
;
index
<
ngrids
;
index
++
)
vlistChangeGridIndex
(
vlistID2
,
index
,
gridID2
);
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
int
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
streamDefVlist
(
streamID2
,
vlistID2
);
field_t
field1
,
field2
;
field_init
(
&
field1
);
field_init
(
&
field2
);
gridsize1
=
gridInqSize
(
gridID1
);
int
gridsize1
=
gridInqSize
(
gridID1
);
field1
.
ptr
=
(
double
*
)
malloc
(
gridsize1
*
sizeof
(
double
));
field1
.
weight
=
NULL
;
if
(
needWeights
)
field1
.
weight
=
(
double
*
)
malloc
(
gridsize1
*
sizeof
(
double
));
gridsize2
=
gridInqSize
(
gridID2
);
int
gridsize2
=
gridInqSize
(
gridID2
);
field2
.
ptr
=
(
double
*
)
malloc
(
gridsize2
*
sizeof
(
double
));
field2
.
weight
=
NULL
;
tsID
=
0
;
int
tsID
=
0
;
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
))
)
{
taxisCopyTimestep
(
taxisID2
,
taxisID1
);
...
...
src/modules.c
View file @
25b0e819
...
...
@@ -327,7 +327,7 @@ void *Maggraph(void *argument);
#define FourierOperators {"fourier"}
#define GengridOperators {"gengrid"}
#define GradsdesOperators {"gradsdes", "dumpmap"}
#define GridboxstatOperators {"gridboxmin", "gridboxmax", "gridboxsum", "gridboxmean", "gridboxavg", "gridbox
var
", "gridboxstd"}
#define GridboxstatOperators {"gridboxmin", "gridboxmax", "gridboxsum", "gridboxmean", "gridboxavg", "gridbox
std
", "gridboxstd
1", "gridboxvar", "gridboxvar1
"}
#define GridcellOperators {"gridarea", "gridweights", "gridmask", "griddx", "griddy"}
#define GridsearchOperators {"testpointsearch", "testcellsearch"}
#define HarmonicOperators {"harmonic"}
...
...
src/operator_help.h
View file @
25b0e819
...
...
@@ -1878,7 +1878,7 @@ static char *ZonstatHelp[] = {
" zonavg Zonal average"
,
" For every latitude the average over all longitudes is computed."
,
" zonstd Zonal standard deviation"
,
" For every latitude the standard deviation over all longitudes is computed. Divisor is n.
"
,
" For every latitude the standard deviation over all longitudes is computed. Divisor is n."
,
" zonstd1 Zonal standard deviation"
,
" For every latitude the standard deviation over all longitudes is computed. Divisor is (n-1). "
,
" zonvar Zonal variance"
,
...
...
@@ -1937,8 +1937,8 @@ static char *MerstatHelp[] = {
static
char
*
GridboxstatHelp
[]
=
{
"NAME"
,
" gridboxmin, gridboxmax, gridboxsum, gridboxmean, gridboxavg, gridbox
var
, "
,
" gridboxstd - Statistical values over grid boxes"
,
" gridboxmin, gridboxmax, gridboxsum, gridboxmean, gridboxavg, gridbox
std
, "
,
" gridboxstd
1, gridboxvar, gridboxvar1
- Statistical values over grid boxes"
,
""
,
"SYNOPSIS"
,
" <operator>,nx,ny ifile ofile"
,
...
...
@@ -1951,12 +1951,23 @@ static char *GridboxstatHelp[] = {
""
,
"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"
,
"
gridboxvar G
ridbox
variance
"
,
"
Average of the selected g
rid
box
es.
"
,
" gridboxstd Gridbox standard deviation"
,
" Standard deviation of the selected grid boxes. Divisor is n."
,
" gridboxstd1 Gridbox standard deviation"
,
" Standard deviation of the selected grid boxes. Divisor is (n-1)."
,
" gridboxvar Gridbox variance"
,
" Variance of the selected grid boxes. Divisor is n."
,
" gridboxvar1 Gridbox variance"
,
" Variance of the selected grid boxes. Divisor is (n-1)."
,
""
,
"PARAMETER"
,
" nx INTEGER Number of grid boxes in x direction"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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