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
127b980f
Commit
127b980f
authored
Sep 17, 2009
by
Uwe Schulzweida
Browse files
more gribapi stuff
parent
82f1823d
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
doc/tex/grid.tex
View file @
127b980f
...
...
@@ -9,7 +9,7 @@ The following different Grid types are available:
\item
[{\large\tt GRID\_GENERIC }]
Generic user defined grid
\item
[{\large\tt GRID\_GAUSSIAN }]
Gaussian latitude/longitude grid
\item
[{\large\tt GRID\_LONLAT }]
Equidistant longitude/latitude grid
\item
[{\large\tt GRID\_L
AMBERT
}]
Lambert conformal grid
\item
[{\large\tt GRID\_L
CC
}]
Lambert conformal
conic
grid
\item
[{\large\tt GRID\_SPECTRAL }]
Spherical harmonic coefficients
\item
[{\large\tt GRID\_GME }]
Icosahedral-hexagonal GME grid
\item
[{\large\tt GRID\_CURVILINEAR}]
Curvilinear grid
...
...
doc/tex/install.tex
View file @
127b980f
...
...
@@ -2,7 +2,7 @@
This section describes how to build the
{
\CDI
}
library from the sources on a UNIX system.
{
\CDI
}
is using the GNU configure and build system to compile the source code.
The only requirement is a working ANSI C compiler.
The only requirement is a working ANSI C
99
compiler.
First go to the
\href
{
http://www.mpimet.mpg.de/cdi
}{
\tt
download
}
page
(
{
\tt
http://www.mpimet.mpg.de/cdi
}
) to get the latest distribution,
...
...
src/gribapi.h
View file @
127b980f
...
...
@@ -5,32 +5,28 @@
/* Level Types */
#define GRIBAPI_LTYPE_SURFACE 1
#define GRIBAPI_LTYPE_99 99
#define GRIBAPI_LTYPE_ISOBARIC 100
#define GRIBAPI_LTYPE_MEANSEA 102
#define GRIBAPI_LTYPE_ALTITUDE 103
#define GRIBAPI_LTYPE_HEIGHT 105
#define GRIBAPI_LTYPE_SIGMA 107
#define GRIBAPI_LTYPE_HYBRID 109
#define GRIBAPI_LTYPE_HYBRID_LAYER 110
#define GRIBAPI_LTYPE_LANDDEPTH 111
#define GRIBAPI_LTYPE_LANDDEPTH_LAYER 112
#define GRIBAPI_LTYPE_ISENTROPIC 113
#define GRIBAPI_LTYPE_MEANSEA 101
#define GRIBAPI_LTYPE_ALTITUDE 102
#define GRIBAPI_LTYPE_HEIGHT 103
#define GRIBAPI_LTYPE_SIGMA 104
#define GRIBAPI_LTYPE_HYBRID 105
#define GRIBAPI_LTYPE_LANDDEPTH 106
#define GRIBAPI_LTYPE_ISENTROPIC 107
#define GRIBAPI_LTYPE_SEADEPTH 160
#define GRIBAPI_LTYPE_99_MARGIN 1000
/*
* Data representation type (Grid Type)
*/
#define GRIBAPI_GTYPE_LATLON 0
/* latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_ROT 1
0
/* rotated latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_STR 2
0
/* stretched latitude/longitude */
#define GRIBAPI_GTYPE_LATLON_ROTSTR 3
0
/* rotated and stretched 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
1
4
/* rotated gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_STR
2
4
/* stretched gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_ROTSTR
3
4
/* rotated and stretched gaussian grid */
#define GRIBAPI_GTYPE_LCC
3
/* Lambert conformal */
#define GRIBAPI_GTYPE_GAUSSIAN_ROT 4
1
/* rotated gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_STR 4
2
/* stretched gaussian grid */
#define GRIBAPI_GTYPE_GAUSSIAN_ROTSTR 4
3
/* rotated and stretched gaussian grid */
#define GRIBAPI_GTYPE_LCC 3
0
/* Lambert conformal */
#define GRIBAPI_GTYPE_SPECTRAL 50
/* spherical harmonics */
#define GRIBAPI_GTYPE_GME 192
/* hexagonal GME grid */
...
...
src/stream_cdf.c
View file @
127b980f
...
...
@@ -5030,20 +5030,28 @@ int cdfInqContents(int streamID)
}
if
(
ncvars
[
xvarid
].
ndims
>
2
||
ncvars
[
yvarid
].
ndims
>
2
)
{
Warning
(
func
,
"Unsupported grid structure for variable %s (grid dims > 2)!"
,
ncvars
[
ncvarid
].
name
);
ncvars
[
ncvarid
].
xvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
yvarid
=
UNDEFID
;
xvarid
=
UNDEFID
;
yvarid
=
UNDEFID
;
{
if
(
ncvars
[
xvarid
].
ndims
==
3
&&
ncvars
[
xvarid
].
dimids
[
0
]
==
timedimid
&&
ncvars
[
yvarid
].
ndims
==
3
&&
ncvars
[
yvarid
].
dimids
[
0
]
==
timedimid
)
{
}
else
{
Warning
(
func
,
"Unsupported grid structure for variable %s (grid dims > 2)!"
,
ncvars
[
ncvarid
].
name
);
ncvars
[
ncvarid
].
xvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
yvarid
=
UNDEFID
;
xvarid
=
UNDEFID
;
yvarid
=
UNDEFID
;
}
}
}
if
(
xvarid
!=
UNDEFID
)
{
islon
=
ncvars
[
xvarid
].
islon
;
if
(
ncvars
[
xvarid
].
ndims
==
2
)
ndims
=
ncvars
[
xvarid
].
ndims
;
if
(
ndims
==
2
||
ndims
==
3
)
{
ncvars
[
ncvarid
].
gridtype
=
GRID_CURVILINEAR
;
size
=
xsize
*
ysize
;
...
...
@@ -5051,9 +5059,9 @@ int cdfInqContents(int streamID)
{
int
dimid
;
size_t
dimsize1
,
dimsize2
;
dimid
=
ncvars
[
xvarid
].
dimids
[
0
];
dimid
=
ncvars
[
xvarid
].
dimids
[
ndims
-
2
];
cdf_inq_dimlen
(
fileID
,
dimid
,
&
dimsize1
);
dimid
=
ncvars
[
xvarid
].
dimids
[
1
];
dimid
=
ncvars
[
xvarid
].
dimids
[
ndims
-
1
];
cdf_inq_dimlen
(
fileID
,
dimid
,
&
dimsize2
);
if
(
dimsize1
*
dimsize2
!=
size
)
{
...
...
@@ -5108,7 +5116,8 @@ int cdfInqContents(int streamID)
if
(
yvarid
!=
UNDEFID
)
{
islat
=
ncvars
[
yvarid
].
islat
;
if
(
ncvars
[
yvarid
].
ndims
==
2
)
ndims
=
ncvars
[
yvarid
].
ndims
;
if
(
ndims
==
2
||
ndims
==
3
)
{
ncvars
[
ncvarid
].
gridtype
=
GRID_CURVILINEAR
;
size
=
xsize
*
ysize
;
...
...
@@ -5116,9 +5125,9 @@ int cdfInqContents(int streamID)
{
int
dimid
;
size_t
dimsize1
,
dimsize2
;
dimid
=
ncvars
[
xvarid
].
dimids
[
0
];
dimid
=
ncvars
[
xvarid
].
dimids
[
ndims
-
2
];
cdf_inq_dimlen
(
fileID
,
dimid
,
&
dimsize1
);
dimid
=
ncvars
[
xvarid
].
dimids
[
1
];
dimid
=
ncvars
[
xvarid
].
dimids
[
ndims
-
1
];
cdf_inq_dimlen
(
fileID
,
dimid
,
&
dimsize2
);
if
(
dimsize1
*
dimsize2
!=
size
)
{
...
...
src/stream_cgribex.c
View file @
127b980f
...
...
@@ -202,6 +202,7 @@ int cgribexGetTimeUnit(int *isec1)
return
(
timeunit
);
}
/*
int cgribexInqRecord(int streamID, int *varID, int *levelID)
{
static char func[] = "cgribexInqRecord";
...
...
@@ -209,15 +210,15 @@ int cgribexInqRecord(int streamID, int *varID, int *levelID)
int fileID;
void *gribbuffer;
int iret = 0, iword = 0;
int
isec4size
=
0
;
int
isec0
[
2
],
isec1
[
4096
],
isec2
[
4096
],
isec3
[
2
],
isec4
[
512
];
double
fsec2
[
512
],
fsec3
[
2
],
*
fsec4
=
NULL
;
int gridID = -1, zaxisID = -1;
int gridtype;
int gribsize;
size_t readsize;
int vlistID;
stream_t *streamptr;
int isec4size = 0;
int isec0[2], isec1[4096], isec2[4096], isec3[2], isec4[512];
double fsec2[512], fsec3[2], *fsec4 = NULL;
streamptr = stream_to_pointer(streamID);
...
...
@@ -233,6 +234,7 @@ int cgribexInqRecord(int streamID, int *varID, int *levelID)
if ( gribsize == 0 ) return (0);
gribbuffer = streamptr->record->buffer;
printf("size = %d\n", streamptr->record->buffersize);
gribbuffer = realloc(gribbuffer, gribsize);
streamptr->record->buffer = gribbuffer;
...
...
@@ -302,6 +304,7 @@ int cgribexInqRecord(int streamID, int *varID, int *levelID)
return (status);
}
*/
static
void
cgribexAddRecord
(
int
streamID
,
int
code
,
int
*
isec1
,
int
*
isec2
,
double
*
fsec2
,
...
...
src/stream_cgribex.h
View file @
127b980f
#ifndef _STREAM_CGRIBEX_H
#define _STREAM_CGRIBEX_H
int
cgribexInqRecord
(
int
streamID
,
int
*
varID
,
int
*
levelID
);
void
cgribexScanTimestep1
(
int
streamID
);
int
cgribexScanTimestep2
(
int
streamID
);
int
cgribexScanTimestep
(
int
streamID
);
...
...
src/stream_grb.c
View file @
127b980f
...
...
@@ -13,7 +13,7 @@
#include
"file.h"
#include
"cgribex.h"
/* gribZip gribGetZip gribGinfo */
/*
int grbInqRecord(int streamID, int *varID, int *levelID)
{
int status;
...
...
@@ -22,7 +22,7 @@ int grbInqRecord(int streamID, int *varID, int *levelID)
return (status);
}
*/
int
grbDefRecord
(
int
streamID
)
{
...
...
src/stream_gribapi.c
View file @
127b980f
This diff is collapsed.
Click to expand it.
src/stream_gribapi.h
View file @
127b980f
#ifndef _STREAM_GRIBAPI_H
#define _STREAM_GRIBAPI_H
int
gribapiInqRecord
(
int
streamID
,
int
*
varID
,
int
*
levelID
);
void
gribapiScanTimestep1
(
int
streamID
);
int
gribapiScanTimestep2
(
int
streamID
);
int
gribapiScanTimestep
(
int
streamID
);
...
...
src/stream_record.c
View file @
127b980f
...
...
@@ -311,6 +311,7 @@ void streamReadRecord(int streamID, double *data, int *nmiss)
{
#if defined (HAVE_LIBGRIB)
case
FILETYPE_GRB
:
case
FILETYPE_GRB2
:
{
status
=
grbReadRecord
(
streamID
,
data
,
nmiss
);
break
;
...
...
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