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
441136db
Commit
441136db
authored
3 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Cat: replaced timer_new() by cdo_get_wtime().
parent
efecbd02
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#13903
passed
3 years ago
Stage: build
Stage: check
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Cat.cc
+9
-14
9 additions, 14 deletions
src/Cat.cc
with
9 additions
and
14 deletions
src/Cat.cc
+
9
−
14
View file @
441136db
...
...
@@ -14,6 +14,7 @@
#include
<cdi.h>
#include
"process_int.h"
#include
"cdo_wtime.h"
#include
"cdo_vlist.h"
#include
"timer.h"
#include
"util_files.h"
...
...
@@ -30,11 +31,10 @@ Cat(void *process)
};
auto
streamMode
=
StreamMode
::
APPEND
;
auto
hasConstVars
=
true
;
int
tsID2
=
0
,
varID
,
levelID
;
int
tsID2
=
0
;
CdoStreamID
streamID2
;
int
vlistID2
=
CDI_UNDEFID
;
int
taxisID2
=
CDI_UNDEFID
;
double
tw0
=
0
,
tw
=
0
;
Field
field
;
cdo_initialize
(
process
);
...
...
@@ -43,9 +43,6 @@ Cat(void *process)
const
auto
dataIsUnchanged
=
data_is_unchanged
();
const
auto
timer_cat
=
timer_new
(
"cat"
);
if
(
Options
::
Timer
)
timer_start
(
timer_cat
);
const
auto
streamCnt
=
cdo_stream_cnt
();
const
auto
nfiles
=
streamCnt
-
1
;
...
...
@@ -53,8 +50,7 @@ Cat(void *process)
for
(
int
indf
=
0
;
indf
<
nfiles
;
++
indf
)
{
if
(
Options
::
cdoVerbose
)
cdo_print
(
"Process file: %s"
,
cdo_get_stream_name
(
indf
));
if
(
Options
::
Timer
)
tw0
=
timer_val
(
timer_cat
);
const
auto
start
=
Options
::
cdoVerbose
?
cdo_get_wtime
()
:
0.0
;
const
auto
streamID1
=
cdo_open_read
(
indf
);
const
auto
vlistID1
=
cdo_stream_inq_vlist
(
streamID1
);
...
...
@@ -70,12 +66,13 @@ Cat(void *process)
auto
ntsteps
=
vlistNtsteps
(
vlistID1
);
if
(
ntsteps
==
1
)
{
int
varID
;
for
(
varID
=
0
;
varID
<
nvars
;
++
varID
)
if
(
varList1
[
varID
].
timetype
!=
TIME_CONSTANT
)
break
;
if
(
varID
==
nvars
)
ntsteps
=
0
;
}
const
bool
file_exists
=
!
Options
::
cdoOverwriteMode
?
FileUtils
::
file_exists
(
cdo_get_stream_name
(
nfiles
))
:
false
;
const
bool
file_exists
=
Options
::
cdoOverwriteMode
?
false
:
FileUtils
::
file_exists
(
cdo_get_stream_name
(
nfiles
));
if
(
file_exists
)
{
streamID2
=
cdo_open_append
(
nfiles
);
...
...
@@ -104,7 +101,7 @@ Cat(void *process)
if
(
ntsteps
==
0
&&
nfiles
>
1
)
{
hasConstVars
=
false
;
for
(
varID
=
0
;
varID
<
nvars
;
++
varID
)
vlistDefVarTimetype
(
vlistID2
,
varID
,
TIME_VARYING
);
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
vlistDefVarTimetype
(
vlistID2
,
varID
,
TIME_VARYING
);
}
cdo_def_vlist
(
streamID2
,
vlistID2
);
...
...
@@ -123,7 +120,7 @@ Cat(void *process)
const
auto
nrecs
=
cdo_stream_inq_timestep
(
streamID1
,
tsID1
);
if
(
nrecs
==
0
)
break
;
const
double
fstatus
=
(
ntsteps
>
1
)
?
indf
+
(
tsID1
+
1.
)
/
ntsteps
:
indf
+
1.
;
const
double
fstatus
=
(
ntsteps
>
1
)
?
indf
+
(
tsID1
+
1.
0
)
/
ntsteps
:
indf
+
1.
0
;
if
(
!
Options
::
cdoVerbose
)
progress
::
update
(
0
,
1
,
fstatus
/
nfiles
);
cdo_taxis_copy_timestep
(
taxisID2
,
taxisID1
);
...
...
@@ -131,6 +128,7 @@ Cat(void *process)
for
(
int
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
int
varID
,
levelID
;
cdo_inq_record
(
streamID1
,
&
varID
,
&
levelID
);
if
(
hasConstVars
&&
tsID2
>
0
&&
tsID1
==
0
)
...
...
@@ -156,8 +154,7 @@ Cat(void *process)
cdo_stream_close
(
streamID1
);
if
(
Options
::
Timer
)
tw
=
timer_val
(
timer_cat
)
-
tw0
;
if
(
Options
::
Timer
)
cdo_print
(
"Processed file: %s %.2f seconds"
,
cdo_get_stream_name
(
indf
),
tw
);
if
(
Options
::
cdoVerbose
)
cdo_print
(
"Processed file: %s %.2f seconds"
,
cdo_get_stream_name
(
indf
),
cdo_get_wtime
()
-
start
);
}
cdo_stream_close
(
streamID2
);
...
...
@@ -168,8 +165,6 @@ Cat(void *process)
taxisDestroy
(
taxisID2
);
}
if
(
Options
::
Timer
)
timer_stop
(
timer_cat
);
cdo_finish
();
return
nullptr
;
...
...
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