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
cab418f4
Commit
cab418f4
authored
Jun 01, 2011
by
Uwe Schulzweida
Browse files
CDI: changed compression type from Ztype to CompType
parent
ec22c66a
Changes
18
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
cab418f4
2011-06-01 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* CDI: changed compression type from Ztype to CompType
2011-05-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* gridGenYvals: changed delta eps to 0.002 for gaussian grids [report: John Lillibridge]
...
...
app/cdi.c
View file @
cab418f4
...
...
@@ -35,9 +35,7 @@ int vlistInqVarMissvalUsed(int vlistID, int varID);
#include
"printinfo.h"
void
cdiDecodeDate
(
int
date
,
int
*
year
,
int
*
month
,
int
*
day
);
void
cdiDecodeTime
(
int
time
,
int
*
hour
,
int
*
minute
,
int
*
second
);
void
cdiDefTableID
(
int
tableID
);
int
getopt
(
int
argc
,
char
*
const
argv
[],
const
char
*
optstring
);
...
...
@@ -51,7 +49,7 @@ int DefaultFileType = CDI_UNDEFID;
int
DefaultDataType
=
CDI_UNDEFID
;
int
DefaultByteorder
=
CDI_UNDEFID
;
int
Z
type
=
COMPRESS_NONE
;
int
comp
type
=
COMPRESS_NONE
;
int
Zlevel
=
0
;
...
...
@@ -308,7 +306,7 @@ void printShortinfo(int streamID, int vlistID, int vardis)
fprintf
(
stdout
,
" %-3s"
,
pstr
);
if
(
vlistInqVar
Zt
ype
(
vlistID
,
varID
)
==
COMPRESS_NONE
)
if
(
vlistInqVar
CompT
ype
(
vlistID
,
varID
)
==
COMPRESS_NONE
)
fprintf
(
stdout
,
" "
);
else
fprintf
(
stdout
,
"z"
);
...
...
@@ -644,20 +642,20 @@ void defineCompress(const char *arg)
if
(
strncmp
(
arg
,
"szip"
,
len
)
==
0
)
{
Z
type
=
COMPRESS_SZIP
;
comp
type
=
COMPRESS_SZIP
;
}
else
if
(
strncmp
(
arg
,
"jpeg"
,
len
)
==
0
)
{
Z
type
=
COMPRESS_JPEG
;
comp
type
=
COMPRESS_JPEG
;
}
else
if
(
strncmp
(
arg
,
"gzip"
,
len
)
==
0
)
{
Z
type
=
COMPRESS_GZIP
;
comp
type
=
COMPRESS_GZIP
;
Zlevel
=
6
;
}
else
if
(
strncmp
(
arg
,
"zip"
,
len
)
==
0
)
{
Z
type
=
COMPRESS_ZIP
;
comp
type
=
COMPRESS_ZIP
;
Zlevel
=
1
;
}
else
...
...
@@ -844,9 +842,9 @@ int main(int argc, char *argv[])
if
(
DefaultByteorder
!=
CDI_UNDEFID
)
streamDefByteorder
(
streamID2
,
DefaultByteorder
);
if
(
Z
type
!=
COMPRESS_NONE
)
if
(
comp
type
!=
COMPRESS_NONE
)
{
streamDef
Zt
ype
(
streamID2
,
Z
type
);
streamDef
CompT
ype
(
streamID2
,
comp
type
);
streamDefZlevel
(
streamID2
,
Zlevel
);
}
...
...
app/printinfo.h
View file @
cab418f4
...
...
@@ -84,18 +84,18 @@ void printFiletype(int streamID, int vlistID)
if
(
filetype
==
FILETYPE_GRB
||
filetype
==
FILETYPE_NC4
||
filetype
==
FILETYPE_NC4C
)
{
int
nvars
,
varID
;
int
z
type
;
int
comp
type
;
nvars
=
vlistNvars
(
vlistID
);
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
z
type
=
vlistInqVar
Zt
ype
(
vlistID
,
varID
);
if
(
z
type
)
comp
type
=
vlistInqVar
CompT
ype
(
vlistID
,
varID
);
if
(
comp
type
)
{
if
(
z
type
==
COMPRESS_SZIP
)
if
(
comp
type
==
COMPRESS_SZIP
)
printf
(
" SZIP"
);
else
if
(
z
type
==
COMPRESS_ZIP
)
else
if
(
comp
type
==
COMPRESS_ZIP
)
printf
(
" ZIP"
);
break
;
...
...
@@ -106,16 +106,16 @@ void printFiletype(int streamID, int vlistID)
if
(
filetype
==
FILETYPE_GRB2
)
{
int
nvars
,
varID
;
int
z
type
;
int
comp
type
;
nvars
=
vlistNvars
(
vlistID
);
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
z
type
=
vlistInqVar
Zt
ype
(
vlistID
,
varID
);
if
(
z
type
)
comp
type
=
vlistInqVar
CompT
ype
(
vlistID
,
varID
);
if
(
comp
type
)
{
if
(
z
type
==
COMPRESS_JPEG
)
if
(
comp
type
==
COMPRESS_JPEG
)
printf
(
" JPEG"
);
break
;
...
...
doc/tex/c_quick_ref.tex
View file @
cab418f4
...
...
@@ -355,6 +355,15 @@ Close an open dataset.
Define the byteorder.
\section*
{
\tt
\htmlref
{
streamDefCompType
}{
streamDefCompType
}}
\begin{verbatim}
void streamDefCompType (intstreamID, intcomptype);
\end{verbatim}
Define compression type.
\section*
{
\tt
\htmlref
{
streamDefTimestep
}{
streamDefTimestep
}}
\begin{verbatim}
...
...
@@ -382,22 +391,22 @@ Define the Vlist for a stream.
Define compression level.
\section*
{
\tt
\htmlref
{
stream
DefZtype
}{
streamDefZtype
}}
\section*
{
\tt
\htmlref
{
stream
InqByteorder
}{
streamInqByteorder
}}
\begin{verbatim}
void
stream
DefZtype
(intstreamID
, intztype
);
int
stream
InqByteorder
(intstreamID);
\end{verbatim}
Define compression type
.
Get the byteorder
.
\section*
{
\tt
\htmlref
{
streamInq
Byteorder
}{
streamInq
Byteorder
}}
\section*
{
\tt
\htmlref
{
streamInq
CompType
}{
streamInq
CompType
}}
\begin{verbatim}
int streamInq
Byteorder
(intstreamID);
int streamInq
CompType
(intstreamID);
\end{verbatim}
Get
the byteorder
.
Get
compression type
.
\section*
{
\tt
\htmlref
{
streamInqFiletype
}{
streamInqFiletype
}}
...
...
@@ -436,15 +445,6 @@ Get the Vlist of a stream.
Get compression level.
\section*
{
\tt
\htmlref
{
streamInqZtype
}{
streamInqZtype
}}
\begin{verbatim}
int streamInqZtype (intstreamID);
\end{verbatim}
Get compression type.
\section*
{
\tt
\htmlref
{
streamOpenRead
}{
streamOpenRead
}}
\begin{verbatim}
...
...
doc/tex/f_quick_ref.tex
View file @
cab418f4
...
...
@@ -355,6 +355,15 @@ Close an open dataset.
Define the byteorder.
\section*
{
\tt
\htmlref
{
streamDefCompType
}{
streamDefCompType
}}
\begin{verbatim}
SUBROUTINE streamDefCompType (INTEGER streamID, INTEGER comptype)
\end{verbatim}
Define compression type.
\section*
{
\tt
\htmlref
{
streamDefTimestep
}{
streamDefTimestep
}}
\begin{verbatim}
...
...
@@ -382,22 +391,22 @@ Define the Vlist for a stream.
Define compression level.
\section*
{
\tt
\htmlref
{
stream
DefZtype
}{
streamDefZtype
}}
\section*
{
\tt
\htmlref
{
stream
InqByteorder
}{
streamInqByteorder
}}
\begin{verbatim}
SUBROUTINE streamDefZtype
(INTEGER streamID
, INTEGER ztype
)
INTEGER FUNCTION streamInqByteorder
(INTEGER streamID)
\end{verbatim}
Define compression type
.
Get the byteorder
.
\section*
{
\tt
\htmlref
{
streamInq
Byteorder
}{
streamInq
Byteorder
}}
\section*
{
\tt
\htmlref
{
streamInq
CompType
}{
streamInq
CompType
}}
\begin{verbatim}
INTEGER FUNCTION streamInq
Byteorder
(INTEGER streamID)
INTEGER FUNCTION streamInq
CompType
(INTEGER streamID)
\end{verbatim}
Get
the byteorder
.
Get
compression type
.
\section*
{
\tt
\htmlref
{
streamInqFiletype
}{
streamInqFiletype
}}
...
...
@@ -436,15 +445,6 @@ Get the Vlist of a stream.
Get compression level.
\section*
{
\tt
\htmlref
{
streamInqZtype
}{
streamInqZtype
}}
\begin{verbatim}
INTEGER FUNCTION streamInqZtype (INTEGER streamID)
\end{verbatim}
Get compression type.
\section*
{
\tt
\htmlref
{
streamOpenRead
}{
streamOpenRead
}}
\begin{verbatim}
...
...
src/cdi.h
View file @
cab418f4
...
...
@@ -256,14 +256,14 @@ void streamDefByteorder(int streamID, int byteorder);
/* streamInqByteorder: Get the byteorder */
int
streamInqByteorder
(
int
streamID
);
/* streamDef
Zt
ype: Define compression type */
void
streamDef
Zt
ype
(
int
streamID
,
int
z
type
);
/* streamDef
CompT
ype: Define compression type */
void
streamDef
CompT
ype
(
int
streamID
,
int
comp
type
);
/* streamDefZlevel: Define compression level */
void
streamDefZlevel
(
int
streamID
,
int
zlevel
);
/* streamInq
Zt
ype: Get compression type */
int
streamInq
Zt
ype
(
int
streamID
);
/* streamInq
CompT
ype: Get compression type */
int
streamInq
CompT
ype
(
int
streamID
);
/* streamInqZlevel: Get compression level */
int
streamInqZlevel
(
int
streamID
);
...
...
@@ -384,8 +384,8 @@ int vlistInqVarGrid(int vlistID, int varID);
int
vlistInqVarZaxis
(
int
vlistID
,
int
varID
);
int
vlistInqVarTime
(
int
vlistID
,
int
varID
);
void
vlistDefVar
Zt
ype
(
int
vlistID
,
int
varID
,
int
z
type
);
int
vlistInqVar
Zt
ype
(
int
vlistID
,
int
varID
);
void
vlistDefVar
CompT
ype
(
int
vlistID
,
int
varID
,
int
comp
type
);
int
vlistInqVar
CompT
ype
(
int
vlistID
,
int
varID
);
void
vlistDefVarZlevel
(
int
vlistID
,
int
varID
,
int
zlevel
);
int
vlistInqVarZlevel
(
int
vlistID
,
int
varID
);
...
...
src/cdi.inc
View file @
cab418f4
...
...
@@ -4,7 +4,7 @@
!
!
Author
:
!
-------
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
May
2011
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
June
2011
!
INTEGER
CDI_MAX_NAME
...
...
@@ -214,6 +214,8 @@
PARAMETER
(
GRID_SINUSOIDAL
=
14
)
INTEGER
GRID_REFERENCE
PARAMETER
(
GRID_REFERENCE
=
15
)
INTEGER
GRID_PROJECTION
PARAMETER
(
GRID_PROJECTION
=
16
)
!
!
ZAXIS
types
!
...
...
@@ -442,19 +444,19 @@
!
(
INTEGER
streamID
)
EXTERNAL
streamInqByteorder
!
streamDef
Zt
ype
!
streamDef
CompT
ype
!
(
INTEGER
streamID
,
!
INTEGER
z
type
)
EXTERNAL
streamDef
Zt
ype
!
INTEGER
comp
type
)
EXTERNAL
streamDef
CompT
ype
!
streamDefZlevel
!
(
INTEGER
streamID
,
!
INTEGER
zlevel
)
EXTERNAL
streamDefZlevel
INTEGER
streamInq
Zt
ype
INTEGER
streamInq
CompT
ype
!
(
INTEGER
streamID
)
EXTERNAL
streamInq
Zt
ype
EXTERNAL
streamInq
CompT
ype
INTEGER
streamInqZlevel
!
(
INTEGER
streamID
)
...
...
@@ -747,16 +749,16 @@
!
INTEGER
varID
)
EXTERNAL
vlistInqVarTime
!
vlistDefVar
Zt
ype
!
vlistDefVar
CompT
ype
!
(
INTEGER
vlistID
,
!
INTEGER
varID
,
!
INTEGER
z
type
)
EXTERNAL
vlistDefVar
Zt
ype
!
INTEGER
comp
type
)
EXTERNAL
vlistDefVar
CompT
ype
INTEGER
vlistInqVar
Zt
ype
INTEGER
vlistInqVar
CompT
ype
!
(
INTEGER
vlistID
,
!
INTEGER
varID
)
EXTERNAL
vlistInqVar
Zt
ype
EXTERNAL
vlistInqVar
CompT
ype
!
vlistDefVarZlevel
!
(
INTEGER
vlistID
,
...
...
src/cdiFortran.c
View file @
cab418f4
...
...
@@ -89,9 +89,9 @@ FCALLSCFUN1 (INT, streamInqVlist, STREAMINQVLIST, streaminqvlist, INT)
FCALLSCFUN1
(
INT
,
streamInqFiletype
,
STREAMINQFILETYPE
,
streaminqfiletype
,
INT
)
FCALLSCSUB2
(
streamDefByteorder
,
STREAMDEFBYTEORDER
,
streamdefbyteorder
,
INT
,
INT
)
FCALLSCFUN1
(
INT
,
streamInqByteorder
,
STREAMINQBYTEORDER
,
streaminqbyteorder
,
INT
)
FCALLSCSUB2
(
streamDef
Zt
ype
,
STREAMDEF
Z
TYPE
,
streamdef
z
type
,
INT
,
INT
)
FCALLSCSUB2
(
streamDef
CompT
ype
,
STREAMDEF
COMP
TYPE
,
streamdef
comp
type
,
INT
,
INT
)
FCALLSCSUB2
(
streamDefZlevel
,
STREAMDEFZLEVEL
,
streamdefzlevel
,
INT
,
INT
)
FCALLSCFUN1
(
INT
,
streamInq
Zt
ype
,
STREAMINQ
Z
TYPE
,
streaminq
z
type
,
INT
)
FCALLSCFUN1
(
INT
,
streamInq
CompT
ype
,
STREAMINQ
COMP
TYPE
,
streaminq
comp
type
,
INT
)
FCALLSCFUN1
(
INT
,
streamInqZlevel
,
STREAMINQZLEVEL
,
streaminqzlevel
,
INT
)
FCALLSCFUN2
(
INT
,
streamDefTimestep
,
STREAMDEFTIMESTEP
,
streamdeftimestep
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
streamInqTimestep
,
STREAMINQTIMESTEP
,
streaminqtimestep
,
INT
,
INT
)
...
...
@@ -159,8 +159,8 @@ FCALLSCSUB5 (vlistInqVar, VLISTINQVAR, vlistinqvar, INT, INT, PINT, PINT, PINT)
FCALLSCFUN2
(
INT
,
vlistInqVarGrid
,
VLISTINQVARGRID
,
vlistinqvargrid
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
vlistInqVarZaxis
,
VLISTINQVARZAXIS
,
vlistinqvarzaxis
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
vlistInqVarTime
,
VLISTINQVARTIME
,
vlistinqvartime
,
INT
,
INT
)
FCALLSCSUB3
(
vlistDefVar
Zt
ype
,
VLISTDEFVAR
Z
TYPE
,
vlistdefvar
z
type
,
INT
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
vlistInqVar
Zt
ype
,
VLISTINQVAR
Z
TYPE
,
vlistinqvar
z
type
,
INT
,
INT
)
FCALLSCSUB3
(
vlistDefVar
CompT
ype
,
VLISTDEFVAR
COMP
TYPE
,
vlistdefvar
comp
type
,
INT
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
vlistInqVar
CompT
ype
,
VLISTINQVAR
COMP
TYPE
,
vlistinqvar
comp
type
,
INT
,
INT
)
FCALLSCSUB3
(
vlistDefVarZlevel
,
VLISTDEFVARZLEVEL
,
vlistdefvarzlevel
,
INT
,
INT
,
INT
)
FCALLSCFUN2
(
INT
,
vlistInqVarZlevel
,
VLISTINQVARZLEVEL
,
vlistinqvarzlevel
,
INT
,
INT
)
FCALLSCSUB3
(
vlistDefVarParam
,
VLISTDEFVARPARAM
,
vlistdefvarparam
,
INT
,
INT
,
INT
)
...
...
src/stream.c
View file @
cab418f4
...
...
@@ -2052,7 +2052,7 @@ int streamInqVlist(int streamID)
}
void
streamDef
Zt
ype
(
int
streamID
,
int
z
type
)
void
streamDef
CompT
ype
(
int
streamID
,
int
comp
type
)
{
stream_t
*
streamptr
;
...
...
@@ -2060,7 +2060,7 @@ void streamDefZtype(int streamID, int ztype)
stream_check_ptr
(
__func__
,
streamptr
);
streamptr
->
z
type
=
z
type
;
streamptr
->
comp
type
=
comp
type
;
}
...
...
@@ -2076,7 +2076,7 @@ void streamDefZlevel(int streamID, int zlevel)
}
int
streamInq
Zt
ype
(
int
streamID
)
int
streamInq
CompT
ype
(
int
streamID
)
{
stream_t
*
streamptr
;
...
...
@@ -2084,7 +2084,7 @@ int streamInqZtype(int streamID)
stream_check_ptr
(
__func__
,
streamptr
);
return
(
streamptr
->
z
type
);
return
(
streamptr
->
comp
type
);
}
...
...
src/stream_cdf.c
View file @
cab418f4
...
...
@@ -2754,7 +2754,7 @@ int cdfDefVar(int streamID, int varID)
}
#endif
if
(
streamptr
->
z
type
==
COMPRESS_ZIP
)
if
(
streamptr
->
comp
type
==
COMPRESS_ZIP
)
{
if
(
lchunk
&&
(
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
)
{
...
...
@@ -2772,7 +2772,7 @@ int cdfDefVar(int streamID, int varID)
}
}
if
(
streamptr
->
z
type
==
COMPRESS_SZIP
)
if
(
streamptr
->
comp
type
==
COMPRESS_SZIP
)
{
if
(
lchunk
&&
(
streamptr
->
filetype
==
FILETYPE_NC4
||
streamptr
->
filetype
==
FILETYPE_NC4C
)
)
{
...
...
@@ -6109,7 +6109,7 @@ int cdfInqContents(int streamID)
#if defined (HAVE_NETCDF4)
if
(
ncvars
[
ncvarid
].
deflate
)
vlistDefVar
Zt
ype
(
vlistID
,
varID
,
COMPRESS_ZIP
);
vlistDefVar
CompT
ype
(
vlistID
,
varID
,
COMPRESS_ZIP
);
#endif
streamptr
->
vars
[
varID1
].
level
=
NULL
;
...
...
src/stream_cgribex.c
View file @
cab418f4
...
...
@@ -348,7 +348,7 @@ void cgribexGetGrid(stream_t *streamptr, int *isec2, int *isec4, grid_t *grid)
#if defined (HAVE_LIBCGRIBEX)
static
void
cgribexAddRecord
(
int
streamID
,
int
param
,
int
*
isec1
,
int
*
isec2
,
double
*
fsec2
,
double
*
fsec3
,
int
*
isec4
,
long
recsize
,
off_t
position
,
int
prec
,
int
z
type
,
int
lmv
)
int
*
isec4
,
long
recsize
,
off_t
position
,
int
prec
,
int
comp
type
,
int
lmv
)
{
int
zaxistype
;
int
gridID
=
CDI_UNDEFID
,
varID
;
...
...
@@ -410,7 +410,7 @@ void cgribexAddRecord(int streamID, int param, int *isec1, int *isec2, double *f
(
*
record
).
varID
=
varID
;
(
*
record
).
levelID
=
levelID
;
varDef
Zt
ype
(
varID
,
z
type
);
varDef
CompT
ype
(
varID
,
comp
type
);
if
(
lmv
)
varDefMissval
(
varID
,
FSEC3_MissVal
);
...
...
@@ -531,7 +531,7 @@ int cgribexScanTimestep1(int streamID)
int
rdate
=
0
,
rtime
=
0
,
tunit
=
0
,
fcast
=
0
;
taxis_t
*
taxis
;
int
vlistID
;
int
z
type
;
int
comp
type
;
long
unzipsize
;
compvar_t
compVar
,
compVar0
;
stream_t
*
streamptr
;
...
...
@@ -592,10 +592,10 @@ int cgribexScanTimestep1(int streamID)
rstatus
=
gribRead
(
fileID
,
gribbuffer
,
&
readsize
);
if
(
rstatus
)
break
;
z
type
=
COMPRESS_NONE
;
comp
type
=
COMPRESS_NONE
;
if
(
gribGetZip
(
recsize
,
gribbuffer
,
&
unzipsize
)
>
0
)
{
z
type
=
COMPRESS_SZIP
;
comp
type
=
COMPRESS_SZIP
;
unzipsize
+=
100
;
/* need 0 to 1 bytes for rounding of bds */
if
(
(
long
)
buffersize
<
unzipsize
)
{
...
...
@@ -693,7 +693,7 @@ int cgribexScanTimestep1(int streamID)
Message
(
"%4d %8d %4d %8d %8d %6d"
,
nrecs
,
(
int
)
recpos
,
param
,
level1
,
vdate
,
vtime
);
cgribexAddRecord
(
streamID
,
param
,
isec1
,
isec2
,
fsec2
,
fsec3
,
isec4
,
recsize
,
recpos
,
prec
,
z
type
,
lmv
);
isec4
,
recsize
,
recpos
,
prec
,
comp
type
,
lmv
);
}
streamptr
->
rtsteps
=
1
;
...
...
src/stream_grb.c
View file @
cab418f4
...
...
@@ -549,7 +549,7 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
gc
=
(
void
*
)
&
gribContainers
[
varID
];
}
if
(
streamptr
->
z
type
==
COMPRESS_JPEG
)
if
(
streamptr
->
comp
type
==
COMPRESS_JPEG
)
{
if
(
filetype
==
FILETYPE_GRB2
)
{
...
...
@@ -565,7 +565,7 @@ int grbWriteVarSliceDP(int streamID, int varID, int levelID, const double *data,
nbytes
=
grbEncode
(
filetype
,
varID
,
levelID
,
vlistID
,
gridID
,
zaxisID
,
date
,
time
,
tsteptype
,
numavg
,
datasize
,
data
,
nmiss
,
gribbuffer
,
gribbuffersize
,
ljpeg
,
gc
);
if
(
streamptr
->
z
type
==
COMPRESS_SZIP
)
if
(
streamptr
->
comp
type
==
COMPRESS_SZIP
)
nbytes
=
grbSzip
(
filetype
,
gribbuffer
,
nbytes
);
nwrite
=
fileWrite
(
fileID
,
gribbuffer
,
nbytes
);
...
...
@@ -641,7 +641,7 @@ int grbCopyRecord(int streamID2, int streamID1)
izip
=
gribGetZip
(
recsize
,
gribbuffer
,
&
unzipsize
);
if
(
izip
==
0
)
if
(
streamptr2
->
z
type
==
COMPRESS_SZIP
)
if
(
streamptr2
->
comp
type
==
COMPRESS_SZIP
)
nbytes
=
grbSzip
(
filetype
,
gribbuffer
,
nbytes
);
while
(
nbytes
&
7
)
gribbuffer
[
nbytes
++
]
=
0
;
...
...
src/stream_gribapi.c
View file @
cab418f4
...
...
@@ -536,7 +536,7 @@ double grib2GetLevel(grib_handle *gh, int leveltype)
static
void
gribapiAddRecord
(
int
streamID
,
int
param
,
grib_handle
*
gh
,
long
recsize
,
off_t
position
,
int
prec
,
int
z
type
)
long
recsize
,
off_t
position
,
int
prec
,
int
comp
type
)
{
long
editionNumber
;
int
zaxistype
;
...
...
@@ -670,7 +670,7 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
(
*
record
).
varID
=
varID
;
(
*
record
).
levelID
=
levelID
;
varDef
Zt
ype
(
varID
,
z
type
);
varDef
CompT
ype
(
varID
,
comp
type
);
if
(
varInqInst
(
varID
)
==
CDI_UNDEFID
)
{
...
...
@@ -753,7 +753,7 @@ int gribapiScanTimestep1(int streamID)
int
rdate
=
0
,
rtime
=
0
,
tunit
=
0
,
fcast
=
0
;
taxis_t
*
taxis
;
int
vlistID
;
int
z
type
;
int
comp
type
;
long
unzipsize
;
compvar2_t
compVar
,
compVar0
;
stream_t
*
streamptr
;
...
...
@@ -800,10 +800,10 @@ int gribapiScanTimestep1(int streamID)
rstatus
=
gribRead
(
fileID
,
gribbuffer
,
&
readsize
);
if
(
rstatus
)
break
;
z
type
=
COMPRESS_NONE
;
comp
type
=
COMPRESS_NONE
;
if
(
gribGetZip
(
recsize
,
gribbuffer
,
&
unzipsize
)
>
0
)
{
z
type
=
COMPRESS_SZIP
;
comp
type
=
COMPRESS_SZIP
;
unzipsize
+=
100
;
if
(
(
long
)
buffersize
<
unzipsize
)
{
...
...
@@ -848,7 +848,7 @@ int gribapiScanTimestep1(int streamID)
if
(
status
==
0
)
{
// fprintf(stderr, "packingType %d %s\n", len, typeOfPacking);
if
(
strncmp
(
typeOfPacking
,
"grid_jpeg"
,
len
)
==
0
)
z
type
=
COMPRESS_JPEG
;
if
(
strncmp
(
typeOfPacking
,
"grid_jpeg"
,
len
)
==
0
)
comp
type
=
COMPRESS_JPEG
;
}
GRIB_CHECK
(
grib_get_long
(
gh
,
"discipline"
,
&
lpar
),
0
);
...
...
@@ -971,7 +971,7 @@ int gribapiScanTimestep1(int streamID)
if
(
CDI_Debug
)
Message
(
"%4d %8d %4d %8d %8d %6d"
,
nrecs
,
(
int
)
recpos
,
param
,
level1
,
vdate
,
vtime
);
gribapiAddRecord
(
streamID
,
param
,
gh
,
recsize
,
recpos
,
prec
,
z
type
);
gribapiAddRecord
(
streamID
,
param
,
gh
,
recsize
,
recpos
,
prec
,
comp
type
);
grib_handle_delete
(
gh
);
gh
=
NULL
;
...
...
src/stream_int.c
View file @
cab418f4
...
...
@@ -409,7 +409,7 @@ void stream_init_entry(stream_t *streamptr)
streamptr
->
unreduced
=
cdiDataUnreduced
;
streamptr
->
sortname
=
cdiSortName
;
streamptr
->
have_missval
=
cdiHaveMissval
;
streamptr
->
z
type
=
COMPRESS_NONE
;
streamptr
->
comp
type
=
COMPRESS_NONE
;
streamptr
->
zlevel
=
0
;
basetimeInit
(
&
streamptr
->
basetime
);
...
...
src/stream_int.h
View file @
cab418f4
...
...
@@ -238,7 +238,7 @@ typedef struct {
int
unreduced
;
int
sortname
;
int
have_missval
;
int
z
type
;
int
comp
type
;
/* compression type */
int
zlevel
;
int
curfile
;
int
nfiles
;
...
...
src/varscan.c
View file @
cab418f4
...
...
@@ -44,7 +44,7 @@ typedef struct
int
instID
;
int
modelID
;
int
tableID
;
int
z
type
;
int
comp
type
;
// compression type
int
zlevel
;
int
lmissval
;
double
missval
;
...
...
@@ -78,7 +78,7 @@ void paramInitEntry(int varID, int param)
vartable
[
varID
].
instID
=
UNDEFID
;
vartable
[
varID
].
modelID
=
UNDEFID
;
vartable
[
varID
].
tableID
=
UNDEFID
;
vartable
[
varID
].
z
type
=
COMPRESS_NONE
;
vartable
[
varID
].
comp
type
=
COMPRESS_NONE
;
vartable
[
varID
].
zlevel
=
1
;
vartable
[
varID
].
lmissval
=
0
;
vartable
[
varID
].
missval
=
0
;
...
...
@@ -387,7 +387,7 @@ void cdiGenVars(int streamID)
int
tsteptype
;
int
timave
,
timaccu
;
int
lbounds
;
int
z
type
;
int
comp
type
;
char
name
[
256
],
longname
[
256
],
units
[
256
];
double
*
dlevels
=
NULL
;
double
*
dlevels1
=
NULL
;
...
...
@@ -448,7 +448,7 @@ void cdiGenVars(int streamID)
tsteptype
=
vartable
[
varid
].
tsteptype
;
timave
=
vartable
[
varid
].
timave
;
timaccu
=
vartable
[
varid
].
timaccu
;
z
type
=
vartable
[
varid
].
z
type
;
comp
type
=
vartable
[
varid
].
comp
type
;
zaxisID
=
UNDEFID
;
...
...
@@ -529,7 +529,7 @@ void cdiGenVars(int streamID)
vlistDefVarTsteptype
(
vlistID
,
varID
,
tsteptype
);
vlistDefVarTimave
(
vlistID
,
varID
,
timave
);
vlistDefVarTimaccu
(
vlistID
,
varID
,
timaccu
);
vlistDefVar
Zt
ype
(
vlistID
,
varID
,
z
type
);
vlistDefVar
CompT
ype
(
vlistID
,
varID
,
comp
type
);
if
(
vartable
[
varid
].
lmissval
)
vlistDefVarMissval
(
vlistID
,
varID
,
vartable
[
varid
].
missval
);
...
...
@@ -827,10 +827,10 @@ void varDefMissval(int varID, double missval)
}
void
varDef
Zt
ype
(
int
varID
,
int
z
type
)
void
varDef
CompT
ype
(
int
varID
,
int
comp
type
)
{
if
(
vartable
[
varID
].
z
type
==
COMPRESS_NONE
)
vartable
[
varID
].
z
type
=
z
type
;
if
(
vartable
[
varID
].
comp
type
==
COMPRESS_NONE
)
vartable
[
varID
].
comp
type
=
comp
type
;
}