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
dfd5eddf
Commit
dfd5eddf
authored
Jan 22, 2018
by
Uwe Schulzweida
Browse files
cgribexlib update.
parent
8edf81f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cgribex.h
View file @
dfd5eddf
#ifndef CGRIBEX_H
#define CGRIBEX_H
#ifndef
CGRIBEX_H
#define
CGRIBEX_H
#include
<stdio.h>
#include
<stdbool.h>
...
...
@@ -251,7 +251,7 @@ double calculate_pfactor_float(const float* spectralField, long fieldTruncation,
double
calculate_pfactor_double
(
const
double
*
spectralField
,
long
fieldTruncation
,
long
subsetTruncation
);
#if
def
ined (
__cplusplus
)
#ifdef
__cplusplus
}
#endif
...
...
src/cgribexlib.c
View file @
dfd5eddf
/* Automatically generated by m214003 at 201
7
-0
9
-2
9
, do not edit */
/* Automatically generated by m214003 at 201
8
-0
1
-2
2
, do not edit */
/* CGRIBEXLIB_VERSION="1.9.0" */
...
...
@@ -12,10 +12,11 @@
#ifdef _ARCH_PWR6
#pragma options nostrict
#include
<ppu_intrinsics.h>
#endif
#if
def
ined (
HAVE_CONFIG_H
)
#
include "config.h"
#ifdef
HAVE_CONFIG_H
#include
"config.h"
#endif
#include
<string.h>
...
...
@@ -75,7 +76,7 @@
#if defined (VECTORCODE)
#if
def
ined
(
INT32
)
#ifdef INT32
# define GRIBPACK unsigned INT32
# define PACK_GRIB packInt32
# define UNPACK_GRIB unpackInt32
...
...
@@ -184,11 +185,11 @@ int qu2reg3_double(double *pfield, int *kpoint, int klat, int klon,
int
qu2reg3_float
(
float
*
pfield
,
int
*
kpoint
,
int
klat
,
int
klon
,
float
msval
,
int
*
kret
,
int
omisng
,
int
operio
,
int
oveggy
);
#if
def
ined
(
INT32
)
#ifdef INT32
long
packInt32
(
unsigned
INT32
*
up
,
unsigned
char
*
cp
,
long
bc
,
long
tc
);
#endif
long
packInt64
(
unsigned
INT64
*
up
,
unsigned
char
*
cp
,
long
bc
,
long
tc
);
#if
def
ined
(
INT32
)
#ifdef INT32
long
unpackInt32
(
const
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
);
#endif
long
unpackInt64
(
const
unsigned
char
*
cp
,
unsigned
INT64
*
up
,
long
bc
,
long
tc
);
...
...
@@ -214,7 +215,7 @@ int grib2Sections(unsigned char *gribbuffer, long gribbufsize, unsigned char **i
unsigned
char
**
lusp
,
unsigned
char
**
gdsp
,
unsigned
char
**
pdsp
,
unsigned
char
**
drsp
,
unsigned
char
**
bmsp
,
unsigned
char
**
bdsp
);
#if
def
ined (
__cplusplus
)
#ifdef
__cplusplus
}
#endif
...
...
@@ -4471,7 +4472,7 @@ long unpackInt64(const unsigned char *cp, unsigned INT64 *up, long bc, long tc)
/* pack 8-bit bytes from 32-bit words to a packed buffer */
/* same as : for ( int i = 0; i < bc; ++i ) cp[i] = (char) up[i]; */
#if
def
ined
(
INT32
)
#ifdef INT32
long
packInt32
(
unsigned
INT32
*
up
,
unsigned
char
*
cp
,
long
bc
,
long
tc
)
{
U_BYTEORDER
;
...
...
@@ -4567,7 +4568,7 @@ long packInt32(unsigned INT32 *up, unsigned char *cp, long bc, long tc)
/* unpack 8-bit bytes from a packed buffer with 32-bit words */
/* same as : for ( int i = 0; i < bc; ++i ) up[i] = (INT32) cp[i]; */
#if
def
ined
(
INT32
)
#ifdef INT32
long
unpackInt32
(
const
unsigned
char
*
cp
,
unsigned
INT32
*
up
,
long
bc
,
long
tc
)
{
U_BYTEORDER
;
...
...
@@ -5235,7 +5236,7 @@ double get_cr(unsigned char *w1, unsigned char *w2)
void
grib1PrintALL
(
int
nrec
,
long
offset
,
long
recpos
,
long
recsize
,
unsigned
char
*
gribbuffer
)
{
static
int
header
=
1
;
static
bool
header
=
true
;
unsigned
char
*
is
=
NULL
,
*
pds
=
NULL
,
*
gds
=
NULL
,
*
bms
=
NULL
,
*
bds
=
NULL
;
if
(
header
)
...
...
@@ -5243,7 +5244,7 @@ void grib1PrintALL(int nrec, long offset, long recpos, long recsize, unsigned ch
fprintf
(
stdout
,
" Rec : Off Position Size : V PDS GDS BMS BDS : Code Level : LType GType: CR LL
\n
"
);
/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */
header
=
0
;
header
=
false
;
}
is
=
gribbuffer
;
...
...
@@ -5282,21 +5283,18 @@ void grib1PrintALL(int nrec, long offset, long recpos, long recsize, unsigned ch
void
grib2PrintALL
(
int
nrec
,
long
offset
,
long
recpos
,
long
recsize
,
unsigned
char
*
gribbuffer
)
{
static
int
header
=
1
;
static
bool
header
=
true
;
unsigned
char
*
is
=
NULL
,
*
pds
=
NULL
,
*
gds
=
NULL
,
*
bms
=
NULL
,
*
bds
=
NULL
;
unsigned
char
*
ids
=
NULL
,
*
lus
=
NULL
,
*
drs
=
NULL
;
long
ids_len
=
0
,
lus_len
=
0
,
gds_len
=
0
,
pds_len
=
0
,
drs_len
=
0
,
bms_len
=
0
,
bds_len
=
0
;
int
gridtype
,
paramnum
,
level1type
/*, level2type*/
;
int
level1
/*, level1sf*/
;
/* int level2, level2sf; */
double
cr
=
1
;
if
(
header
)
{
fprintf
(
stdout
,
" Rec : Off Position Size : V IDS LUS GDS PDS DRS BMS BDS :
Code
Level : LType GType: CR
\n
"
);
" Rec : Off Position Size : V IDS LUS GDS PDS DRS BMS BDS :
Parameter
Level : LType GType: CR
\n
"
);
/* ----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+ */
header
=
0
;
header
=
false
;
}
is
=
gribbuffer
;
...
...
@@ -5318,21 +5316,25 @@ void grib2PrintALL(int nrec, long offset, long recpos, long recsize, unsigned ch
// double cr = (((BDS_Flag >> 4)&1) && (BDS_Z == 128 || BDS_Z == 130)) ? get_cr(&bds[14], &gribbuffer[4]) : 1;
gridtype
=
GET_UINT2
(
gds
[
12
],
gds
[
13
]);
paramnum
=
GET_UINT1
(
pds
[
10
]);
level1type
=
GET_UINT1
(
pds
[
22
]);
int
dis
=
GET_UINT1
(
is
[
6
]);
int
gridtype
=
GET_UINT2
(
gds
[
12
],
gds
[
13
]);
int
paramcat
=
GET_UINT1
(
pds
[
9
]);
int
paramnum
=
GET_UINT1
(
pds
[
10
]);
int
level1type
=
GET_UINT1
(
pds
[
22
]);
/* level1sf = GET_UINT1(pds[23]); */
level1
=
GET_UINT4
(
pds
[
24
],
pds
[
25
],
pds
[
26
],
pds
[
27
]);
int
level1
=
GET_UINT4
(
pds
[
24
],
pds
[
25
],
pds
[
26
],
pds
[
27
]);
/* level2type = GET_UINT1(pds[28]); */
/* level2sf = GET_UINT1(pds[29]); */
/* level2 = GET_UINT4(pds[30],pds[31],pds[32],pds[33]); */
/*
printf("level %d %d %d %d %d %d %d\n", level1type, level1sf, level1, level1*level1sf, level2sf, level2, level2*level2sf);
*/
fprintf
(
stdout
,
"%5d :%4ld %8ld %6ld :%2d %3ld %3ld %3ld %3ld %4ld %6ld %6ld : %3d%7d : %5d %5d %6.4g
\n
"
,
char
paramstr
[
16
];
sprintf
(
paramstr
,
"%d.%d.%d"
,
paramnum
,
paramcat
,
dis
);
fprintf
(
stdout
,
"%5d :%4ld %8ld %6ld :%2d %3ld %3ld %3ld %3ld %4ld %6ld %6ld : %-9s %7d : %5d %5d %6.4g
\n
"
,
nrec
,
offset
,
recpos
,
recsize
,
GRIB_EDITION
(
is
),
ids_len
,
lus_len
,
gds_len
,
pds_len
,
drs_len
,
bms_len
,
bds_len
,
param
num
,
level1
,
level1type
,
gridtype
,
cr
);
param
str
,
level1
,
level1type
,
gridtype
,
cr
);
}
...
...
@@ -5771,7 +5773,7 @@ void gribRepair1(int nrec, long recsize, unsigned char *gribbuffer)
extern
"C"
{
#endif
#include
<szlib.h>
#if
def
ined (
__cplusplus
)
#ifdef
__cplusplus
}
#endif
...
...
@@ -13159,7 +13161,7 @@ void encode_dummy(void)
(
void
)
encode_array_unrolled_double
(
0
,
0
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
);
(
void
)
encode_array_unrolled_float
(
0
,
0
,
0
,
NULL
,
NULL
,
0
,
0
,
NULL
);
}
static
const
char
grb_libvers
[]
=
"1.9.0"
" of ""
Sep
2
9
201
7
"" ""
10:16
:0
2
"
;
static
const
char
grb_libvers
[]
=
"1.9.0"
" of ""
Jan
2
2
201
8
"" ""
09:24
:0
3
"
;
const
char
*
cgribexLibraryVersion
(
void
)
{
...
...
src/dmemory.h
View file @
dfd5eddf
#ifndef _DMEMORY_H
#define _DMEMORY_H
#ifndef
_DMEMORY_H
#define
_DMEMORY_H
#include
<stdio.h>
...
...
@@ -25,11 +25,11 @@ extern void *memCalloc (size_t nmemb, size_t size, const char *file, const cha
extern
void
*
memMalloc
(
size_t
size
,
const
char
*
file
,
const
char
*
functionname
,
int
line
);
extern
void
memFree
(
void
*
ptr
,
const
char
*
file
,
const
char
*
functionname
,
int
line
);
#if
def
ined (
__cplusplus
)
#ifdef
__cplusplus
}
#endif
#if
def
ined
WITH_FUNCTION_NAME
#ifdef WITH_FUNCTION_NAME
# define Realloc(p, s) memRealloc((p), (s), __FILE__, __func__, __LINE__)
# define Calloc(n, s) memCalloc((n), (s), __FILE__, __func__, __LINE__)
# define Malloc(s) memMalloc((s), __FILE__, __func__, __LINE__)
...
...
src/dtypes.h
View file @
dfd5eddf
#ifndef DTYPES_H
#define DTYPES_H
#ifndef
DTYPES_H
#define
DTYPES_H
#include
<stdio.h>
#include
<limits.h>
/* INT32 */
#if
! defined (
INT_MAX
)
#
error INT_MAX undefined
#if
ndef
INT_MAX
#error INT_MAX undefined
#endif
#undef INT32
...
...
@@ -19,7 +19,7 @@
/* INT64 */
#if
! defined (
LONG_MAX
)
#if
ndef
LONG_MAX
# error LONG_MAX undefined
#endif
...
...
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