Skip to content
GitLab
Menu
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
ac1b6f91
Commit
ac1b6f91
authored
Feb 08, 2019
by
Uwe Schulzweida
Browse files
Added function cdfDefineStartAndCount().
parent
29337c55
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cdf_write.c
View file @
ac1b6f91
...
...
@@ -1003,16 +1003,12 @@ void cdfGetXYZid(stream_t *streamptr, int gridID, int zaxisID, int *xid, int *yi
*
zid
=
streamptr
->
zaxisID
[
zaxisindex
];
}
void
cdf_write_var
(
stream_t
*
streamptr
,
int
varID
,
int
memtype
,
const
void
*
data
,
size_t
nmiss
)
static
void
cdfDefineStartAndCount
(
stream_t
*
streamptr
,
int
varID
,
int
xid
,
int
yid
,
int
zid
,
size_t
start
[
5
],
size_t
count
[
5
],
size_t
*
xsize
,
size_t
*
ysize
)
{
if
(
streamptr
->
accessmode
==
0
)
cdfEndDef
(
streamptr
);
size_t
xsize
=
0
,
ysize
=
0
;
size_t
size
;
size_t
start
[
5
],
count
[
5
];
size_t
ndims
=
0
;
if
(
CDI_Debug
)
Message
(
"streamID = %d varID = %d"
,
streamptr
->
self
,
varID
)
;
*
xsize
=
0
;
*
ysize
=
0
;
const
int
vlistID
=
streamptr
->
vlistID
;
const
int
fileID
=
streamptr
->
fileID
;
...
...
@@ -1020,15 +1016,8 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
const
long
ntsteps
=
streamptr
->
ntsteps
;
if
(
CDI_Debug
)
Message
(
"ntsteps = %ld"
,
ntsteps
);
const
int
ncvarid
=
cdfDefVar
(
streamptr
,
varID
);
const
int
gridID
=
vlistInqVarGrid
(
vlistID
,
varID
);
const
int
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
const
int
timetype
=
vlistInqVarTimetype
(
vlistID
,
varID
);
int
xid
,
yid
,
zid
;
cdfGetXYZid
(
streamptr
,
gridID
,
zaxisID
,
&
xid
,
&
yid
,
&
zid
);
if
(
vlistHasTime
(
vlistID
)
&&
timetype
!=
TIME_CONSTANT
)
{
start
[
ndims
]
=
(
size_t
)
ntsteps
-
1
;
...
...
@@ -1038,6 +1027,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
if
(
zid
!=
CDI_UNDEFID
)
{
const
int
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
start
[
ndims
]
=
0
;
count
[
ndims
]
=
(
size_t
)
zaxisInqSize
(
zaxisID
);
ndims
++
;
...
...
@@ -1046,6 +1036,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
if
(
yid
!=
CDI_UNDEFID
)
{
start
[
ndims
]
=
0
;
size_t
size
;
cdf_inq_dimlen
(
fileID
,
yid
,
&
size
);
/* count[ndims] = gridInqYsize(gridID); */
count
[
ndims
]
=
size
;
...
...
@@ -1055,6 +1046,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
if
(
xid
!=
CDI_UNDEFID
)
{
start
[
ndims
]
=
0
;
size_t
size
;
cdf_inq_dimlen
(
fileID
,
xid
,
&
size
);
/* count[ndims] = gridInqXsize(gridID); */
count
[
ndims
]
=
size
;
...
...
@@ -1064,6 +1056,31 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
if
(
CDI_Debug
)
for
(
size_t
idim
=
0
;
idim
<
ndims
;
idim
++
)
Message
(
"dim = %d start = %d count = %d"
,
idim
,
start
[
idim
],
count
[
idim
]);
}
void
cdf_write_var
(
stream_t
*
streamptr
,
int
varID
,
int
memtype
,
const
void
*
data
,
size_t
nmiss
)
{
if
(
streamptr
->
accessmode
==
0
)
cdfEndDef
(
streamptr
);
if
(
CDI_Debug
)
Message
(
"streamID = %d varID = %d"
,
streamptr
->
self
,
varID
);
const
int
vlistID
=
streamptr
->
vlistID
;
const
int
fileID
=
streamptr
->
fileID
;
const
long
ntsteps
=
streamptr
->
ntsteps
;
if
(
CDI_Debug
)
Message
(
"ntsteps = %ld"
,
ntsteps
);
const
int
ncvarid
=
cdfDefVar
(
streamptr
,
varID
);
const
int
gridID
=
vlistInqVarGrid
(
vlistID
,
varID
);
const
int
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
int
xid
,
yid
,
zid
;
cdfGetXYZid
(
streamptr
,
gridID
,
zaxisID
,
&
xid
,
&
yid
,
&
zid
);
size_t
xsize
,
ysize
;
size_t
start
[
5
],
count
[
5
];
cdfDefineStartAndCount
(
streamptr
,
varID
,
xid
,
yid
,
zid
,
start
,
count
,
&
xsize
,
&
ysize
);
if
(
streamptr
->
ncmode
==
1
)
{
...
...
Write
Preview
Supports
Markdown
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