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
64ecb01b
Commit
64ecb01b
authored
Feb 15, 2011
by
Uwe Schulzweida
Browse files
cdilib update
parent
c4cca286
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cgribexlib.c
View file @
64ecb01b
/* Automatically generated by m214003 at 2011-0
1-2
5, do not edit */
/* Automatically generated by m214003 at 2011-0
2-1
5, do not edit */
/* CGRIBEXLIB_VERSION="1.
4.7
" */
/* CGRIBEXLIB_VERSION="1.
5.0
" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
...
...
@@ -136,7 +136,7 @@ int cdiEncodeTime(int hour, int minute, int second);
extern
FILE
*
grprsm
;
extern
int
GR
B
_Debug
;
extern
int
C
GR
IBEX
_Debug
;
void
gprintf
(
const
char
*
caller
,
const
char
*
fmt
,
...);
...
...
@@ -699,7 +699,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
double
zref
,
zeps
;
int
iexp
,
isign
;
int
iround
;
extern
int
GR
B
_Debug
;
extern
int
C
GR
IBEX
_Debug
;
extern
double
_pow16tab
[
71
];
/* ----------------------------------------------------------------- */
...
...
@@ -860,7 +860,7 @@ void confp3(double pval, int *kexp, int *kmant, int kbits, int kround)
LABEL900:
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
{
Message
(
"Conversion type parameter = %4d"
,
kround
);
Message
(
"Original number = %30.20f"
,
pval
);
...
...
@@ -945,14 +945,14 @@ double decfp2(int kexp, int kmant)
double
pval
;
int
iexp
,
isign
;
extern
int
GR
B
_Debug
;
extern
int
C
GR
IBEX
_Debug
;
extern
double
_pow16tab
[
71
];
/* ----------------------------------------------------------------- */
/* Section 1 . Convert value of 0.0. Ignore sign bit. */
/* ----------------------------------------------------------------- */
if
(
GR
B
_Debug
)
Message
(
"KEXP = %d KMANT = %d"
,
kexp
,
kmant
);
if
(
C
GR
IBEX
_Debug
)
Message
(
"KEXP = %d KMANT = %d"
,
kexp
,
kmant
);
/*
if ( (kexp == 128 || kexp == 0) && kmant == 0 )
*/
...
...
@@ -996,7 +996,7 @@ double decfp2(int kexp, int kmant)
LABEL900:
if
(
GR
B
_Debug
)
Message
(
"Returned value = %f"
,
pval
);
if
(
C
GR
IBEX
_Debug
)
Message
(
"Returned value = %f"
,
pval
);
return
(
pval
);
}
/* decfp2 */
...
...
@@ -1270,33 +1270,33 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
}
}
int
GR
B
_Fix_ZSE
=
0
;
/* 1: Fix ZeroShiftError of simple packed spherical harmonics */
int
GR
B
_Const
=
0
;
/* 1: Don't pack constant fields on regular grids */
int
GR
B
_Debug
=
0
;
/* 1: Debugging */
int
C
GR
IBEX
_Fix_ZSE
=
0
;
/* 1: Fix ZeroShiftError of simple packed spherical harmonics */
int
C
GR
IBEX
_Const
=
0
;
/* 1: Don't pack constant fields on regular grids */
int
C
GR
IBEX
_Debug
=
0
;
/* 1: Debugging */
void
gribSetDebug
(
int
debug
)
{
GR
B
_Debug
=
debug
;
C
GR
IBEX
_Debug
=
debug
;
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"debug level %d"
,
debug
);
}
void
gribFixZSE
(
int
flag
)
{
GR
B
_Fix_ZSE
=
flag
;
C
GR
IBEX
_Fix_ZSE
=
flag
;
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"Fix ZeroShiftError set to %d"
,
flag
);
}
void
gribSetConst
(
int
flag
)
{
GR
B
_Const
=
flag
;
C
GR
IBEX
_Const
=
flag
;
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"Const set to %d"
,
flag
);
}
...
...
@@ -3530,7 +3530,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
/* of floating point numbers - needed */
/* on some platforms (eg vpp700, linux) */
extern
double
_pow2tab
[
158
];
extern
int
GR
B
_Const
;
/* 1: Don't pack constant fields on regular grids */
extern
int
C
GR
IBEX
_Const
;
/* 1: Don't pack constant fields on regular grids */
if
(
isec2
)
{
...
...
@@ -3645,7 +3645,7 @@ int encodeBDS(GRIBPACK *lGrib, long *gribLen, int decscale, int *isec2, int *ise
zref
=
fmin
;
if
(
GR
B
_Const
&&
!
lspherc
)
if
(
C
GR
IBEX
_Const
&&
!
lspherc
)
{
if
(
IS_EQUAL
(
fmin
,
fmax
)
)
nbpv
=
0
;
}
...
...
@@ -4562,7 +4562,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
double
fmin
=
0
.,
zscale
=
0
.;
double
*
fpdata
=
fsec4
;
int
bdsLen
;
extern
int
GR
B
_Fix_ZSE
;
extern
int
C
GR
IBEX
_Fix_ZSE
;
*
iret
=
0
;
igrib
=
bds
;
...
...
@@ -4800,7 +4800,7 @@ int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4,
scaleComplex
(
fsec4
,
pcStart
,
pcScale
,
ISEC2_PentaJ
,
1
);
}
if
(
GR
B
_Fix_ZSE
)
/* Fix ZeroShiftError of simple packed spherical harmonics */
if
(
C
GR
IBEX
_Fix_ZSE
)
/* Fix ZeroShiftError of simple packed spherical harmonics */
if
(
lspherc
&&
!
lcomplex
)
{
/* 20100705: Fix ZeroShiftError - Edi Kirk */
...
...
@@ -5241,7 +5241,7 @@ int gribCheckFiletype(int fileID)
if
(
memcmp
(
buffer
,
"GRIB"
,
4
)
==
0
)
{
found
=
1
;
if
(
GR
B
_Debug
)
Message
(
"found GRIB file = %s"
,
fileInqName
(
fileID
));
if
(
C
GR
IBEX
_Debug
)
Message
(
"found GRIB file = %s"
,
fileInqName
(
fileID
));
}
else
{
...
...
@@ -5252,7 +5252,7 @@ int gribCheckFiletype(int fileID)
if
(
!
ierr
)
{
found
=
1
;
if
(
GR
B
_Debug
)
Message
(
"found seek GRIB file = %s"
,
fileInqName
(
fileID
));
if
(
C
GR
IBEX
_Debug
)
Message
(
"found seek GRIB file = %s"
,
fileInqName
(
fileID
));
}
}
...
...
@@ -5309,7 +5309,7 @@ int gribFileSeekOld(int fileID, long *offset)
buffer
[
i
+
2
]
==
'I'
&&
buffer
[
i
+
3
]
==
'B'
)
{
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
return
(
0
);
}
...
...
@@ -5325,7 +5325,7 @@ int gribFileSeekOld(int fileID, long *offset)
buffer
[
3
]
=
buffer
[
i
+
3
];
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
return
(
1
);
...
...
@@ -5354,7 +5354,7 @@ int gribFileSeek(int fileID, long *offset)
if
(
code
==
GRIB
)
{
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
return
(
0
);
}
...
...
@@ -5362,7 +5362,7 @@ int gribFileSeek(int fileID, long *offset)
(
*
offset
)
++
;
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
return
(
1
);
...
...
@@ -5401,7 +5401,7 @@ int gribFileSeekTest(int fileID, long *offset)
if
(
code
==
GRIB
)
{
/* printf("end: %d %d\n", nread, i); */
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
if
(
i
!=
nread
)
fileSetPos
(
fileID
,
(
off_t
)
i
-
nread
,
SEEK_CUR
);
...
...
@@ -5412,7 +5412,7 @@ int gribFileSeekTest(int fileID, long *offset)
(
*
offset
)
++
;
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"record offset = %d"
,
(
int
)
*
offset
);
return
(
1
);
...
...
@@ -5454,7 +5454,7 @@ int gribReadSize(int fileID)
if
(
gribversion
!=
1
&&
gribversion
!=
2
)
gribversion
=
0
;
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"gribversion = %d"
,
gribversion
);
if
(
gribversion
==
0
)
...
...
@@ -5465,10 +5465,10 @@ int gribReadSize(int fileID)
pdssize
=
gribsize
;
fileSetPos
(
fileID
,
(
off_t
)
3
,
SEEK_CUR
);
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"pdssize = %d"
,
pdssize
);
flag
=
filePtrGetc
(
fileptr
);
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"flag = %d"
,
flag
);
fileSetPos
(
fileID
,
(
off_t
)
pdssize
-
8
,
SEEK_CUR
);
...
...
@@ -5481,7 +5481,7 @@ int gribReadSize(int fileID)
gdssize
=
(
b1
<<
16
)
+
(
b2
<<
8
)
+
b3
;
fileSetPos
(
fileID
,
(
off_t
)
gdssize
-
3
,
SEEK_CUR
);
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"gdssize = %d"
,
gdssize
);
if
(
flag
&
64
)
...
...
@@ -5492,7 +5492,7 @@ int gribReadSize(int fileID)
bmssize
=
(
b1
<<
16
)
+
(
b2
<<
8
)
+
b3
;
fileSetPos
(
fileID
,
(
off_t
)
bmssize
-
3
,
SEEK_CUR
);
}
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"bmssize = %d"
,
bmssize
);
b1
=
filePtrGetc
(
fileptr
);
...
...
@@ -5500,7 +5500,7 @@ int gribReadSize(int fileID)
b3
=
filePtrGetc
(
fileptr
);
bdssize
=
(
b1
<<
16
)
+
(
b2
<<
8
)
+
b3
;
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"bdssize = %d"
,
bdssize
);
gribsize
=
issize
+
pdssize
+
gdssize
+
bmssize
+
bdssize
+
essize
;
...
...
@@ -5523,7 +5523,7 @@ int gribReadSize(int fileID)
if
(
filePtrEOF
(
fileptr
)
)
gribsize
=
0
;
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
Message
(
"gribsize = %d"
,
gribsize
);
fileSetPos
(
fileID
,
pos
,
SEEK_SET
);
...
...
@@ -5552,7 +5552,7 @@ int gribGetSize(int fileID)
recsize
=
gribReadSize
(
fileID
);
if
(
GR
B
_Debug
)
Message
(
"recsize = %d"
,
recsize
);
if
(
C
GR
IBEX
_Debug
)
Message
(
"recsize = %d"
,
recsize
);
fileSetPos
(
fileID
,
(
off_t
)
-
4
,
SEEK_CUR
);
...
...
@@ -6815,9 +6815,10 @@ C ----------------------------------------------------------------
C* Section 0 . Definition of variables.
C ----------------------------------------------------------------
*/
char
*
hndbg
,
*
hnvck
,
*
envString
;
char
*
envString
;
char
*
env_stream
;
static
int
lfirst
=
TRUE
;
extern
int
CGRIBEX_Const
;
if
(
!
lfirst
)
return
;
...
...
@@ -6877,27 +6878,36 @@ C ----------------------------------------------------------------
*/
ndbg
=
0
;
hndb
g
=
getenv
(
"GRIBEX_DEBUG"
);
if
(
hndb
g
!=
NULL
)
envStrin
g
=
getenv
(
"GRIBEX_DEBUG"
);
if
(
envStrin
g
!=
NULL
)
{
if
(
!
strncmp
(
hndb
g
,
"ON"
,
2
)
)
if
(
!
strncmp
(
envStrin
g
,
"ON"
,
2
)
)
ndbg
=
1
;
else
if
(
*
hndb
g
==
'1'
)
else
if
(
*
envStrin
g
==
'1'
)
ndbg
=
1
;
else
if
(
*
hndb
g
==
'2'
)
else
if
(
*
envStrin
g
==
'2'
)
ndbg
=
2
;
else
ndbg
=
0
;
}
/*
Set GRIBEX compatibility mode.
*/
envString
=
getenv
(
"GRIB_GRIBEX_MODE_ON"
);
if
(
envString
!=
NULL
)
{
if
(
atoi
(
envString
)
==
1
)
CGRIBEX_Const
=
0
;
}
/*
Set GRIB value checking on.
*/
nvck
=
1
;
h
nv
ck
=
getenv
(
"GRIBEX_CHECK"
);
if
(
h
nv
ck
)
e
nv
String
=
getenv
(
"GRIBEX_CHECK"
);
if
(
e
nv
String
)
{
if
(
!
strncmp
(
h
nv
ck
,
"OFF"
,
3
)
)
if
(
!
strncmp
(
e
nv
String
,
"OFF"
,
3
)
)
nvck
=
0
;
else
nvck
=
1
;
...
...
@@ -7512,7 +7522,7 @@ void ref2ibm(double *pref, int kbits)
static
int
itrnd
;
static
int
kexp
,
kmant
;
static
double
ztemp
,
zdumm
;
extern
int
GR
B
_Debug
;
extern
int
C
GR
IBEX
_Debug
;
/* ----------------------------------------------------------------- */
/* Section 1. Convert to and from IBM format. */
...
...
@@ -7551,7 +7561,7 @@ void ref2ibm(double *pref, int kbits)
if
(
ztemp
<
*
pref
)
{
if
(
GR
B
_Debug
)
if
(
C
GR
IBEX
_Debug
)
{
Message
(
"Reference value error."
);
Message
(
"Notify Met.Applications Section."
);
...
...
@@ -9069,7 +9079,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return
(
gribLen
);
}
static
const
char
grb_libvers
[]
=
"1.
4.7
"
" of ""
Jan 2
5 2011"" ""1
2:07:17
"
;
static
const
char
grb_libvers
[]
=
"1.
5.0
"
" of ""
Feb 1
5 2011"" ""1
0:23:39
"
;
const
char
*
cgribexLibraryVersion
(
void
)
{
...
...
src/stream_int.c
View file @
64ecb01b
...
...
@@ -113,8 +113,8 @@ void cdiInitialize(void)
Init_CDI
=
TRUE
;
#if defined (HAVE_LIBCGRIBEX)
gribFixZSE
(
1
);
/
*
1: Fix ZeroShiftError of simple packed spherical harmonics
*/
gribSetConst
(
1
);
/
*
1: Don't pack constant fields on regular grids
*/
gribFixZSE
(
1
);
/
/
1: Fix ZeroShiftError of simple packed spherical harmonics
gribSetConst
(
1
);
/
/
1: Don't pack constant fields on regular grids
#endif
value
=
cdiGetenvInt
(
"CD_REGULARGRID"
);
...
...
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