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
744963a5
Commit
744963a5
authored
Oct 10, 2015
by
Uwe Schulzweida
Browse files
added cdoReadTimestep()
parent
992e5915
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Afterburner.c
View file @
744963a5
...
...
@@ -655,7 +655,7 @@ void after_control(struct Control *globs, struct Variable *vars)
{
statusp
=
after_readTimestep
(
&
rarg
);
}
#if
defined
(HAVE_LIBPTHREAD)
#if defined(HAVE_LIBPTHREAD)
else
{
rval
=
pthread_create
(
&
thrID
,
&
attr
,
after_readTimestep
,
&
rarg
);
...
...
@@ -668,7 +668,7 @@ void after_control(struct Control *globs, struct Variable *vars)
if
(
globs
->
Type
>
0
)
after_legini_setup
(
globs
,
vars
);
}
#if
defined
(HAVE_LIBPTHREAD)
#if defined(HAVE_LIBPTHREAD)
if
(
ParallelRead
)
{
pthread_join
(
thrID
,
&
statusp
);
...
...
@@ -678,7 +678,7 @@ void after_control(struct Control *globs, struct Variable *vars)
#endif
tsFirst
=
FALSE
;
}
#if
defined
(HAVE_LIBPTHREAD)
#if defined(HAVE_LIBPTHREAD)
else
{
pthread_join
(
thrID
,
&
statusp
);
...
...
src/Timstat.c
View file @
744963a5
...
...
@@ -382,12 +382,12 @@ void *Timstat(void *argument)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTsteptype
(
vlistID1
,
varID
)
==
TSTEP_CONSTANT
)
continue
;
nwpv
=
vars1
[
varID
][
levelID
].
nwpv
;
gridsize
=
gridInqSize
(
vars1
[
varID
][
levelID
].
grid
);
nlevel
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
nlevel
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevel
;
levelID
++
)
{
missval
=
vars1
[
varID
][
levelID
].
missval
;
nwpv
=
vars1
[
varID
][
levelID
].
nwpv
;
gridsize
=
gridInqSize
(
vars1
[
varID
][
levelID
].
grid
);
missval
=
vars1
[
varID
][
levelID
].
missval
;
if
(
samp1
[
varID
][
levelID
].
ptr
)
{
int
irun
=
0
;
...
...
src/XTimstat.c
View file @
744963a5
...
...
@@ -72,6 +72,33 @@
#include
"pstream.h"
typedef
struct
{
int
streamID
,
nrecs
;
field_t
**
vars
;
}
readarg_t
;
static
int
num_recs
=
0
;
static
void
*
cdoReadTimestep
(
void
*
rarg
)
{
int
varID
,
levelID
,
nmiss
;
readarg_t
*
readarg
=
(
readarg_t
*
)
rarg
;
field_t
**
input_vars
=
readarg
->
vars
;
int
streamID
=
readarg
->
streamID
;
int
nrecs
=
readarg
->
nrecs
;
for
(
int
recID
=
0
;
recID
<
nrecs
;
++
recID
)
{
streamInqRecord
(
streamID
,
&
varID
,
&
levelID
);
streamReadRecord
(
streamID
,
input_vars
[
varID
][
levelID
].
ptr
,
&
nmiss
);
input_vars
[
varID
][
levelID
].
nmiss
=
nmiss
;
}
return
((
void
*
)
&
num_recs
);
}
void
*
XTimstat
(
void
*
argument
)
{
int
timestat_date
=
TIMESTAT_MEAN
;
...
...
@@ -79,7 +106,7 @@ void *XTimstat(void *argument)
int
vdate
=
0
,
vtime
=
0
;
int
vdate0
=
0
,
vtime0
=
0
;
int
nrecs
;
int
varID
,
levelID
,
recID
;
int
varID
,
levelID
;
long
nsets
;
int
i
;
int
streamID3
=
-
1
;
...
...
@@ -203,6 +230,14 @@ void *XTimstat(void *argument)
field_t
**
vars2
=
NULL
;
if
(
lvarstd
)
vars2
=
field_malloc
(
vlistID1
,
FIELD_PTR
);
readarg_t
readarg
;
readarg
.
streamID
=
streamID1
;
readarg
.
vars
=
input_vars
;
int
lparallelread
=
FALSE
;
int
ltsfirst
=
TRUE
;
void
*
statusp
=
NULL
;
int
tsID
=
0
;
int
otsID
=
0
;
while
(
TRUE
)
...
...
@@ -219,12 +254,26 @@ void *XTimstat(void *argument)
if
(
DATE_IS_NEQ
(
indate1
,
indate2
,
cmplen
)
)
break
;
for
(
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
streamInqRecord
(
streamID1
,
&
varID
,
&
levelID
);
streamReadRecord
(
streamID1
,
input_vars
[
varID
][
levelID
].
ptr
,
&
nmiss
);
input_vars
[
varID
][
levelID
].
nmiss
=
nmiss
;
readarg
.
nrecs
=
nrecs
;
if
(
ltsfirst
=
0
||
lparallelread
==
FALSE
)
{
#if defined(HAVE_LIBPTHREAD)
if
(
lparallelread
)
{
}
else
#endif
{
statusp
=
cdoReadTimestep
(
&
readarg
);
}
ltsfirst
=
FALSE
;
}
#if defined(HAVE_LIBPTHREAD)
else
{
}
#endif
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
...
...
@@ -350,12 +399,12 @@ void *XTimstat(void *argument)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTsteptype
(
vlistID1
,
varID
)
==
TSTEP_CONSTANT
)
continue
;
nwpv
=
vars1
[
varID
][
levelID
].
nwpv
;
gridsize
=
gridInqSize
(
vars1
[
varID
][
levelID
].
grid
);
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
missval
=
vars1
[
varID
][
levelID
].
missval
;
nwpv
=
vars1
[
varID
][
levelID
].
nwpv
;
gridsize
=
gridInqSize
(
vars1
[
varID
][
levelID
].
grid
);
missval
=
vars1
[
varID
][
levelID
].
missval
;
if
(
samp1
[
varID
][
levelID
].
ptr
)
{
int
irun
=
0
;
...
...
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