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
4ea1ffc0
Commit
4ea1ffc0
authored
6 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
gribapiGetKeys: get MPIM local section.
parent
a140d8f3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChangeLog
+4
-0
4 additions, 0 deletions
ChangeLog
src/stream_gribapi.c
+30
-13
30 additions, 13 deletions
src/stream_gribapi.c
with
34 additions
and
13 deletions
ChangeLog
+
4
−
0
View file @
4ea1ffc0
...
...
@@ -3,6 +3,10 @@
* using CGRIBEX library version 1.9.1
* Version 1.9.5 released
2018-05-23 Uwe Schulzweida
* gribapiGetKeys: get MPIM local section
2018-05-11 Uwe Schulzweida
* taxis: changed type of date to int64_t
...
...
This diff is collapsed.
Click to expand it.
src/stream_gribapi.c
+
30
−
13
View file @
4ea1ffc0
...
...
@@ -457,18 +457,36 @@ void gribapiGetKeys(grib_handle *gh, int varID)
if
(
section2Length
>
0
)
{
long
grib2LocalSectionNumber
;
long
mpimType
,
mpimClass
,
mpimUser
;
grib_get_long
(
gh
,
"grib2LocalSectionNumber"
,
&
grib2LocalSectionNumber
);
size_t
size
=
0
;
if
(
grib_get_size
(
gh
,
"section2Padding"
,
&
size
)
==
0
)
if
(
size
>
0
)
{
varDefKeyInt
(
varID
,
CDI_KEY_GRIB2LOCALSECTIONNUMBER
,
(
int
)
grib2LocalSectionNumber
);
varDefKeyInt
(
varID
,
CDI_KEY_SECTION2PADDINGLENGTH
,
(
int
)
size
);
unsigned
char
*
section2Padding
=
(
unsigned
char
*
)
Malloc
(
size
);
grib_get_bytes
(
gh
,
"section2Padding"
,
section2Padding
,
&
size
);
varDefKeyBytes
(
varID
,
CDI_KEY_SECTION2PADDING
,
section2Padding
,
(
int
)
size
);
Free
(
section2Padding
);
}
size_t
section2PaddingLength
=
0
;
int
status
=
grib_get_size
(
gh
,
"section2Padding"
,
&
section2PaddingLength
);
if
(
status
==
0
&&
section2PaddingLength
>
0
)
{
varDefKeyInt
(
varID
,
CDI_KEY_GRIB2LOCALSECTIONNUMBER
,
(
int
)
grib2LocalSectionNumber
);
varDefKeyInt
(
varID
,
CDI_KEY_SECTION2PADDINGLENGTH
,
(
int
)
section2PaddingLength
);
unsigned
char
*
section2Padding
=
(
unsigned
char
*
)
Malloc
(
section2PaddingLength
);
grib_get_bytes
(
gh
,
"section2Padding"
,
section2Padding
,
&
section2PaddingLength
);
varDefKeyBytes
(
varID
,
CDI_KEY_SECTION2PADDING
,
section2Padding
,
(
int
)
section2PaddingLength
);
Free
(
section2Padding
);
}
else
if
(
grib_get_long
(
gh
,
"mpimType"
,
&
mpimType
)
==
0
&&
grib_get_long
(
gh
,
"mpimClass"
,
&
mpimClass
)
==
0
&&
grib_get_long
(
gh
,
"mpimUser"
,
&
mpimUser
)
==
0
)
{
varDefKeyInt
(
varID
,
CDI_KEY_MPIMTYPE
,
mpimType
);
varDefKeyInt
(
varID
,
CDI_KEY_MPIMCLASS
,
mpimClass
);
varDefKeyInt
(
varID
,
CDI_KEY_MPIMUSER
,
mpimUser
);
size_t
revNumLen
=
20
;
unsigned
char
revNumber
[
revNumLen
];
if
(
grib_get_bytes
(
gh
,
"revNumber"
,
revNumber
,
&
revNumLen
)
==
0
)
varDefKeyBytes
(
varID
,
CDI_KEY_REVNUMBER
,
revNumber
,
(
int
)
revNumLen
);
long
revStatus
;
grib_get_long
(
gh
,
"revStatus"
,
&
revStatus
);
varDefKeyInt
(
varID
,
CDI_KEY_REVSTATUS
,
revStatus
);
}
}
}
...
...
@@ -3097,8 +3115,7 @@ size_t gribapiEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
{
int
ret
=
0
;
/* NOTE: Optional key/value pairs: Note that we do not distinguish
* between tiles here! */
/* NOTE: Optional key/value pairs: Note that we do not distinguish between tiles here! */
for
(
int
i
=
0
;
i
<
vlistptr
->
vars
[
varID
].
opt_grib_nentries
;
i
++
)
{
...
...
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