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
9b23977b
Commit
9b23977b
authored
10 years ago
by
Florian Prill
Browse files
Options
Downloads
Patches
Plain Diff
[cdi-tiles] Added plain example.
parent
2d338ae3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitattributes
+1
-0
1 addition, 0 deletions
.gitattributes
basic_test/Makefile
+5
-0
5 additions, 0 deletions
basic_test/Makefile
basic_test/main_plain.c
+36
-0
36 additions, 0 deletions
basic_test/main_plain.c
with
42 additions
and
0 deletions
.gitattributes
+
1
−
0
View file @
9b23977b
...
...
@@ -17,6 +17,7 @@ app/printinfo.h -text
basic_test/Makefile -text
basic_test/example.f90 -text
basic_test/main.c -text
basic_test/main_plain.c -text
/cdi.settings.in -text
config/compile -text
config/config.guess -text
...
...
This diff is collapsed.
Click to expand it.
basic_test/Makefile
+
5
−
0
View file @
9b23977b
...
...
@@ -15,3 +15,8 @@ xce:
ftn
-I
../build/include cdilib.o example.f90
-L
${
NETCDF_DIR
}
/lib
${
GRIB_API_LIB
}
-lgrib_api
-lnetcdff
-lnetcdf
-o
example
clean
:
rm
-f
main main.o example cdilib.o
plain
:
gcc
${
CFLAGS
}
-I
../build/include
-c
main_plain.c
-o
main_plain.o
gcc
-L
../build/lib64 main_plain.o
-lcdi
-o
main_plain
LD_LIBRARY_PATH
=
$LD_LIBRARY_PATH
:../build/lib64 ./main_plain
This diff is collapsed.
Click to expand it.
basic_test/main_plain.c
0 → 100644
+
36
−
0
View file @
9b23977b
#include
<stdlib.h>
#include
<cdi.h>
int
main
(
void
)
{
printf
(
"
\n
cdi-tiles example
\n
-----------------
\n\n
"
);
/* Register additional GRIB keys which are read when file is opened. */
cdiDefAdditionalKey
(
"identificationNumberOfTile"
);
cdiDefAdditionalKey
(
"attribute"
);
int
streamID
=
streamOpenRead
(
"test.grb"
);
/* loop over variables */
int
vlistID
=
streamInqVlist
(
streamID
);
int
nvars
=
streamInqNvars
(
streamID
);
int
identificationNumberOfTile
=
4
,
attribute
=
4
;
printf
(
"identificationNumberOfTile = %d
\n
"
,
identificationNumberOfTile
);
printf
(
"attribute = %d
\n\n
"
,
attribute
);
for
(
int
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
char
name
[
CDI_MAX_NAME
];
vlistInqVarName
(
vlistID
,
varID
,
name
);
printf
(
"variable %-10.10s
\n
"
,
name
);
}
streamClose
(
streamID
);
printf
(
"done.
\n
"
);
return
0
;
}
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