Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
437252d6
Commit
437252d6
authored
May 20, 2014
by
Uwe Schulzweida
Browse files
app/cdi: added verbose option to printTimesteps()
parent
adddc8f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/cdi.c
View file @
437252d6
...
...
@@ -285,7 +285,7 @@ const char * tunit2str(int tunits)
}
const
char
*
calendar2str
(
int
calendar
)
const
char
*
calendar2str
(
int
calendar
)
{
if
(
calendar
==
CALENDAR_STANDARD
)
return
(
"standard"
);
else
if
(
calendar
==
CALENDAR_PROLEPTIC
)
return
(
"proleptic_gregorian"
);
...
...
@@ -295,6 +295,22 @@ const char * calendar2str(int calendar)
else
return
(
"unknown"
);
}
static
void
limit_string_length
(
char
*
string
)
{
size_t
len
=
strlen
(
string
);
if
(
len
>
10
)
{
for
(
size_t
i
=
3
;
i
<
len
;
++
i
)
if
(
string
[
i
]
==
' '
)
{
string
[
i
]
=
0
;
break
;
}
}
}
static
void
printShortinfo
(
int
streamID
,
int
vlistID
,
int
vardis
)
{
...
...
@@ -305,6 +321,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
int
nvars
,
ntsteps
;
int
levelsize
;
int
tsteptype
,
taxisID
;
char
tmpname
[
CDI_MAX_NAME
];
char
varname
[
CDI_MAX_NAME
];
char
*
modelptr
,
*
instptr
;
int
datatype
;
...
...
@@ -335,17 +352,17 @@ void printShortinfo(int streamID, int vlistID, int vardis)
/* institute info */
instptr
=
institutInqNamePtr
(
vlistInqVarInstitut
(
vlistID
,
varID
));
if
(
instptr
)
fprintf
(
stdout
,
"%-8s "
,
instptr
);
else
fprintf
(
stdout
,
"
unknown "
);
strcpy
(
tmpname
,
"unknown"
);
if
(
instptr
)
strcpy
(
tmpname
,
instptr
);
limit_string_length
(
tmpname
);
fprintf
(
stdout
,
"
%-8s "
,
tmpname
);
/* source info */
modelptr
=
modelInqNamePtr
(
vlistInqVarModel
(
vlistID
,
varID
));
if
(
modelptr
)
fprintf
(
stdout
,
"%-8s "
,
modelptr
);
else
fprintf
(
stdout
,
"
unknown "
);
strcpy
(
tmpname
,
"unknown"
);
if
(
modelptr
)
strcpy
(
tmpname
,
modelptr
);
limit_string_length
(
tmpname
);
fprintf
(
stdout
,
"
%-8s "
,
tmpname
);
/* tsteptype */
tsteptype
=
vlistInqVarTsteptype
(
vlistID
,
varID
);
...
...
@@ -456,7 +473,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
fprintf
(
stdout
,
" YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
\n
"
);
printTimesteps
(
streamID
,
taxisID
);
printTimesteps
(
streamID
,
taxisID
,
0
);
fprintf
(
stdout
,
"
\n
"
);
}
...
...
app/printinfo.h
View file @
437252d6
...
...
@@ -538,7 +538,7 @@ int printDot(int ndotout, int *nfact, int *ncout)
}
static
void
printTimesteps
(
int
streamID
,
int
taxisID
)
void
printTimesteps
(
int
streamID
,
int
taxisID
,
int
verbose
)
{
int
nrecs
;
int
vdate
,
vtime
;
...
...
@@ -559,12 +559,13 @@ void printTimesteps(int streamID, int taxisID)
int
ncout
=
0
;
int
nfact
=
1
;
int
tsID
=
0
;
while
(
(
nrecs
=
streamInqTimestep
(
streamID
,
tsID
))
)
{
vdate
=
taxisInqVdate
(
taxisID
);
vtime
=
taxisInqVtime
(
taxisID
);
if
(
tsID
<
NUM_TIMESTEP
)
if
(
verbose
||
tsID
<
NUM_TIMESTEP
)
{
ntimeout
=
printDateTime
(
ntimeout
,
vdate
,
vtime
);
}
...
...
Write
Preview
Markdown
is supported
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