Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libcdi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpim-sw
libcdi
Commits
bbe2cd33
Commit
bbe2cd33
authored
Jun 29, 2020
by
Uwe Schulzweida
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify if statement.
parent
bcb8d2e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
30 deletions
+11
-30
src/stream_gribapi.c
src/stream_gribapi.c
+11
-30
No files found.
src/stream_gribapi.c
View file @
bbe2cd33
...
...
@@ -873,10 +873,9 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
{
size_t
len
=
256
;
char
typeOfPacking
[
256
];
if
(
grib_get_string
(
gh
,
"packingType"
,
typeOfPacking
,
&
len
)
==
0
)
{
// fprintf(stderr, "packingType %
d
%s\n", len, typeOfPacking);
// fprintf(stderr, "packingType %
zu
%s\n", len, typeOfPacking);
if
(
strncmp
(
typeOfPacking
,
"grid_jpeg"
,
len
)
==
0
)
*
outCompressionType
=
CDI_COMPRESS_JPEG
;
else
if
(
strncmp
(
typeOfPacking
,
"grid_ccsds"
,
len
)
==
0
)
*
outCompressionType
=
CDI_COMPRESS_AEC
;
else
if
(
strncmp
(
typeOfPacking
,
"grid_ieee"
,
len
)
==
0
)
lieee
=
true
;
...
...
@@ -885,10 +884,9 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
if
(
lieee
)
{
*
outDatatype
=
CDI_DATATYPE_FLT64
;
long
precision
;
const
int
status
=
grib_get_long
(
gh
,
"precision"
,
&
precision
);
if
(
status
==
0
&&
precision
==
1
)
*
outDatatype
=
CDI_DATATYPE_FLT32
;
*
outDatatype
=
(
status
==
0
&&
precision
==
1
)
?
CDI_DATATYPE_FLT32
:
CDI_DATATYPE_FLT64
;
}
else
{
...
...
@@ -2187,49 +2185,32 @@ void gribapiDefGridSpectral(grib_handle *gh, int gridID)
static
void
gribapiDefPackingType
(
grib_handle
*
gh
,
bool
lieee
,
bool
lspectral
,
bool
lcomplex
,
int
comptype
,
size_t
gridsize
)
{
const
char
*
mesg
;
size_t
len
;
static
const
char
mesg_spectral_complex
[]
=
"spectral_complex"
;
static
const
char
mesg_spectral_simple
[]
=
"spectral_simple"
;
static
const
char
mesg_grid_jpeg
[]
=
"grid_jpeg"
;
static
const
char
mesg_grid_ccsds
[]
=
"grid_ccsds"
;
static
const
char
mesg_ieee
[]
=
"grid_ieee"
;
static
const
char
mesg_simple
[]
=
"grid_simple"
;
const
char
*
mesg
=
mesg_simple
;
if
(
lspectral
)
{
if
(
lcomplex
)
{
static
const
char
mesg_spectral_complex
[]
=
"spectral_complex"
;
len
=
sizeof
(
mesg_spectral_complex
)
-
1
;
mesg
=
mesg_spectral_complex
;
}
else
{
static
const
char
mesg_spectral_simple
[]
=
"spectral_simple"
;
len
=
sizeof
(
mesg_spectral_simple
)
-
1
;
mesg
=
mesg_spectral_simple
;
}
mesg
=
lcomplex
?
mesg_spectral_complex
:
mesg_spectral_simple
;
}
else
if
(
comptype
==
CDI_COMPRESS_JPEG
&&
gridsize
>
1
)
{
static
const
char
mesg_grid_jpeg
[]
=
"grid_jpeg"
;
len
=
sizeof
(
mesg_grid_jpeg
)
-
1
;
mesg
=
mesg_grid_jpeg
;
}
else
if
(
(
comptype
==
CDI_COMPRESS_SZIP
||
comptype
==
CDI_COMPRESS_AEC
)
&&
gridsize
>
1
)
{
static
const
char
mesg_grid_ccsds
[]
=
"grid_ccsds"
;
len
=
sizeof
(
mesg_grid_ccsds
)
-
1
;
mesg
=
mesg_grid_ccsds
;
}
else
if
(
lieee
)
{
static
const
char
mesg_ieee
[]
=
"grid_ieee"
;
len
=
sizeof
(
mesg_ieee
)
-
1
;
mesg
=
mesg_ieee
;
}
else
{
static
const
char
mesg_simple
[]
=
"grid_simple"
;
len
=
sizeof
(
mesg_simple
)
-
1
;
mesg
=
mesg_simple
;
}
size_t
len
=
strlen
(
mesg
);
GRIB_CHECK
(
my_grib_set_string
(
gh
,
"packingType"
,
mesg
,
&
len
),
0
);
}
...
...
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