Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
a9d61320
Commit
a9d61320
authored
8 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
ensavg: use fldavg().
parent
c0aa8bdb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Ensstat.c
+2
-13
2 additions, 13 deletions
src/Ensstat.c
src/field.c
+9
-15
9 additions, 15 deletions
src/field.c
with
11 additions
and
28 deletions
src/Ensstat.c
+
2
−
13
View file @
a9d61320
...
...
@@ -195,24 +195,13 @@ void *Ensstat(void *argument)
for
(
int
recID
=
0
;
recID
<
nrecs0
;
recID
++
)
{
int
varID
=
0
,
levelID
;
/*
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(ef, nfiles) lastprivate(varID, levelID)
#endif
for ( int fileID = 0; fileID < nfiles; fileID++ )
{
int nmiss;
streamInqRecord(ef[fileID].streamID, &varID, &levelID);
streamReadRecord(ef[fileID].streamID, ef[fileID].array, &nmiss);
ef[fileID].missval = vlistInqVarMissval(ef[fileID].vlistID, varID);
}
*/
for
(
int
fileID
=
0
;
fileID
<
nfiles
;
fileID
++
)
{
streamInqRecord
(
ef
[
fileID
].
streamID
,
&
varID
,
&
levelID
);
ef
[
fileID
].
missval
=
vlistInqVarMissval
(
ef
[
fileID
].
vlistID
,
varID
);
}
#pragma omp parallel for default(none) shared(ef, nfiles)
//
#pragma omp parallel for default(none) shared(ef, nfiles)
for
(
int
fileID
=
0
;
fileID
<
nfiles
;
fileID
++
)
{
streamReadRecord
(
ef
[
fileID
].
streamID
,
ef
[
fileID
].
array
,
&
ef
[
fileID
].
nmiss
);
...
...
This diff is collapsed.
Click to expand it.
src/field.c
+
9
−
15
View file @
a9d61320
...
...
@@ -341,32 +341,26 @@ double fldavg(field_type field)
const
double
missval1
=
field
.
missval
;
const
double
missval2
=
field
.
missval
;
const
double
*
restrict
array
=
field
.
ptr
;
const
double
*
restrict
w
=
field
.
weight
;
double
rsum
=
0
,
rsumw
=
0
;
double
ravg
=
0
;
assert
(
array
!=
NULL
);
assert
(
w
!=
NULL
);
if
(
nmiss
)
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
if
(
!
DBL_IS_EQUAL
(
w
[
i
],
missval1
)
)
{
rsum
=
ADDMN
(
rsum
,
MULMN
(
w
[
i
],
array
[
i
]));
rsumw
=
ADDMN
(
rsumw
,
w
[
i
]);
}
for
(
size_t
i
=
0
;
i
<
len
;
++
i
)
{
rsum
=
ADDMN
(
rsum
,
array
[
i
]);
rsumw
+=
1
;
}
ravg
=
DIVMN
(
rsum
,
rsumw
);
}
else
{
for
(
size_t
i
=
0
;
i
<
len
;
i
++
)
{
rsum
+=
w
[
i
]
*
array
[
i
];
rsumw
+=
w
[
i
];
}
int
fpeRaised
=
array_mean_val
(
len
,
array
,
&
ravg
);
}
double
ravg
=
DIVMN
(
rsum
,
rsumw
);
return
ravg
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment