Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
2763c30d
Commit
2763c30d
authored
Mar 26, 2010
by
Uwe Schulzweida
Browse files
added example cdi_open.c
parent
64ae99f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
2763c30d
...
...
@@ -78,6 +78,7 @@ examples/Makefile.in -text
examples/cdi_copy.c -text
examples/cdi_copy_f.f -text
examples/cdi_copy_file.c -text
examples/cdi_open.c -text
examples/cdi_read.c -text
examples/cdi_read_example.f90 -text
examples/cdi_read_f.f -text
...
...
examples/cdi_open.c
0 → 100644
View file @
2763c30d
#include
<stdio.h>
#include
"cdi.h"
#define NOPEN 8096
#define FILENAME "example.grb"
int
main
(
void
)
{
int
iopen
;
int
taxisID
,
vlistID
,
streamID
;
int
streamIDs
[
NOPEN
];
for
(
iopen
=
0
;
iopen
<
NOPEN
;
++
iopen
)
{
fprintf
(
stderr
,
"sequential open %d
\n
"
,
iopen
+
1
);
/* Open the dataset */
streamID
=
streamOpenRead
(
FILENAME
);
if
(
streamID
<
0
)
{
fprintf
(
stderr
,
"%s
\n
"
,
cdiStringError
(
streamID
));
return
(
1
);
}
/* Get the variable list of the dataset */
vlistID
=
streamInqVlist
(
streamID
);
/* Get the Time axis from the variable list */
taxisID
=
vlistInqTaxis
(
vlistID
);
/* Close the input stream */
streamClose
(
streamID
);
}
for
(
iopen
=
0
;
iopen
<
NOPEN
;
++
iopen
)
{
fprintf
(
stderr
,
"simultaneous open %d
\n
"
,
iopen
+
1
);
/* Open the dataset */
streamID
=
streamOpenRead
(
FILENAME
);
if
(
streamID
<
0
)
{
fprintf
(
stderr
,
"%s
\n
"
,
cdiStringError
(
streamID
));
return
(
1
);
}
/* Get the variable list of the dataset */
vlistID
=
streamInqVlist
(
streamID
);
/* Get the Time axis from the variable list */
taxisID
=
vlistInqTaxis
(
vlistID
);
streamIDs
[
iopen
]
=
streamID
;
}
for
(
iopen
=
0
;
iopen
<
NOPEN
;
++
iopen
)
{
/* Close the input stream */
streamClose
(
streamIDs
[
iopen
]);
}
return
0
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment