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
4c0331cb
Commit
4c0331cb
authored
Aug 01, 2016
by
Uwe Schulzweida
Browse files
Renamed COMPRESS_XXX to CDI_COMPRESS_XXX.
parent
57d0e96b
Changes
12
Hide whitespace changes
Inline
Side-by-side
app/cdi.c
View file @
4c0331cb
...
...
@@ -66,7 +66,7 @@ static int DefaultFileType = CDI_UNDEFID;
static
int
DefaultDataType
=
CDI_UNDEFID
;
static
int
DefaultByteorder
=
CDI_UNDEFID
;
static
int
comptype
=
COMPRESS_NONE
;
// Compression type
static
int
comptype
=
CDI_
COMPRESS_NONE
;
// Compression type
static
int
complevel
=
0
;
// Compression level
enum
datamode
{
SP_MODE
,
DP_MODE
};
...
...
@@ -435,7 +435,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
fprintf
(
stdout
,
" %-3s"
,
pstr
);
if
(
vlistInqVarCompType
(
vlistID
,
varID
)
==
COMPRESS_NONE
)
if
(
vlistInqVarCompType
(
vlistID
,
varID
)
==
CDI_
COMPRESS_NONE
)
fprintf
(
stdout
,
" "
);
else
fprintf
(
stdout
,
"z "
);
...
...
@@ -712,20 +712,20 @@ void defineCompress(const char *arg)
if
(
strncmp
(
arg
,
"szip"
,
len
)
==
0
)
{
comptype
=
COMPRESS_SZIP
;
comptype
=
CDI_
COMPRESS_SZIP
;
}
else
if
(
strncmp
(
arg
,
"jpeg"
,
len
)
==
0
)
{
comptype
=
COMPRESS_JPEG
;
comptype
=
CDI_
COMPRESS_JPEG
;
}
else
if
(
strncmp
(
arg
,
"gzip"
,
len
)
==
0
)
{
comptype
=
COMPRESS_GZIP
;
comptype
=
CDI_
COMPRESS_GZIP
;
complevel
=
6
;
}
else
if
(
strncmp
(
arg
,
"zip"
,
3
)
==
0
)
{
comptype
=
COMPRESS_ZIP
;
comptype
=
CDI_
COMPRESS_ZIP
;
if
(
len
==
5
&&
arg
[
3
]
==
'_'
&&
isdigit
(
arg
[
4
])
)
complevel
=
atoi
(
&
arg
[
4
]);
else
...
...
@@ -923,7 +923,7 @@ int main(int argc, char *argv[])
if
(
DefaultByteorder
!=
CDI_UNDEFID
)
streamDefByteorder
(
streamID2
,
DefaultByteorder
);
if
(
comptype
!=
COMPRESS_NONE
)
if
(
comptype
!=
CDI_
COMPRESS_NONE
)
{
streamDefCompType
(
streamID2
,
comptype
);
streamDefCompLevel
(
streamID2
,
complevel
);
...
...
app/printinfo.h
View file @
4c0331cb
...
...
@@ -115,9 +115,9 @@ void printFiletype(int streamID, int vlistID)
comptype
=
vlistInqVarCompType
(
vlistID
,
varID
);
if
(
comptype
)
{
if
(
comptype
==
COMPRESS_SZIP
)
if
(
comptype
==
CDI_
COMPRESS_SZIP
)
printf
(
" SZIP"
);
else
if
(
comptype
==
COMPRESS_ZIP
)
else
if
(
comptype
==
CDI_
COMPRESS_ZIP
)
printf
(
" ZIP"
);
break
;
...
...
@@ -134,7 +134,7 @@ void printFiletype(int streamID, int vlistID)
comptype
=
vlistInqVarCompType
(
vlistID
,
varID
);
if
(
comptype
)
{
if
(
comptype
==
COMPRESS_JPEG
)
if
(
comptype
==
CDI_
COMPRESS_JPEG
)
printf
(
" JPEG"
);
break
;
...
...
src/cdf_write.c
View file @
4c0331cb
...
...
@@ -526,7 +526,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
}
#endif
if
(
streamptr
->
comptype
==
COMPRESS_ZIP
)
if
(
streamptr
->
comptype
==
CDI_
COMPRESS_ZIP
)
{
if
(
lchunk
&&
(
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
)
{
...
...
@@ -547,7 +547,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
}
}
if
(
streamptr
->
comptype
==
COMPRESS_SZIP
)
if
(
streamptr
->
comptype
==
CDI_
COMPRESS_SZIP
)
{
if
(
lchunk
&&
(
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
)
{
...
...
src/cdi.h
View file @
4c0331cb
...
...
@@ -57,12 +57,12 @@ extern "C" {
/* Compress types */
#define COMPRESS_NONE
0
#define COMPRESS_SZIP
1
#define COMPRESS_GZIP
2
#define COMPRESS_BZIP2
3
#define COMPRESS_ZIP
4
#define COMPRESS_JPEG
5
#define
CDI_
COMPRESS_NONE 0
#define
CDI_
COMPRESS_SZIP 1
#define
CDI_
COMPRESS_GZIP 2
#define
CDI_
COMPRESS_BZIP2 3
#define
CDI_
COMPRESS_ZIP 4
#define
CDI_
COMPRESS_JPEG 5
/* external data types */
...
...
src/grb_write.c
View file @
4c0331cb
...
...
@@ -121,7 +121,7 @@ void grbCopyRecord(stream_t * streamptr2, stream_t * streamptr1)
long
unzipsize
;
int
izip
=
gribGetZip
((
long
)
recsize
,
gribbuffer
,
&
unzipsize
);
if
(
izip
==
0
&&
streamptr2
->
comptype
==
COMPRESS_SZIP
)
if
(
izip
==
0
&&
streamptr2
->
comptype
==
CDI_
COMPRESS_SZIP
)
nbytes
=
grbSzip
(
filetype
,
gribbuffer
,
nbytes
);
}
...
...
@@ -178,9 +178,9 @@ void grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
#endif
}
if
(
comptype
!=
COMPRESS_JPEG
&&
comptype
!=
COMPRESS_SZIP
)
comptype
=
COMPRESS_NONE
;
if
(
comptype
!=
CDI_
COMPRESS_JPEG
&&
comptype
!=
CDI_
COMPRESS_SZIP
)
comptype
=
CDI_
COMPRESS_NONE
;
if
(
filetype
==
FILETYPE_GRB
&&
comptype
==
COMPRESS_JPEG
)
if
(
filetype
==
FILETYPE_GRB
&&
comptype
==
CDI_
COMPRESS_JPEG
)
{
static
int
ljpeg_warn
=
1
;
if
(
ljpeg_warn
)
Warning
(
"JPEG compression of GRIB1 records not available!"
);
...
...
@@ -190,7 +190,7 @@ void grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
size_t
nbytes
=
grbEncode
(
filetype
,
memtype
,
varID
,
levelID
,
vlistID
,
gridID
,
zaxisID
,
date
,
time
,
tsteptype
,
numavg
,
datasize
,
data
,
nmiss
,
&
gribbuffer
,
comptype
,
gc
);
if
(
filetype
==
FILETYPE_GRB
&&
streamptr
->
comptype
==
COMPRESS_SZIP
)
if
(
filetype
==
FILETYPE_GRB
&&
streamptr
->
comptype
==
CDI_
COMPRESS_SZIP
)
nbytes
=
grbSzip
(
filetype
,
gribbuffer
,
nbytes
);
size_t
(
*
myFileWrite
)(
int
fileID
,
const
void
*
restrict
buffer
,
...
...
src/stream.c
View file @
4c0331cb
...
...
@@ -872,7 +872,7 @@ void streamDefaultValue ( stream_t * streamptr )
streamptr
->
unreduced
=
cdiDataUnreduced
;
streamptr
->
sortname
=
cdiSortName
;
streamptr
->
have_missval
=
cdiHaveMissval
;
streamptr
->
comptype
=
COMPRESS_NONE
;
streamptr
->
comptype
=
CDI_
COMPRESS_NONE
;
streamptr
->
complevel
=
0
;
basetimeInit
(
&
streamptr
->
basetime
);
...
...
src/stream_cdf_i.c
View file @
4c0331cb
...
...
@@ -3014,7 +3014,7 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
#if defined (HAVE_NETCDF4)
if
(
ncvars
[
ncvarid
].
deflate
)
vlistDefVarCompType
(
vlistID
,
varID
,
COMPRESS_ZIP
);
vlistDefVarCompType
(
vlistID
,
varID
,
CDI_
COMPRESS_ZIP
);
if
(
ncvars
[
ncvarid
].
chunked
&&
ncvars
[
ncvarid
].
chunktype
!=
UNDEFID
)
vlistDefVarChunkType
(
vlistID
,
varID
,
ncvars
[
ncvarid
].
chunktype
);
...
...
src/stream_cdf_o.c
View file @
4c0331cb
...
...
@@ -843,7 +843,7 @@ static
void
cdfGridCompress
(
int
fileID
,
int
ncvarid
,
int
gridsize
,
int
filetype
,
int
comptype
)
{
#if defined (HAVE_NETCDF4)
if
(
gridsize
>
1
&&
comptype
==
COMPRESS_ZIP
&&
(
filetype
==
FILETYPE_NC4
||
filetype
==
FILETYPE_NC4C
)
)
if
(
gridsize
>
1
&&
comptype
==
CDI_
COMPRESS_ZIP
&&
(
filetype
==
FILETYPE_NC4
||
filetype
==
FILETYPE_NC4C
)
)
{
nc_def_var_chunking
(
fileID
,
ncvarid
,
NC_CHUNKED
,
NULL
);
cdfDefVarDeflate
(
fileID
,
ncvarid
,
1
);
...
...
src/stream_cgribex.c
View file @
4c0331cb
...
...
@@ -655,10 +655,10 @@ int cgribexScanTimestep1(stream_t * streamptr)
rstatus
=
gribRead
(
fileID
,
(
unsigned
char
*
)
gribbuffer
,
&
readsize
);
if
(
rstatus
)
break
;
comptype
=
COMPRESS_NONE
;
comptype
=
CDI_
COMPRESS_NONE
;
if
(
gribGetZip
(
recsize
,
(
unsigned
char
*
)
gribbuffer
,
&
unzipsize
)
>
0
)
{
comptype
=
COMPRESS_SZIP
;
comptype
=
CDI_
COMPRESS_SZIP
;
unzipsize
+=
100
;
/* need 0 to 1 bytes for rounding of bds */
if
(
buffersize
<
(
size_t
)
unzipsize
)
{
...
...
src/stream_gribapi.c
View file @
4c0331cb
...
...
@@ -705,8 +705,8 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
if
(
grib_get_string
(
gh
,
"packingType"
,
typeOfPacking
,
&
len
)
==
0
)
{
// fprintf(stderr, "packingType %d %s\n", len, typeOfPacking);
if
(
strncmp
(
typeOfPacking
,
"grid_jpeg"
,
len
)
==
0
)
*
outCompressionType
=
COMPRESS_JPEG
;
else
if
(
strncmp
(
typeOfPacking
,
"grid_ccsds"
,
len
)
==
0
)
*
outCompressionType
=
COMPRESS_SZIP
;
if
(
strncmp
(
typeOfPacking
,
"grid_jpeg"
,
len
)
==
0
)
*
outCompressionType
=
CDI_
COMPRESS_JPEG
;
else
if
(
strncmp
(
typeOfPacking
,
"grid_ccsds"
,
len
)
==
0
)
*
outCompressionType
=
CDI_
COMPRESS_SZIP
;
else
if
(
strncmp
(
typeOfPacking
,
"grid_ieee"
,
len
)
==
0
)
lieee
=
true
;
}
}
...
...
@@ -714,12 +714,12 @@ grib_handle *gribapiGetDiskRepresentation(size_t recsize, size_t *buffersize, vo
{
if
(
gribGetZip
((
long
)
recsize
,
*
gribbuffer
,
outUnzipsize
)
>
0
)
{
*
outCompressionType
=
COMPRESS_SZIP
;
*
outCompressionType
=
CDI_
COMPRESS_SZIP
;
ensureBufferSize
((
size_t
)
*
outUnzipsize
+
100
,
buffersize
,
gribbuffer
);
}
else
{
*
outCompressionType
=
COMPRESS_NONE
;
*
outCompressionType
=
CDI_
COMPRESS_NONE
;
}
}
...
...
@@ -1854,13 +1854,13 @@ getGribApiCompTypeMsg(grib_handle *gh, int comptype, int gridsize)
const
char
*
mesg
;
size_t
len
;
if
(
comptype
==
COMPRESS_JPEG
&&
gridsize
>
1
)
if
(
comptype
==
CDI_
COMPRESS_JPEG
&&
gridsize
>
1
)
{
static
const
char
mesg_grid_jpeg
[]
=
"grid_jpeg"
;
len
=
sizeof
(
mesg_grid_jpeg
)
-
1
;
mesg
=
mesg_grid_jpeg
;
}
else
if
(
comptype
==
COMPRESS_SZIP
&&
gridsize
>
1
)
else
if
(
comptype
==
CDI_
COMPRESS_SZIP
&&
gridsize
>
1
)
{
static
const
char
mesg_grid_ccsds
[]
=
"grid_ccsds"
;
len
=
sizeof
(
mesg_grid_ccsds
)
-
1
;
...
...
@@ -2189,7 +2189,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"numberOfDataPoints"
,
gridsize
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"totalNumberOfGridPoints"
,
gridsize
),
0
);
if
(
comptype
==
COMPRESS_SZIP
)
if
(
comptype
==
CDI_
COMPRESS_SZIP
)
{
static
const
char
mesg
[]
=
"grid_ccsds"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
...
...
@@ -2225,7 +2225,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
Warning
(
"Can't write UUID!"
);
}
if
(
comptype
==
COMPRESS_SZIP
)
if
(
comptype
==
CDI_
COMPRESS_SZIP
)
{
static
const
char
mesg
[]
=
"grid_ccsds"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
...
...
src/varscan.c
View file @
4c0331cb
...
...
@@ -122,7 +122,7 @@ paramInitEntry(unsigned varID, int param)
vartable
[
varID
].
tableID
=
UNDEFID
;
vartable
[
varID
].
typeOfGeneratingProcess
=
UNDEFID
;
vartable
[
varID
].
productDefinitionTemplate
=
UNDEFID
;
vartable
[
varID
].
comptype
=
COMPRESS_NONE
;
vartable
[
varID
].
comptype
=
CDI_
COMPRESS_NONE
;
vartable
[
varID
].
complevel
=
1
;
vartable
[
varID
].
lmissval
=
0
;
vartable
[
varID
].
missval
=
0
;
...
...
@@ -1054,7 +1054,7 @@ void varDefMissval(int varID, double missval)
void
varDefCompType
(
int
varID
,
int
comptype
)
{
if
(
vartable
[
varID
].
comptype
==
COMPRESS_NONE
)
if
(
vartable
[
varID
].
comptype
==
CDI_
COMPRESS_NONE
)
vartable
[
varID
].
comptype
=
comptype
;
}
...
...
src/vlist_var.c
View file @
4c0331cb
...
...
@@ -54,7 +54,7 @@ void vlistvarInitEntry(int vlistID, int varID)
vlistptr
->
vars
[
varID
].
units
=
NULL
;
vlistptr
->
vars
[
varID
].
extra
=
NULL
;
vlistptr
->
vars
[
varID
].
levinfo
=
NULL
;
vlistptr
->
vars
[
varID
].
comptype
=
COMPRESS_NONE
;
vlistptr
->
vars
[
varID
].
comptype
=
CDI_
COMPRESS_NONE
;
vlistptr
->
vars
[
varID
].
complevel
=
1
;
vlistptr
->
vars
[
varID
].
atts
.
nalloc
=
MAX_ATTRIBUTES
;
vlistptr
->
vars
[
varID
].
atts
.
nelems
=
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