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
1f58f45f
Commit
1f58f45f
authored
Jul 28, 2010
by
Uwe Schulzweida
Browse files
GRIB2: added support for GME grids
parent
bc6c194b
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
1f58f45f
...
...
@@ -228,6 +228,7 @@ tables/ecmwf -text
tables/gen_tableheaderfile -text
tables/mpiom1 -text
tables/remo -text
tables/template.3.101.def -text
tables/wmo_001 -text
tests/Makefile.am -text
tests/Makefile.in -text
...
...
src/gribapi.h
View file @
1f58f45f
...
...
@@ -28,7 +28,8 @@
#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 192
/* hexagonal GME grid */
#define GRIBAPI_GTYPE_GME 100
/* hexagonal GME grid */
#define GRIBAPI_GTYPE_CELL 101
/* General Unstructured Grid */
const
char
*
gribapiLibraryVersion
(
void
);
void
gribapiDefHandles
(
int
streamID
);
...
...
src/stream_cgribex.c
View file @
1f58f45f
...
...
@@ -1726,7 +1726,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
if
(
lwarn
)
{
lwarn
=
FALSE
;
Warning
(
func
,
"Curvilinear grids are unsupported in GRIB
format
! Created wrong GDS!"
);
Warning
(
func
,
"Curvilinear grids are unsupported in GRIB
1
! Created wrong GDS!"
);
}
gridtype
=
GRID_LONLAT
;
}
...
...
@@ -1910,7 +1910,7 @@ void cgribexDefGrid(int *isec1, int *isec2, int *isec4, int gridID)
}
default:
{
Warning
(
func
,
"The GRIB library can not store fields on the used grid!"
);
Warning
(
func
,
"The
C
GRIB
EX
library can not store fields on the used grid!"
);
Error
(
func
,
"Unsupported grid type: %s"
,
gridNamePtr
(
gridtype
));
}
}
...
...
src/stream_gribapi.c
View file @
1f58f45f
...
...
@@ -77,6 +77,11 @@ int gribapiGetGridType(grib_handle *gh, int gribgridtype)
gridtype
=
GRID_GME
;
break
;
}
case
GRIBAPI_GTYPE_CELL
:
{
gridtype
=
GRID_CELL
;
break
;
}
default:
{
gridtype
=
GRID_GENERIC
;
...
...
@@ -522,17 +527,27 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
*/
break
;
}
/*
case
GRID_GME
:
{
grid.size = ISEC4_NumValues;
grid.nd = ISEC2_GME_ND;
grid.ni = ISEC2_GME_NI;
grid.ni2 = ISEC2_GME_NI2;
grid.ni3 = ISEC2_GME_NI3;
grid
.
size
=
numberOfPoints
;
if
(
grib_get_long
(
gh
,
"nd"
,
&
lpar
)
==
0
)
grid
.
nd
=
lpar
;
if
(
grib_get_long
(
gh
,
"Ni"
,
&
lpar
)
==
0
)
grid
.
ni
=
lpar
;
if
(
grib_get_long
(
gh
,
"n2"
,
&
lpar
)
==
0
)
grid
.
ni2
=
lpar
;
if
(
grib_get_long
(
gh
,
"n3"
,
&
lpar
)
==
0
)
grid
.
ni3
=
lpar
;
break
;
}
case
GRID_CELL
:
{
int
n1
=
0
,
n2
=
0
;
grid
.
size
=
numberOfPoints
;
if
(
grib_get_long
(
gh
,
"numberOfGridUsed"
,
&
lpar
)
==
0
)
n1
=
lpar
;
if
(
grib_get_long
(
gh
,
"numberOfGridInReference"
,
&
lpar
)
==
0
)
n2
=
lpar
;
gridtype
=
GRID_GENERIC
;
break
;
}
*/
case
GRID_GENERIC
:
{
int
nlon
=
0
,
nlat
=
0
;
...
...
@@ -2142,22 +2157,29 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
break
;
}
/*
case
GRID_GME
:
{
ISEC2_GridType = GRIBAPI_GTYPE_GME;
ISEC2_GME_ND = gridInqGMEnd(gridID);
ISEC2_GME_NI = gridInqGMEni(gridID);
ISEC2_GME_NI2 = gridInqGMEni2(gridID);
ISEC2_GME_NI3 = gridInqGMEni3(gridID);
ISEC2_GME_AFlag = 0;
ISEC2_GME_LatPP = 90000;
ISEC2_GME_LonPP = 0;
ISEC2_GME_LonMPL = 0;
ISEC2_GME_BFlag = 0;
GRIB_CHECK
(
grib_set_long
(
gh
,
"gridDefinitionTemplateNumber"
,
GRIBAPI_GTYPE_GME
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"nd"
,
gridInqGMEnd
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"Ni"
,
gridInqGMEni
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"n2"
,
gridInqGMEni2
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"n3"
,
gridInqGMEni3
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"latitudeOfThePolePointOfTheIcosahedronOnTheSphere"
,
90000
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"longitudeOfThePolePointOfTheIcosahedronOnTheSphere"
,
0
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfDataPoints"
,
gridInqSize
(
gridID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"totalNumberOfGridPoints"
,
gridInqSize
(
gridID
)),
0
);
break
;
}
case
GRID_CELL
:
{
GRIB_CHECK
(
grib_set_long
(
gh
,
"gridDefinitionTemplateNumber"
,
GRIBAPI_GTYPE_CELL
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfGridUsed"
,
0
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfGridInReference"
,
0
),
0
);
break
;
}
*/
default:
Error
(
func
,
"Unsupported grid type: %s"
,
gridNamePtr
(
gridtype
));
}
...
...
tables/template.3.101.def
0 → 100644
View file @
1f58f45f
# Copyright 2005-2007 ECMWF
#
# Licensed under the GNU Lesser General Public License which
# incorporates the terms and conditions of version 3 of the GNU
# General Public License.
# See LICENSE and gpl-3.0.txt for details.
# TEMPLATE 3.101, General Unstructured Grid
codetable[1] shapeOfTheEarth ('3.2.table',masterDir,localDir) : dump;
# Number of grid used
unsigned[3] numberOfGridUsed : dump ;
# Number of grid in reference
unsigned[1] numberOfGridInReference : dump ;
Write
Preview
Markdown
is supported
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