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
70ceb220
Commit
70ceb220
authored
Oct 26, 2016
by
Uwe Schulzweida
Browse files
Optimized error handling.
parent
316f8d14
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Ensstat.c
View file @
70ceb220
...
...
@@ -30,7 +30,6 @@
Ensstat enspctl Ensemble percentiles
*/
#include
<cdi.h>
#include
"cdo.h"
#include
"cdo_int.h"
...
...
@@ -41,7 +40,6 @@
void
*
Ensstat
(
void
*
argument
)
{
int
nrecs0
;
int
nmiss
;
typedef
struct
{
int
streamID
;
...
...
@@ -78,10 +76,10 @@ void *Ensstat(void *argument)
argc
--
;
}
int
count_data
=
FALSE
;
bool
count_data
=
false
;
if
(
argc
==
1
)
{
if
(
strcmp
(
"count"
,
operatorArgv
()[
nargc
-
1
])
==
0
)
count_data
=
TRUE
;
if
(
strcmp
(
"count"
,
operatorArgv
()[
nargc
-
1
])
==
0
)
count_data
=
true
;
else
cdoAbort
(
"Unknown parameter: >%s<"
,
operatorArgv
()[
nargc
-
1
]);
}
...
...
@@ -153,6 +151,8 @@ void *Ensstat(void *argument)
streamDefVlist
(
streamID2
,
vlistID2
);
bool
lwarning
=
false
;
bool
lerror
=
false
;
int
tsID
=
0
;
do
{
...
...
@@ -164,10 +164,22 @@ void *Ensstat(void *argument)
if
(
nrecs
!=
nrecs0
)
{
if
(
nrecs
==
0
)
cdoAbort
(
"Inconsistent ensemble file, too few time steps in %s!"
,
cdoStreamName
(
fileID
)
->
args
);
{
lwarning
=
true
;
cdoWarning
(
"Inconsistent ensemble file, too few time steps in %s!"
,
cdoStreamName
(
fileID
)
->
args
);
}
else
if
(
nrecs0
==
0
)
{
lwarning
=
true
;
cdoWarning
(
"Inconsistent ensemble file, too few time steps in %s!"
,
cdoStreamName
(
0
)
->
args
);
}
else
cdoAbort
(
"Inconsistent ensemble file, number of records at time step %d of %s and %s differ!"
,
tsID
+
1
,
cdoStreamName
(
0
)
->
args
,
cdoStreamName
(
fileID
)
->
args
);
{
lerror
=
true
;
cdoWarning
(
"Inconsistent ensemble file, number of records at time step %d of %s and %s differ!"
,
tsID
+
1
,
cdoStreamName
(
0
)
->
args
,
cdoStreamName
(
fileID
)
->
args
);
}
goto
CLEANUP
;
}
}
...
...
@@ -194,9 +206,9 @@ void *Ensstat(void *argument)
int
gridID
=
vlistInqVarGrid
(
vlistID1
,
varID
);
gridsize
=
gridInqSize
(
gridID
);
double
missval
=
vlistInqVarMissval
(
vlistID1
,
varID
);
double
missval
=
vlistInqVarMissval
(
vlistID1
,
varID
);
nmiss
=
0
;
int
nmiss
=
0
;
#if defined(_OPENMP)
#pragma omp parallel for default(shared)
#endif
...
...
@@ -246,6 +258,11 @@ void *Ensstat(void *argument)
}
while
(
nrecs0
>
0
);
CLEANUP:
if
(
lwarning
)
cdoWarning
(
"Inconsistent ensemble, processed only the first %d timesteps!"
,
tsID
);
if
(
lerror
)
cdoAbort
(
"Inconsistent ensemble, processed only the first %d timesteps!"
,
tsID
);
for
(
int
fileID
=
0
;
fileID
<
nfiles
;
fileID
++
)
streamClose
(
ef
[
fileID
].
streamID
);
...
...
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