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
08a98270
Commit
08a98270
authored
Mar 27, 2015
by
Uwe Schulzweida
Browse files
Fldstat: added parameter noweights to use constant grid cell area weights
parent
051c2db4
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
08a98270
2015-0
9
-2
6
Uwe Schulzweida
2015-0
3
-2
7
Uwe Schulzweida
* Fldstat: added parameter noweights to use constant grid cell area weights
* expr: added support for operator ?:,&&,||
2015-03-26 Uwe Schulzweida
...
...
src/Fldstat.c
View file @
08a98270
...
...
@@ -126,10 +126,26 @@ void *Fldstat(void *argument)
cdoAbort
(
"Illegal argument: percentile number %d is not in the range 1..99!"
,
pn
);
}
int
useweights
=
TRUE
;
if
(
operfunc
==
func_mean
||
operfunc
==
func_avg
||
operfunc
==
func_var
||
operfunc
==
func_std
||
operfunc
==
func_var1
||
operfunc
==
func_std1
)
needWeights
=
TRUE
;
{
needWeights
=
TRUE
;
unsigned
npar
=
operatorArgc
();
if
(
npar
>
0
)
{
char
**
parnames
=
operatorArgv
();
if
(
cdoVerbose
)
for
(
unsigned
i
=
0
;
i
<
npar
;
i
++
)
cdoPrint
(
"key %u = %s"
,
i
+
1
,
parnames
[
i
]);
if
(
strcmp
(
parnames
[
0
],
"noweights"
)
==
0
)
useweights
=
FALSE
;
else
cdoAbort
(
"Parameter >%s< unsupported! Supported parameter are: noweights"
,
parnames
[
0
]);
}
}
int
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
...
...
@@ -163,7 +179,14 @@ void *Fldstat(void *argument)
field
.
ptr
=
(
double
*
)
malloc
(
lim
*
sizeof
(
double
));
field
.
weight
=
NULL
;
if
(
needWeights
)
field
.
weight
=
(
double
*
)
malloc
(
lim
*
sizeof
(
double
));
{
field
.
weight
=
(
double
*
)
malloc
(
lim
*
sizeof
(
double
));
if
(
!
useweights
)
{
cdoPrint
(
"Using constant grid cell area weights!"
);
for
(
int
i
=
0
;
i
<
lim
;
++
i
)
field
.
weight
[
i
]
=
1
;
}
}
int
tsID
=
0
;
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
))
)
...
...
@@ -194,14 +217,14 @@ void *Fldstat(void *argument)
{
lastgrid
=
field
.
grid
;
field
.
weight
[
0
]
=
1
;
if
(
field
.
size
>
1
)
if
(
useweights
&&
field
.
size
>
1
)
{
int
wstatus
=
gridWeights
(
field
.
grid
,
field
.
weight
);
int
wstatus
=
wstatus
=
gridWeights
(
field
.
grid
,
field
.
weight
);
if
(
wstatus
!=
0
&&
tsID
==
0
&&
levelID
==
0
)
{
char
varname
[
CDI_MAX_NAME
];
vlistInqVarName
(
vlistID1
,
varID
,
varname
);
cdoWarning
(
"
U
sing constant grid cell area weights for variable %s!"
,
varname
);
cdoWarning
(
"
Grid cell bounds not available, u
sing constant grid cell area weights for variable %s!"
,
varname
);
}
}
}
...
...
src/Vertstat.c
View file @
08a98270
...
...
@@ -203,13 +203,13 @@ void *Vertstat(void *argument)
if
(
needWeights
)
{
int
genbounds
=
FALSE
;
int
npar
=
operatorArgc
();
unsigned
npar
=
operatorArgc
();
if
(
npar
>
0
)
{
char
**
parnames
=
operatorArgv
();
if
(
cdoVerbose
)
for
(
i
=
0
;
i
<
npar
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
npar
;
i
++
)
cdoPrint
(
"key %d = %s"
,
i
+
1
,
parnames
[
i
]);
if
(
strcmp
(
parnames
[
0
],
"genbounds"
)
==
0
)
genbounds
=
TRUE
;
...
...
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