Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
libcdi
Commits
a787010d
Commit
a787010d
authored
2 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Changed if to switch.
parent
2d9cd48a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!34
Version 2.2.0
,
!29
M214003/develop
Pipeline
#29628
passed
2 years ago
Stage: external
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/cdi.c
+16
-15
16 additions, 15 deletions
app/cdi.c
app/printinfo.c
+13
-10
13 additions, 10 deletions
app/printinfo.c
app/printinfo.h
+1
-1
1 addition, 1 deletion
app/printinfo.h
with
30 additions
and
26 deletions
app/cdi.c
+
16
−
15
View file @
a787010d
...
...
@@ -430,25 +430,26 @@ printShortinfo(int streamID, int vlistID, int vardis)
// datatype
int
datatype
=
vlistInqVarDatatype
(
vlistID
,
varID
);
// clang-format off
if
(
datatype
==
CDI_DATATYPE_PACK
)
strcpy
(
pstr
,
"P0"
);
else
if
(
datatype
>
0
&&
datatype
<=
32
)
sprintf
(
pstr
,
"P%d"
,
datatype
);
else
if
(
datatype
==
CDI_DATATYPE_CPX32
)
strcpy
(
pstr
,
"C32"
);
else
if
(
datatype
==
CDI_DATATYPE_CPX64
)
strcpy
(
pstr
,
"C64"
);
else
if
(
datatype
==
CDI_DATATYPE_FLT32
)
strcpy
(
pstr
,
"F32"
);
else
if
(
datatype
==
CDI_DATATYPE_FLT64
)
strcpy
(
pstr
,
"F64"
);
else
if
(
datatype
==
CDI_DATATYPE_INT8
)
strcpy
(
pstr
,
"I8"
);
else
if
(
datatype
==
CDI_DATATYPE_INT16
)
strcpy
(
pstr
,
"I16"
);
else
if
(
datatype
==
CDI_DATATYPE_INT32
)
strcpy
(
pstr
,
"I32"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT8
)
strcpy
(
pstr
,
"U8"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT16
)
strcpy
(
pstr
,
"U16"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT32
)
strcpy
(
pstr
,
"U32"
);
else
strcpy
(
pstr
,
"-1"
);
if
(
datatype
==
CDI_DATATYPE_PACK
)
strcpy
(
pstr
,
"P0"
);
else
if
(
datatype
>
0
&&
datatype
<=
32
)
sprintf
(
pstr
,
"P%d"
,
datatype
);
else
if
(
datatype
==
CDI_DATATYPE_CPX32
)
strcpy
(
pstr
,
"C32"
);
else
if
(
datatype
==
CDI_DATATYPE_CPX64
)
strcpy
(
pstr
,
"C64"
);
else
if
(
datatype
==
CDI_DATATYPE_FLT32
)
strcpy
(
pstr
,
"F32"
);
else
if
(
datatype
==
CDI_DATATYPE_FLT64
)
strcpy
(
pstr
,
"F64"
);
else
if
(
datatype
==
CDI_DATATYPE_INT8
)
strcpy
(
pstr
,
"I8"
);
else
if
(
datatype
==
CDI_DATATYPE_INT16
)
strcpy
(
pstr
,
"I16"
);
else
if
(
datatype
==
CDI_DATATYPE_INT32
)
strcpy
(
pstr
,
"I32"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT8
)
strcpy
(
pstr
,
"U8"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT16
)
strcpy
(
pstr
,
"U16"
);
else
if
(
datatype
==
CDI_DATATYPE_UINT32
)
strcpy
(
pstr
,
"U32"
);
else
strcpy
(
pstr
,
"-1"
);
// clang-format on
fprintf
(
stdout
,
" %-3s"
,
pstr
);
bool
isCompressed
=
(
vlistInqVarCompType
(
vlistID
,
varID
)
!=
CDI_COMPRESS_NONE
);
fprintf
(
stdout
,
"%c "
,
isCompressed
?
'z'
:
' '
);
int
compType
=
vlistInqVarCompType
(
vlistID
,
varID
);
bool
isCompressed
=
(
compType
!=
CDI_COMPRESS_NONE
);
fprintf
(
stdout
,
"%c "
,
isCompressed
?
(
int
)
comptype_to_name
(
compType
)[
0
]
:
' '
);
// parameter info
fprintf
(
stdout
,
": "
);
...
...
This diff is collapsed.
Click to expand it.
app/printinfo.c
+
13
−
10
View file @
a787010d
...
...
@@ -50,13 +50,16 @@ time2str(CdiTime time, char *timestr, int maxlen)
}
const
char
*
comp_name
(
int
comp
t
ype
)
comp
type_to
_name
(
int
comp
T
ype
)
{
if
(
comptype
==
CDI_COMPRESS_SZIP
)
return
"szip"
;
if
(
comptype
==
CDI_COMPRESS_AEC
)
return
"aec"
;
if
(
comptype
==
CDI_COMPRESS_ZIP
)
return
"zip"
;
if
(
comptype
==
CDI_COMPRESS_JPEG
)
return
"jpeg"
;
if
(
comptype
==
CDI_COMPRESS_FILTER
)
return
"filter"
;
switch
(
compType
)
{
case
CDI_COMPRESS_SZIP
:
return
"szip"
;
case
CDI_COMPRESS_AEC
:
return
"aec"
;
case
CDI_COMPRESS_ZIP
:
return
"zip"
;
case
CDI_COMPRESS_JPEG
:
return
"jpeg"
;
case
CDI_COMPRESS_FILTER
:
return
"filter"
;
}
return
" "
;
}
...
...
@@ -66,7 +69,7 @@ printFiletype(int streamID, int vlistID)
int
filetype
=
streamInqFiletype
(
streamID
);
// clang-format off
switch
(
filetype
)
switch
(
filetype
)
{
case
CDI_FILETYPE_GRB
:
printf
(
"GRIB"
);
break
;
case
CDI_FILETYPE_GRB2
:
printf
(
"GRIB2"
);
break
;
...
...
@@ -82,9 +85,9 @@ printFiletype(int streamID, int vlistID)
default:
printf
(
" File format: unsupported filetype %d"
,
filetype
);
break
;
}
if
(
filetype
==
CDI_FILETYPE_SRV
||
filetype
==
CDI_FILETYPE_EXT
||
filetype
==
CDI_FILETYPE_IEG
)
if
(
filetype
==
CDI_FILETYPE_SRV
||
filetype
==
CDI_FILETYPE_EXT
||
filetype
==
CDI_FILETYPE_IEG
)
{
switch
(
streamInqByteorder
(
streamID
)
)
switch
(
streamInqByteorder
(
streamID
))
{
case
CDI_BIGENDIAN
:
printf
(
" BIGENDIAN"
);
break
;
case
CDI_LITTLEENDIAN
:
printf
(
" LITTLEENDIAN"
);
break
;
...
...
@@ -102,7 +105,7 @@ printFiletype(int streamID, int vlistID)
int
comptype
=
vlistInqVarCompType
(
vlistID
,
varID
);
if
(
comptype
==
comps
[
k
])
{
printf
(
"%c%s"
,
(
kk
++
==
0
)
?
' '
:
'/'
,
comp_name
(
comptype
));
printf
(
"%c%s"
,
(
kk
++
==
0
)
?
' '
:
'/'
,
comp
type_to
_name
(
comptype
));
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
app/printinfo.h
+
1
−
1
View file @
a787010d
...
...
@@ -7,7 +7,7 @@ void datetime2str(CdiDateTime dt, char *datetimestr, int maxlen);
void
date2str
(
CdiDate
date
,
char
*
datestr
,
int
maxlen
);
void
time2str
(
CdiTime
time
,
char
*
timestr
,
int
maxlen
);
const
char
*
comp_name
(
int
comptype
);
const
char
*
comp
type_to
_name
(
int
comptype
);
void
printFiletype
(
int
streamID
,
int
vlistID
);
void
printGridInfo
(
int
vlistID
);
...
...
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