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
031ea225
Commit
031ea225
authored
Jan 25, 2011
by
Uwe Schulzweida
Browse files
cgribexlib update
parent
7e7f92f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cgribex.h
View file @
031ea225
...
...
@@ -6,36 +6,34 @@
#define GRIB_MISSVAL -9.E33
/* Level Types */
#define LTYPE_SURFACE 1
#define LTYPE_99 99
#define LTYPE_ISOBARIC 100
#define LTYPE_MEANSEA 102
#define LTYPE_ALTITUDE 103
#define LTYPE_HEIGHT 105
#define LTYPE_SIGMA 107
#define LTYPE_HYBRID 109
#define LTYPE_HYBRID_LAYER 110
#define LTYPE_LANDDEPTH 111
#define LTYPE_LANDDEPTH_LAYER 112
#define LTYPE_ISENTROPIC 113
#define LTYPE_SEADEPTH 160
#define LTYPE_99_MARGIN 1000
/*
* Data representation type (Grid Type) [Table 6]
*/
#define GTYPE_LATLON 0
/* latitude/longitude */
#define GTYPE_LATLON_ROT 10
/* rotated latitude/longitude */
#define GTYPE_LATLON_STR 20
/* stretched latitude/longitude */
#define GTYPE_LATLON_ROTSTR 30
/* rotated and stretched latitude/longitude */
#define GTYPE_GAUSSIAN 4
/* gaussian grid */
#define GTYPE_GAUSSIAN_ROT 14
/* rotated gaussian grid */
#define GTYPE_GAUSSIAN_STR 24
/* stretched gaussian grid */
#define GTYPE_GAUSSIAN_ROTSTR 34
/* rotated and stretched gaussian grid */
#define GTYPE_LCC 3
/* Lambert conformal */
#define GTYPE_SPECTRAL 50
/* spherical harmonics */
#define GTYPE_GME 192
/* hexagonal GME grid */
/* GRIB1 Level Types */
#define GRIB1_LTYPE_SURFACE 1
#define GRIB1_LTYPE_99 99
#define GRIB1_LTYPE_ISOBARIC 100
#define GRIB1_LTYPE_MEANSEA 102
#define GRIB1_LTYPE_ALTITUDE 103
#define GRIB1_LTYPE_HEIGHT 105
#define GRIB1_LTYPE_SIGMA 107
#define GRIB1_LTYPE_HYBRID 109
#define GRIB1_LTYPE_HYBRID_LAYER 110
#define GRIB1_LTYPE_LANDDEPTH 111
#define GRIB1_LTYPE_LANDDEPTH_LAYER 112
#define GRIB1_LTYPE_ISENTROPIC 113
#define GRIB1_LTYPE_SEADEPTH 160
#define GRIB1_LTYPE_99_MARGIN 1000
/* GRIB1 Data representation type (Grid Type) [Table 6] */
#define GRIB1_GTYPE_LATLON 0
/* latitude/longitude */
#define GRIB1_GTYPE_LATLON_ROT 10
/* rotated latitude/longitude */
#define GRIB1_GTYPE_LATLON_STR 20
/* stretched latitude/longitude */
#define GRIB1_GTYPE_LATLON_ROTSTR 30
/* rotated and stretched latitude/longitude */
#define GRIB1_GTYPE_GAUSSIAN 4
/* gaussian grid */
#define GRIB1_GTYPE_GAUSSIAN_ROT 14
/* rotated gaussian grid */
#define GRIB1_GTYPE_GAUSSIAN_STR 24
/* stretched gaussian grid */
#define GRIB1_GTYPE_GAUSSIAN_ROTSTR 34
/* rotated and stretched gaussian grid */
#define GRIB1_GTYPE_LCC 3
/* Lambert conformal */
#define GRIB1_GTYPE_SPECTRAL 50
/* spherical harmonics */
#define GRIB1_GTYPE_GME 192
/* hexagonal GME grid */
/*
* Macros for the indicator section ( Section 0 )
...
...
src/cgribexlib.c
View file @
031ea225
/* Automatically generated by m214003 at 201
0-11-12
, do not edit */
/* Automatically generated by m214003 at 201
1-01-25
, do not edit */
/* CGRIBEXLIB_VERSION="1.4.7" */
...
...
@@ -3029,14 +3029,14 @@ void encodePDS(GRIBPACK *lpds, long pdsLen, int *isec1)
Put1Byte
(
ISEC1_Parameter
);
/* 8 Parameter Code */
Put1Byte
(
ISEC1_LevelType
);
/* 9 Type of level */
if
(
(
ISEC1_LevelType
!=
20
)
&&
(
ISEC1_LevelType
!=
LTYPE_99
)
&&
(
ISEC1_LevelType
!=
LTYPE_ISOBARIC
)
&&
(
ISEC1_LevelType
!=
LTYPE_ALTITUDE
)
&&
(
ISEC1_LevelType
!=
LTYPE_HEIGHT
)
&&
(
ISEC1_LevelType
!=
LTYPE_SIGMA
)
&&
(
ISEC1_LevelType
!=
LTYPE_HYBRID
)
&&
(
ISEC1_LevelType
!=
LTYPE_LANDDEPTH
)
&&
(
ISEC1_LevelType
!=
LTYPE_ISENTROPIC
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_99
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ISOBARIC
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ALTITUDE
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_HEIGHT
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_SIGMA
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_HYBRID
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_LANDDEPTH
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ISENTROPIC
)
&&
(
ISEC1_LevelType
!=
115
)
&&
(
ISEC1_LevelType
!=
117
)
&&
(
ISEC1_LevelType
!=
125
)
&&
...
...
@@ -3132,9 +3132,9 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
int
gdslen
=
32
;
unsigned
lonIncr
,
latIncr
;
if
(
ISEC2_GridType
==
GTYPE_LCC
)
gdslen
+=
10
;
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LCC
)
gdslen
+=
10
;
if
(
ISEC2_GridType
==
GTYPE_LATLON_ROT
)
gdslen
+=
10
;
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
)
gdslen
+=
10
;
if
(
ISEC2_NumVCP
||
ISEC2_Reduced
)
pvoffset
=
gdslen
+
1
;
...
...
@@ -3147,7 +3147,7 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
Put1Byte
(
pvoffset
);
/* 4 PV */
Put1Byte
(
ISEC2_GridType
);
/* 5 LatLon=0 Gauss=4 Spectral=50 */
if
(
ISEC2_GridType
==
GTYPE_SPECTRAL
)
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_SPECTRAL
)
{
Put2Byte
(
ISEC2_PentaJ
);
/* 6- 7 Pentagonal resolution J */
Put2Byte
(
ISEC2_PentaK
);
/* 8- 9 Pentagonal resolution K */
...
...
@@ -3156,7 +3156,7 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
Put1Byte
(
ISEC2_RepMode
);
/* 13 Representation mode */
PutnZero
(
18
);
/* 14-31 reserved */
}
else
if
(
ISEC2_GridType
==
GTYPE_GME
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_GME
)
{
Put2Byte
(
ISEC2_GME_NI2
);
Put2Byte
(
ISEC2_GME_NI3
);
...
...
@@ -3169,7 +3169,7 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
Put1Byte
(
ISEC2_GME_BFlag
);
PutnZero
(
5
);
}
else
if
(
ISEC2_GridType
==
GTYPE_LCC
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LCC
)
{
Put2Byte
(
ISEC2_NumLon
);
/* 6- 7 Longitudes */
...
...
@@ -3188,9 +3188,9 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
Put3Int
(
ISEC2_Lambert_LonSP
);
/* 37-39 */
PutnZero
(
2
);
/* 34-41 */
}
else
if
(
ISEC2_GridType
==
GTYPE_LATLON
||
ISEC2_GridType
==
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GTYPE_LATLON_ROT
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON
||
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
)
{
int
numlon
;
if
(
ISEC2_Reduced
)
...
...
@@ -3217,7 +3217,7 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
latIncr
=
ISEC2_LatIncr
;
}
Put2Byte
(
lonIncr
);
/* 23-24 i - direction increment */
if
(
ISEC2_GridType
==
GTYPE_GAUSSIAN
)
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN
)
Put2Byte
(
ISEC2_NumPar
);
/* 25-26 Latitudes Pole->Equator */
else
Put2Byte
(
latIncr
);
/* 25-26 j - direction increment */
...
...
@@ -3225,7 +3225,7 @@ void encodeGDS(GRIBPACK *lGrib, long *gribLen, int *isec2, double *fsec2)
Put1Byte
(
ISEC2_ScanFlag
);
/* 27 Scanning mode */
PutnZero
(
4
);
/* 28-31 reserved */
if
(
ISEC2_GridType
==
GTYPE_LATLON_ROT
)
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
)
{
Put3Int
(
ISEC2_LatSP
);
Put3Int
(
ISEC2_LonSP
);
...
...
@@ -4056,19 +4056,19 @@ int decodePDS(unsigned char *pds, int *isec0, int *isec1)
ISEC1_LevelType
=
PDS_LevelType
;
if
(
(
ISEC1_LevelType
!=
20
)
&&
(
ISEC1_LevelType
!=
LTYPE_99
)
&&
(
ISEC1_LevelType
!=
LTYPE_ISOBARIC
)
&&
(
ISEC1_LevelType
!=
LTYPE_ALTITUDE
)
&&
(
ISEC1_LevelType
!=
LTYPE_HEIGHT
)
&&
(
ISEC1_LevelType
!=
LTYPE_SIGMA
)
&&
(
ISEC1_LevelType
!=
LTYPE_HYBRID
)
&&
(
ISEC1_LevelType
!=
LTYPE_LANDDEPTH
)
&&
(
ISEC1_LevelType
!=
LTYPE_ISENTROPIC
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_99
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ISOBARIC
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ALTITUDE
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_HEIGHT
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_SIGMA
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_HYBRID
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_LANDDEPTH
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_ISENTROPIC
)
&&
(
ISEC1_LevelType
!=
115
)
&&
(
ISEC1_LevelType
!=
117
)
&&
(
ISEC1_LevelType
!=
125
)
&&
(
ISEC1_LevelType
!=
127
)
&&
(
ISEC1_LevelType
!=
LTYPE_SEADEPTH
)
&&
(
ISEC1_LevelType
!=
GRIB1_
LTYPE_SEADEPTH
)
&&
(
ISEC1_LevelType
!=
210
)
)
{
ISEC1_Level1
=
PDS_Level1
;
...
...
@@ -4247,9 +4247,9 @@ int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2, int *n
/*
Gaussian grid definition.
*/
if
(
ISEC2_GridType
==
GTYPE_LATLON
||
ISEC2_GridType
==
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GTYPE_LATLON_ROT
)
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON
||
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
)
{
ISEC2_NumLat
=
GDS_NumLat
;
if
(
!
ReducedGrid
)
...
...
@@ -4266,7 +4266,7 @@ int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2, int *n
ISEC2_NumPar
=
GDS_NumPar
;
ISEC2_ScanFlag
=
GDS_ScanFlag
;
if
(
ISEC2_GridType
==
GTYPE_LATLON_ROT
)
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
)
{
ISEC2_LatSP
=
GDS_LatSP
;
ISEC2_LonSP
=
GDS_LonSP
;
...
...
@@ -4277,25 +4277,25 @@ int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2, int *n
Error("Latitude/Longitude Conflict");
*/
}
else
if
(
ISEC2_GridType
==
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GTYPE_GAUSSIAN_ROT
||
ISEC2_GridType
==
GTYPE_GAUSSIAN_STR
||
ISEC2_GridType
==
GTYPE_GAUSSIAN_ROTSTR
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN
||
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN_ROT
||
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN_STR
||
ISEC2_GridType
==
GRIB1_
GTYPE_GAUSSIAN_ROTSTR
)
{
/*
iret = decodeGDS_GG(gds, gdspos, isec0, isec2, imisng);
*/
}
else
if
(
ISEC2_GridType
==
GTYPE_LATLON
||
ISEC2_GridType
==
GTYPE_LATLON_ROT
||
ISEC2_GridType
==
GTYPE_LATLON_STR
||
ISEC2_GridType
==
GTYPE_LATLON_ROTSTR
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON
||
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROT
||
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_STR
||
ISEC2_GridType
==
GRIB1_
GTYPE_LATLON_ROTSTR
)
{
/*
iret = decodeGDS_LL(gds, gdspos, isec0, isec2, imisng);
*/
}
else
if
(
ISEC2_GridType
==
GTYPE_LCC
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_LCC
)
{
ISEC2_NumLon
=
GDS_NumLon
;
ISEC2_NumLat
=
GDS_NumLat
;
...
...
@@ -4313,7 +4313,7 @@ int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2, int *n
ISEC2_Lambert_ProjFlag
=
GDS_Lambert_ProjFlag
;
ISEC2_ScanFlag
=
GDS_ScanFlag
;
}
else
if
(
ISEC2_GridType
==
GTYPE_SPECTRAL
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_SPECTRAL
)
{
ISEC2_PentaJ
=
GDS_PentaJ
;
/* Truncation */
ISEC2_PentaK
=
GDS_PentaK
;
...
...
@@ -4330,7 +4330,7 @@ int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2, int *n
iret = decodeGDS_SH(gds, gdspos, isec0, isec2, imisng);
*/
}
else
if
(
ISEC2_GridType
==
GTYPE_GME
)
else
if
(
ISEC2_GridType
==
GRIB1_
GTYPE_GME
)
{
ISEC2_GME_NI2
=
GDS_GME_NI2
;
ISEC2_GME_NI3
=
GDS_GME_NI3
;
...
...
@@ -9069,7 +9069,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return
(
gribLen
);
}
static
const
char
grb_libvers
[]
=
"1.4.7"
" of ""
Nov 12
201
0
"" ""
08:21:3
7"
;
static
const
char
grb_libvers
[]
=
"1.4.7"
" of ""
Jan 25
201
1
"" ""
12:07:1
7"
;
const
char
*
cgribexLibraryVersion
(
void
)
{
...
...
src/gribapi.h
View file @
031ea225
...
...
@@ -3,33 +3,31 @@
#define GRIBAPI_MISSVAL -9.E33
/* Level Types */
#define GRIB
API
_LTYPE_SURFACE 1
#define GRIB
API
_LTYPE_ISOBARIC 100
#define GRIB
API
_LTYPE_MEANSEA 101
#define GRIB
API
_LTYPE_ALTITUDE 102
#define GRIB
API
_LTYPE_HEIGHT 103
#define GRIB
API
_LTYPE_SIGMA 104
#define GRIB
API
_LTYPE_HYBRID 105
#define GRIB
API
_LTYPE_LANDDEPTH 106
#define GRIB
API
_LTYPE_ISENTROPIC 107
#define GRIB
API
_LTYPE_SEADEPTH 160
/*
GRIB2
Level Types */
#define GRIB
2
_LTYPE_SURFACE 1
#define GRIB
2
_LTYPE_ISOBARIC 100
#define GRIB
2
_LTYPE_MEANSEA 101
#define GRIB
2
_LTYPE_ALTITUDE 102
#define GRIB
2
_LTYPE_HEIGHT 103
#define GRIB
2
_LTYPE_SIGMA 104
#define GRIB
2
_LTYPE_HYBRID 105
#define GRIB
2
_LTYPE_LANDDEPTH 106
#define GRIB
2
_LTYPE_ISENTROPIC 107
#define GRIB
2
_LTYPE_SEADEPTH 160
/*
* Data representation type (Grid Type)
*/
#define GRIBAPI_GTYPE_LATLON 0
/* latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_ROT 1
/* rotated latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_STR 2
/* stretched latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_ROTSTR 3
/* rotated and stretched latitude/longitude */
#define GRIBAPI_GTYPE_GAUSSIAN 40
/* gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_ROT 41
/* rotated gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_STR 42
/* stretched gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_ROTSTR 43
/* rotated and stretched gaussian grid */
#define GRIBAPI_GTYPE_LCC 30
/* Lambert conformal */
#define GRIBAPI_GTYPE_SPECTRAL 50
/* spherical harmonics */
#define GRIBAPI_GTYPE_GME 100
/* hexagonal GME grid */
#define GRIBAPI_GTYPE_NUMBER 101
/* General Unstructured Grid */
/* GRIB2 Data representation type (Grid Type) */
#define GRIB2_GTYPE_LATLON 0
/* latitude/longitude */
#define GRIB2_GTYPE_LATLON_ROT 1
/* rotated latitude/longitude */
#define GRIB2_GTYPE_LATLON_STR 2
/* stretched latitude/longitude */
#define GRIB2_GTYPE_LATLON_ROTSTR 3
/* rotated and stretched latitude/longitude */
#define GRIB2_GTYPE_GAUSSIAN 40
/* gaussian grid */
#define GRIB2_GTYPE_GAUSSIAN_ROT 41
/* rotated gaussian grid */
#define GRIB2_GTYPE_GAUSSIAN_STR 42
/* stretched gaussian grid */
#define GRIB2_GTYPE_GAUSSIAN_ROTSTR 43
/* rotated and stretched gaussian grid */
#define GRIB2_GTYPE_LCC 30
/* Lambert conformal */
#define GRIB2_GTYPE_SPECTRAL 50
/* spherical harmonics */
#define GRIB2_GTYPE_GME 100
/* hexagonal GME grid */
#define GRIB2_GTYPE_NUMBER 101
/* General Unstructured Grid */
const
char
*
gribapiLibraryVersion
(
void
);
void
gribapiDefHandles
(
int
streamID
);
...
...
src/stream_cgribex.c
View file @
031ea225
...
...
@@ -36,18 +36,18 @@ int cgribexGetGridType(int *isec2)
switch
(
ISEC2_GridType
)
{
case
GTYPE_LATLON
:
case
GTYPE_LATLON_ROT
:
case
GRIB1_
GTYPE_LATLON
:
case
GRIB1_
GTYPE_LATLON_ROT
:
{
gridtype
=
GRID_LONLAT
;
break
;
}
case
GTYPE_LCC
:
case
GRIB1_
GTYPE_LCC
:
{
gridtype
=
GRID_LCC
;
break
;
}
case
GTYPE_GAUSSIAN
:
case
GRIB1_
GTYPE_GAUSSIAN
:
{
if
(
ISEC2_Reduced
)
gridtype
=
GRID_GAUSSIAN_REDUCED
;
...
...
@@ -55,12 +55,12 @@ int cgribexGetGridType(int *isec2)
gridtype
=
GRID_GAUSSIAN
;
break
;
}
case
GTYPE_SPECTRAL
:
case
GRIB1_
GTYPE_SPECTRAL
:
{
gridtype
=
GRID_SPECTRAL
;
break
;
}
case
GTYPE_GME
:
case
GRIB1_
GTYPE_GME
:
{
gridtype
=
GRID_GME
;
break
;
...
...
@@ -99,64 +99,20 @@ int cgribexGetZaxisType(int grb_ltype)
switch
(
grb_ltype
)
{
case
LTYPE_SURFACE
:
{
zaxistype
=
ZAXIS_SURFACE
;
break
;
}
case
LTYPE_MEANSEA
:
{
zaxistype
=
ZAXIS_MEANSEA
;
break
;
}
case
LTYPE_99
:
case
LTYPE_ISOBARIC
:
{
zaxistype
=
ZAXIS_PRESSURE
;
break
;
}
case
LTYPE_HEIGHT
:
{
zaxistype
=
ZAXIS_HEIGHT
;
break
;
}
case
LTYPE_ALTITUDE
:
{
zaxistype
=
ZAXIS_ALTITUDE
;
break
;
}
case
LTYPE_SIGMA
:
{
zaxistype
=
ZAXIS_SIGMA
;
break
;
}
case
LTYPE_HYBRID
:
case
LTYPE_HYBRID_LAYER
:
{
zaxistype
=
ZAXIS_HYBRID
;
break
;
}
case
LTYPE_LANDDEPTH
:
case
LTYPE_LANDDEPTH_LAYER
:
{
zaxistype
=
ZAXIS_DEPTH_BELOW_LAND
;
break
;
}
case
LTYPE_ISENTROPIC
:
{
zaxistype
=
ZAXIS_ISENTROPIC
;
break
;
}
case
LTYPE_SEADEPTH
:
{
zaxistype
=
ZAXIS_DEPTH_BELOW_SEA
;
break
;
}
default:
{
zaxistype
=
ZAXIS_GENERIC
;
break
;
}
case
GRIB1_LTYPE_SURFACE
:
{
zaxistype
=
ZAXIS_SURFACE
;
break
;
}
case
GRIB1_LTYPE_MEANSEA
:
{
zaxistype
=
ZAXIS_MEANSEA
;
break
;
}
case
GRIB1_LTYPE_99
:
case
GRIB1_LTYPE_ISOBARIC
:
{
zaxistype
=
ZAXIS_PRESSURE
;
break
;
}
case
GRIB1_LTYPE_HEIGHT
:
{
zaxistype
=
ZAXIS_HEIGHT
;
break
;
}
case
GRIB1_LTYPE_ALTITUDE
:
{
zaxistype
=
ZAXIS_ALTITUDE
;
break
;
}
case
GRIB1_LTYPE_SIGMA
:
{
zaxistype
=
ZAXIS_SIGMA
;
break
;
}
case
GRIB1_LTYPE_HYBRID
:
case
GRIB1_LTYPE_HYBRID_LAYER
:
{
zaxistype
=
ZAXIS_HYBRID
;
break
;
}
case
GRIB1_LTYPE_LANDDEPTH
:
case
GRIB1_LTYPE_LANDDEPTH_LAYER
:
{
zaxistype
=
ZAXIS_DEPTH_BELOW_LAND
;
break
;
}
case
GRIB1_LTYPE_ISENTROPIC
:
{
zaxistype
=
ZAXIS_ISENTROPIC
;
break
;
}
case
GRIB1_LTYPE_SEADEPTH
:
{
zaxistype
=
ZAXIS_DEPTH_BELOW_SEA
;
break
;
}
default:
{
zaxistype
=
ZAXIS_GENERIC
;
break
;
}
}
return
(
zaxistype
);
...
...
@@ -171,8 +127,8 @@ int cgribexGetZaxisHasBounds(int grb_ltype)
switch
(
grb_ltype
)
{
case
LTYPE_HYBRID_LAYER
:
case
LTYPE_LANDDEPTH_LAYER
:
case
GRIB1_
LTYPE_HYBRID_LAYER
:
case
GRIB1_
LTYPE_LANDDEPTH_LAYER
:
{
lbounds
=
1
;
break
;
...
...
@@ -1835,11 +1791,11 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
if
(
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_GAUSSIAN_REDUCED
)
ISEC2_GridType
=
GTYPE_GAUSSIAN
;
ISEC2_GridType
=
GRIB1_
GTYPE_GAUSSIAN
;
else
if
(
gridtype
==
GRID_LONLAT
&&
gridIsRotated
(
gridID
)
)
ISEC2_GridType
=
GTYPE_LATLON_ROT
;
ISEC2_GridType
=
GRIB1_
GTYPE_LATLON_ROT
;
else
ISEC2_GridType
=
GTYPE_LATLON
;
ISEC2_GridType
=
GRIB1_
GTYPE_LATLON
;
ISEC2_NumLon
=
nlon
;
ISEC2_NumLat
=
nlat
;
...
...
@@ -1908,7 +1864,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
gridInqLCC
(
gridID
,
&
originLon
,
&
originLat
,
&
lonParY
,
&
lat1
,
&
lat2
,
&
xincm
,
&
yincm
,
&
projflag
,
&
scanflag
);
ISEC2_GridType
=
GTYPE_LCC
;
ISEC2_GridType
=
GRIB1_
GTYPE_LCC
;
ISEC2_NumLon
=
xsize
;
ISEC2_NumLat
=
ysize
;
ISEC2_FirstLon
=
NINT
(
originLon
*
1000
);
...
...
@@ -1927,7 +1883,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
case
GRID_SPECTRAL
:
{
ISEC2_GridType
=
GTYPE_SPECTRAL
;
ISEC2_GridType
=
GRIB1_
GTYPE_SPECTRAL
;
ISEC2_PentaJ
=
gridInqTrunc
(
gridID
);
ISEC2_PentaK
=
ISEC2_PentaJ
;
ISEC2_PentaM
=
ISEC2_PentaJ
;
...
...
@@ -1951,7 +1907,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
case
GRID_GME
:
{
ISEC2_GridType
=
GTYPE_GME
;
ISEC2_GridType
=
GRIB1_
GTYPE_GME
;
ISEC2_GME_ND
=
gridInqGMEnd
(
gridID
);
ISEC2_GME_NI
=
gridInqGMEni
(
gridID
);
ISEC2_GME_NI2
=
gridInqGMEni2
(
gridID
);
...
...
@@ -1998,14 +1954,14 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
{
case
ZAXIS_SURFACE
:
{
ISEC1_LevelType
=
LTYPE_SURFACE
;
ISEC1_LevelType
=
GRIB1_
LTYPE_SURFACE
;
ISEC1_Level1
=
(
int
)
zaxisInqLevel
(
zaxisID
,
levelID
);
ISEC1_Level2
=
0
;
break
;
}
case
ZAXIS_MEANSEA
:
{
ISEC1_LevelType
=
LTYPE_MEANSEA
;
ISEC1_LevelType
=
GRIB1_
LTYPE_MEANSEA
;
ISEC1_Level1
=
(
int
)
zaxisInqLevel
(
zaxisID
,
levelID
);
ISEC1_Level2
=
0
;
break
;
...
...
@@ -2017,13 +1973,13 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
if
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
)
{
ISEC1_LevelType
=
LTYPE_HYBRID_LAYER
;
ISEC1_LevelType
=
GRIB1_
LTYPE_HYBRID_LAYER
;
ISEC1_Level1
=
(
int
)
zaxisInqLbound
(
zaxisID
,
levelID
);
ISEC1_Level2
=
(
int
)
zaxisInqUbound
(
zaxisID
,
levelID
);
}
else
{
ISEC1_LevelType
=
LTYPE_HYBRID
;
ISEC1_LevelType
=
GRIB1_
LTYPE_HYBRID
;
ISEC1_Level1
=
(
int
)
zaxisInqLevel
(
zaxisID
,
levelID
);
ISEC1_Level2
=
0
;
}
...
...
@@ -2066,13 +2022,13 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
ilevel
=
(
int
)
level
;
if
(
level
<
32768
&&
(
level
<
100
||
modf
(
level
/
100
,
&
dum
)
>
0
)
)
{
ISEC1_LevelType
=
LTYPE_99
;
ISEC1_LevelType
=
GRIB1_
LTYPE_99
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
}
else
{
ISEC1_LevelType
=
LTYPE_ISOBARIC
;
ISEC1_LevelType
=
GRIB1_
LTYPE_ISOBARIC
;
ISEC1_Level1
=
ilevel
/
100
;
ISEC1_Level2
=
0
;
}
...
...
@@ -2083,7 +2039,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_HEIGHT
;
ISEC1_LevelType
=
GRIB1_
LTYPE_HEIGHT
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
...
...
@@ -2094,7 +2050,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_ALTITUDE
;
ISEC1_LevelType
=
GRIB1_
LTYPE_ALTITUDE
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
...
...
@@ -2105,7 +2061,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_SIGMA
;
ISEC1_LevelType
=
GRIB1_
LTYPE_SIGMA
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
...
...
@@ -2115,7 +2071,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
{
if
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
)
{
ISEC1_LevelType
=
LTYPE_LANDDEPTH_LAYER
;
ISEC1_LevelType
=
GRIB1_
LTYPE_LANDDEPTH_LAYER
;
ISEC1_Level1
=
(
int
)
zaxisInqLbound
(
zaxisID
,
levelID
);
ISEC1_Level2
=
(
int
)
zaxisInqUbound
(
zaxisID
,
levelID
);
}
...
...
@@ -2124,7 +2080,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_LANDDEPTH
;
ISEC1_LevelType
=
GRIB1_
LTYPE_LANDDEPTH
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
}
...
...
@@ -2136,7 +2092,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_SEADEPTH
;
ISEC1_LevelType
=
GRIB1_
LTYPE_SEADEPTH
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
...
...
@@ -2147,7 +2103,7 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
level
=
zaxisInqLevel
(
zaxisID
,
levelID
);
ilevel
=
(
int
)
level
;
ISEC1_LevelType
=
LTYPE_ISENTROPIC
;
ISEC1_LevelType
=
GRIB1_
LTYPE_ISENTROPIC
;
ISEC1_Level1
=
ilevel
;
ISEC1_Level2
=
0
;
...
...
src/stream_gribapi.c
View file @
031ea225
...
...
@@ -43,18 +43,18 @@ int gribapiGetGridType(grib_handle *gh, int gribgridtype)
switch
(
gribgridtype
)
{
case
GRIB
API
_GTYPE_LATLON
:
case
GRIB
API
_GTYPE_LATLON_ROT
:
case
GRIB
2
_GTYPE_LATLON
:
case
GRIB
2
_GTYPE_LATLON_ROT
:
{
gridtype
=
GRID_LONLAT
;
break
;
}
case
GRIB
API
_GTYPE_LCC
:
case
GRIB
2
_GTYPE_LCC
:
{
gridtype
=
GRID_LCC
;
break
;
}
case
GRIB
API
_GTYPE_GAUSSIAN
:
case
GRIB
2
_GTYPE_GAUSSIAN
:
{
long
lpar
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"Ni"
,
&
lpar
),
0
);
...
...
@@ -64,17 +64,17 @@ int gribapiGetGridType(grib_handle *gh, int gribgridtype)
gridtype
=
GRID_GAUSSIAN
;
break
;
}
case
GRIB
API
_GTYPE_SPECTRAL
:
case
GRIB
2
_GTYPE_SPECTRAL
:
{
gridtype
=
GRID_SPECTRAL
;
break
;