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
48dca454
Commit
48dca454
authored
Dec 11, 2012
by
Uwe Schulzweida
Browse files
added vlistDefVarChunkType() and vlistInqVarChunkType()
parent
ae397dde
Changes
9
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
48dca454
...
...
@@ -3,6 +3,10 @@
* Version 1.5.9 released
* using CGRIBEX library version 1.5.6
2012-12-11 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added vlistDefVarChunkType() and vlistInqVarChunkType()
2012-12-03 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* vlistCopyFlag: added support for level bounds
...
...
NEWS
View file @
48dca454
...
...
@@ -6,7 +6,9 @@ Version 1.5.8 (30 October 2012):
New features:
* grib2: added stepType support for absolute time axis
* netCDF: set 1D arrays to coordinate variables if axis attribute is available
New funktions:
* vlistDefVarChunktype(): set chunktype to CHUNK_AUTO, CHUNK_GRID, CHUNK_LINES
* vlistInqVarChunktype(): returns the chunktype
Fixed bugs:
* grib2: changed packingType from grid_jpeg to grid_simple if nmiss > 0
...
...
src/cdi.h
View file @
48dca454
...
...
@@ -112,6 +112,11 @@ extern "C" {
#define DATATYPE_TXT 253
#define DATATYPE_CPX 254
/* Chunks */
#define CHUNK_AUTO 1
/* use default chunk size */
#define CHUNK_GRID 2
#define CHUNK_LINES 3
/* GRID types */
...
...
@@ -450,6 +455,9 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype);
/* vlistInqVarDatatype: Get the data type of a Variable */
int
vlistInqVarDatatype
(
int
vlistID
,
int
varID
);
void
vlistDefVarChunkType
(
int
vlistID
,
int
varID
,
int
chunktype
);
int
vlistInqVarChunkType
(
int
vlistID
,
int
varID
);
void
vlistDefVarXYZ
(
int
vlistID
,
int
varID
,
int
xyz
);
int
vlistInqVarXYZ
(
int
vlistID
,
int
varID
);
...
...
src/stream_cdf.c
View file @
48dca454
...
...
@@ -2670,6 +2670,7 @@ int cdfDefVar(int streamID, int varID)
const
char
*
units
=
NULL
;
int
dims
[
4
];
int
lchunk
=
FALSE
;
int
chunktype
;
size_t
chunks
[
4
]
=
{
0
,
0
,
0
,
0
};
int
tableID
;
int
ndims
=
0
;
...
...
@@ -2706,6 +2707,8 @@ int cdfDefVar(int streamID, int varID)
param
=
vlistInqVarParam
(
vlistID
,
varID
);
cdiDecodeParam
(
param
,
&
pnum
,
&
pcat
,
&
pdis
);
chunktype
=
vlistInqVarChunkType
(
vlistID
,
varID
);
ixyz
=
vlistInqVarXYZ
(
vlistID
,
varID
);
if
(
ixyz
==
0
)
ixyz
=
321
;
// ZYX
...
...
@@ -2766,7 +2769,10 @@ int cdfDefVar(int streamID, int varID)
}
else
if
(
dimorder
[
id
]
==
2
&&
yid
!=
UNDEFID
)
{
chunks
[
ndims
]
=
ysize
;
if
(
chunktype
==
CHUNK_LINES
)
chunks
[
ndims
]
=
1
;
else
chunks
[
ndims
]
=
ysize
;
dims
[
ndims
]
=
yid
;
ndims
++
;
}
...
...
@@ -2779,7 +2785,7 @@ int cdfDefVar(int streamID, int varID)
}
if
(
CDI_Debug
)
fprintf
(
stderr
,
"chunks %d %d %d %d
\n
"
,
(
int
)
chunks
[
0
],
(
int
)
chunks
[
1
],
(
int
)
chunks
[
2
],
(
int
)
chunks
[
3
]);
fprintf
(
stderr
,
"
chunktype %d
chunks %d %d %d %d
\n
"
,
chunktype
,
(
int
)
chunks
[
0
],
(
int
)
chunks
[
1
],
(
int
)
chunks
[
2
],
(
int
)
chunks
[
3
]);
tableID
=
vlistInqVarTable
(
vlistID
,
varID
);
...
...
@@ -2874,8 +2880,12 @@ int cdfDefVar(int streamID, int varID)
#if defined (HAVE_NETCDF4)
if
(
lchunk
&&
(
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
)
{
if
(
(
retval
=
nc_def_var_chunking
(
fileID
,
ncvarid
,
0
,
chunks
))
)
Error
(
"nc_def_var_chunking failed, status = %d"
,
retval
);
if
(
chunktype
==
CHUNK_AUTO
)
retval
=
nc_def_var_chunking
(
fileID
,
ncvarid
,
NC_CHUNKED
,
NULL
);
else
retval
=
nc_def_var_chunking
(
fileID
,
ncvarid
,
NC_CHUNKED
,
chunks
);
if
(
retval
)
Error
(
"nc_def_var_chunking failed, status = %d"
,
retval
);
}
#endif
...
...
src/stream_int.c
View file @
48dca454
...
...
@@ -29,9 +29,7 @@ int cdiDefaultModelID = CDI_UNDEFID;
int
cdiDefaultTableID
=
CDI_UNDEFID
;
int
cdiNcMissingValue
=
CDI_UNDEFID
;
int
cdiNcChunksizehint
=
CDI_UNDEFID
;
int
cdiChunkAlgo
=
CHUNK_DEFAULT
;
int
cdiChunkX
=
-
1
;
int
cdiChunkY
=
-
1
;
int
cdiChunkType
=
CHUNK_GRID
;
int
cdiSplitLtype105
=
CDI_UNDEFID
;
int
cdiIgnoreAttCoordinates
=
FALSE
;
...
...
@@ -134,9 +132,10 @@ void cdiSetChunk(const char *chunkAlgo)
size_t
len
=
strlen
(
chunkAlgo
);
int
algo
=
-
1
;
if
(
strcmp
(
"
default
"
,
chunkAlgo
)
==
0
)
algo
=
CHUNK_
DEFAULT
;
else
if
(
strcmp
(
"
auto
"
,
chunkAlgo
)
==
0
)
algo
=
CHUNK_
AUTO
;
if
(
strcmp
(
"
auto
"
,
chunkAlgo
)
==
0
)
algo
=
CHUNK_
AUTO
;
else
if
(
strcmp
(
"
grid
"
,
chunkAlgo
)
==
0
)
algo
=
CHUNK_
GRID
;
else
if
(
strcmp
(
"lines"
,
chunkAlgo
)
==
0
)
algo
=
CHUNK_LINES
;
/*
else if ( (pch = strstr(chunkAlgo,"x")) != 0 )
{
int ix, iy;
...
...
@@ -151,12 +150,13 @@ void cdiSetChunk(const char *chunkAlgo)
else
Warning("Invalid environment variable CDI_CHUNK_ALGO: %s", chunkAlgo);
}
*/
else
Warning
(
"Invalid environment variable CDI_CHUNK_ALGO: %s"
,
chunkAlgo
);
if
(
algo
!=
-
1
)
{
cdiChunk
Algo
=
algo
;
cdiChunk
Type
=
algo
;
if
(
CDI_Debug
)
Message
(
"set ChunkAlgo to %s"
,
chunkAlgo
);
}
}
...
...
src/stream_int.h
View file @
48dca454
...
...
@@ -104,10 +104,6 @@ char *strdup(const char *s);
#define MEMTYPE_DOUBLE 1
#define MEMTYPE_FLOAT 2
enum
{
CHUNK_DEFAULT
,
CHUNK_AUTO
,
CHUNK_LINES
,
CHUNK_USER
};
typedef
struct
{
void
*
buffer
;
...
...
@@ -266,9 +262,7 @@ extern int cdiDefaultTableID;
extern
int
cdiDefaultLeveltype
;
extern
int
cdiNcMissingValue
;
extern
int
cdiNcChunksizehint
;
extern
int
cdiChunkAlgo
;
extern
int
cdiChunkX
;
extern
int
cdiChunkY
;
extern
int
cdiChunkType
;
extern
int
cdiSplitLtype105
;
extern
char
*
cdiPartabPath
;
...
...
src/vlist.c
View file @
48dca454
...
...
@@ -180,6 +180,8 @@ int vlistCreate(void)
int
vlistID
=
0
;
vlist_t
*
vlistptr
;
cdiInitialize
();
VLIST_INIT
();
vlistptr
=
vlist_new_entry
();
...
...
src/vlist.h
View file @
48dca454
...
...
@@ -86,6 +86,7 @@ typedef struct
int
tableID
;
int
timave
;
int
timaccu
;
int
chunktype
;
int
xyz
;
int
missvalused
;
/* TRUE if missval is defined */
int
lvalidrange
;
...
...
src/vlist_var.c
View file @
48dca454
...
...
@@ -35,6 +35,7 @@ void vlistvarInitEntry(int vlistID, int varID)
vlistptr
->
vars
[
varID
].
tsteptype
=
TSTEP_INSTANT
;
vlistptr
->
vars
[
varID
].
timave
=
0
;
vlistptr
->
vars
[
varID
].
timaccu
=
0
;
vlistptr
->
vars
[
varID
].
chunktype
=
cdiChunkType
;
vlistptr
->
vars
[
varID
].
xyz
=
0
;
vlistptr
->
vars
[
varID
].
gridID
=
CDI_UNDEFID
;
vlistptr
->
vars
[
varID
].
zaxisID
=
CDI_UNDEFID
;
...
...
@@ -59,9 +60,9 @@ void vlistvarInitEntry(int vlistID, int varID)
vlistptr
->
vars
[
varID
].
validrange
[
0
]
=
VALIDMISS
;
vlistptr
->
vars
[
varID
].
validrange
[
1
]
=
VALIDMISS
;
vlistptr
->
vars
[
varID
].
ensdata
=
NULL
;
vlistptr
->
vars
[
varID
].
iorank
=
CDI_UNDEFID
;
vlistptr
->
vars
[
varID
].
decoSize
=
0
;
vlistptr
->
vars
[
varID
].
deco
=
NULL
;
vlistptr
->
vars
[
varID
].
iorank
=
CDI_UNDEFID
;
vlistptr
->
vars
[
varID
].
decoSize
=
0
;
vlistptr
->
vars
[
varID
].
deco
=
NULL
;
}
static
...
...
@@ -1686,6 +1687,30 @@ int vlistInqVarCompLevel(int vlistID, int varID)
}
void
vlistDefVarChunkType
(
int
vlistID
,
int
varID
,
int
chunktype
)
{
vlist_t
*
vlistptr
;
vlistptr
=
vlist_to_pointer
(
vlistID
);
vlistCheckVarID
(
__func__
,
vlistID
,
varID
);
vlistptr
->
vars
[
varID
].
chunktype
=
chunktype
;
}
int
vlistInqVarChunkType
(
int
vlistID
,
int
varID
)
{
vlist_t
*
vlistptr
;
vlistptr
=
vlist_to_pointer
(
vlistID
);
vlistCheckVarID
(
__func__
,
vlistID
,
varID
);
return
(
vlistptr
->
vars
[
varID
].
chunktype
);
}
void
vlistDefVarXYZ
(
int
vlistID
,
int
varID
,
int
xyz
)
{
vlist_t
*
vlistptr
;
...
...
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