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
4c2e9191
Commit
4c2e9191
authored
Jan 21, 2011
by
Uwe Schulzweida
Browse files
changed grid name GRID_CELL to GRID_UNSTRUCTURED
parent
73157f7d
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
4c2e9191
2011-01-21 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* changed grid name GRID_CELL to GRID_UNSTRUCTURED
2011-01-19 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support to encode/decode GRIB1 with GRIB_API
...
...
src/grid.c
View file @
4c2e9191
...
...
@@ -30,7 +30,7 @@ char *Grids[] = {
/* 6 */
"fourier"
,
/* 7 */
"gme"
,
/* 8 */
"trajectory"
,
/* 9 */
"
cell
"
,
/* 9 */
"
unstructured
"
,
/* 10 */
"curvilinear"
,
/* 11 */
"lcc"
,
/* 12 */
"lcc2"
,
...
...
@@ -472,7 +472,7 @@ void gridGenYvals(int gridtype, int ysize, double yfirst, double ylast, double y
@Item gridtype The type of the grid, one of the set of predefined CDI grid types.
The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
@func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL},
@func{GRID_GME}, @func{GRID_CURVILINEAR} and @func{GRID_
CELL
}.
@func{GRID_GME}, @func{GRID_CURVILINEAR} and @func{GRID_
UNSTRUCTURED
}.
@Item size Number of gridpoints.
@Description
...
...
@@ -524,7 +524,7 @@ int gridCreate(int gridtype, int size)
gridptr
->
size
=
size
;
/* if ( gridtype == GRID_GENERIC ) gridptr->xsize = size; */
if
(
gridtype
==
GRID_
CELL
)
gridptr
->
xsize
=
size
;
if
(
gridtype
==
GRID_
UNSTRUCTURED
)
gridptr
->
xsize
=
size
;
if
(
gridtype
==
GRID_CURVILINEAR
)
gridptr
->
nvertex
=
4
;
switch
(
gridtype
)
...
...
@@ -567,7 +567,7 @@ int gridCreate(int gridtype, int size)
break
;
}
case
GRID_GME
:
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
{
gridDefXname
(
gridID
,
"lon"
);
gridDefYname
(
gridID
,
"lat"
);
...
...
@@ -1029,7 +1029,7 @@ The function @func{gridInqType} returns the type of a Grid.
one of the set of predefined CDI grid types.
The valid CDI grid types are @func{GRID_GENERIC}, @func{GRID_GAUSSIAN},
@func{GRID_LONLAT}, @func{GRID_LCC}, @func{GRID_SPECTRAL}, @func{GRID_GME},
@func{GRID_CURVILINEAR} and @func{GRID_
CELL
}.
@func{GRID_CURVILINEAR} and @func{GRID_
UNSTRUCTURED
}.
@EndFunction
*/
...
...
@@ -1166,12 +1166,12 @@ void gridDefXsize(int gridID, int xsize)
if
(
xsize
>
gridInqSize
(
gridID
)
)
Error
(
"xsize %d is greater then gridsize %d"
,
xsize
,
gridInqSize
(
gridID
));
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
&&
xsize
!=
gridInqSize
(
gridID
)
)
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
&&
xsize
!=
gridInqSize
(
gridID
)
)
Error
(
"xsize %d must be equal gridsize %d for gridtype CELL"
,
xsize
,
gridInqSize
(
gridID
));
gridptr
->
xsize
=
xsize
;
if
(
gridInqType
(
gridID
)
!=
GRID_
CELL
&&
if
(
gridInqType
(
gridID
)
!=
GRID_
UNSTRUCTURED
&&
gridptr
->
xsize
*
gridptr
->
ysize
>
gridInqSize
(
gridID
)
)
Error
(
"inconsistent grid declaration! (xsize %d ysize %d gridsize %d)"
,
gridptr
->
xsize
,
gridptr
->
ysize
,
gridInqSize
(
gridID
));
...
...
@@ -1275,12 +1275,12 @@ void gridDefYsize(int gridID, int ysize)
if
(
ysize
>
gridInqSize
(
gridID
)
)
Error
(
"ysize %d is greater then gridsize %d"
,
ysize
,
gridInqSize
(
gridID
));
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
&&
ysize
!=
gridInqSize
(
gridID
)
)
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
&&
ysize
!=
gridInqSize
(
gridID
)
)
Error
(
"ysize %d must be equal gridsize %d for gridtype CELL"
,
ysize
,
gridInqSize
(
gridID
));
gridptr
->
ysize
=
ysize
;
if
(
gridInqType
(
gridID
)
!=
GRID_
CELL
&&
if
(
gridInqType
(
gridID
)
!=
GRID_
UNSTRUCTURED
&&
gridptr
->
xsize
*
gridptr
->
ysize
>
gridInqSize
(
gridID
)
)
Error
(
"inconsistent grid declaration! (xsize %d ysize %d gridsize %d)"
,
gridptr
->
xsize
,
gridptr
->
ysize
,
gridInqSize
(
gridID
));
...
...
@@ -1499,7 +1499,7 @@ int gridInqXvals(int gridID, double *xvals)
grid_check_ptr
(
gridID
,
gridptr
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
xsize
;
...
...
@@ -1542,7 +1542,7 @@ void gridDefXvals(int gridID, const double *xvals)
gridtype
=
gridptr
->
type
;
if
(
gridtype
==
GRID_
CELL
||
gridtype
==
GRID_CURVILINEAR
)
if
(
gridtype
==
GRID_
UNSTRUCTURED
||
gridtype
==
GRID_CURVILINEAR
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
xsize
;
...
...
@@ -1587,7 +1587,7 @@ int gridInqYvals(int gridID, double *yvals)
grid_check_ptr
(
gridID
,
gridptr
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
ysize
;
...
...
@@ -1630,7 +1630,7 @@ void gridDefYvals(int gridID, const double *yvals)
gridtype
=
gridptr
->
type
;
if
(
gridtype
==
GRID_
CELL
||
gridtype
==
GRID_CURVILINEAR
)
if
(
gridtype
==
GRID_
UNSTRUCTURED
||
gridtype
==
GRID_CURVILINEAR
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
ysize
;
...
...
@@ -2433,7 +2433,7 @@ int gridGenerate(grid_t grid)
{
case
GRID_LONLAT
:
case
GRID_GAUSSIAN
:
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
case
GRID_CURVILINEAR
:
case
GRID_GENERIC
:
case
GRID_LCC
:
...
...
@@ -2644,7 +2644,7 @@ int gridDuplicate(int gridID)
if
(
gridptr
->
xvals
!=
NULL
)
{
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
CELL
)
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
UNSTRUCTURED
)
size
=
gridsize
;
else
size
=
gridptr
->
xsize
;
...
...
@@ -2655,7 +2655,7 @@ int gridDuplicate(int gridID)
if
(
gridptr
->
yvals
!=
NULL
)
{
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
CELL
)
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
UNSTRUCTURED
)
size
=
gridsize
;
else
size
=
gridptr
->
ysize
;
...
...
@@ -2666,7 +2666,7 @@ int gridDuplicate(int gridID)
if
(
gridptr
->
xbounds
!=
NULL
)
{
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
CELL
)
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
UNSTRUCTURED
)
size
=
gridsize
;
else
size
=
gridptr
->
xsize
;
...
...
@@ -2679,7 +2679,7 @@ int gridDuplicate(int gridID)
if
(
gridptr
->
ybounds
!=
NULL
)
{
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
CELL
)
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_
UNSTRUCTURED
)
size
=
gridsize
;
else
size
=
gridptr
->
ysize
;
...
...
@@ -2730,7 +2730,7 @@ void gridCompress(int gridID)
gridtype
=
gridInqType
(
gridID
);
gridsize
=
gridInqSize
(
gridID
);
if
(
gridtype
==
GRID_
CELL
)
if
(
gridtype
==
GRID_
UNSTRUCTURED
)
{
if
(
gridptr
->
mask_gme
!=
NULL
)
{
...
...
@@ -2909,7 +2909,7 @@ void gridDefXbounds(int gridID, const double *xbounds)
return
;
}
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
nvertex
*
gridptr
->
size
;
else
size
=
nvertex
*
gridptr
->
xsize
;
...
...
@@ -2959,7 +2959,7 @@ int gridInqXbounds(int gridID, double *xbounds)
if
(
CDI_Debug
&&
nvertex
==
0
)
Warning
(
"nvertex undefined for gridID = %d"
,
gridID
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
nvertex
*
gridptr
->
size
;
else
size
=
nvertex
*
gridptr
->
xsize
;
...
...
@@ -3019,7 +3019,7 @@ void gridDefYbounds(int gridID, const double *ybounds)
return
;
}
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
nvertex
*
gridptr
->
size
;
else
size
=
nvertex
*
gridptr
->
ysize
;
...
...
@@ -3069,7 +3069,7 @@ int gridInqYbounds(int gridID, double *ybounds)
if
(
CDI_Debug
&&
nvertex
==
0
)
Warning
(
"nvertex undefined for gridID = %d"
,
gridID
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
CELL
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_
UNSTRUCTURED
)
size
=
nvertex
*
gridptr
->
size
;
else
size
=
nvertex
*
gridptr
->
ysize
;
...
...
@@ -3140,7 +3140,7 @@ void gridPrint(int gridID, int opt)
if
(
gridptr
->
yname
[
0
]
)
fprintf
(
fp
,
"yname = %s
\n
"
,
gridptr
->
yname
);
if
(
gridptr
->
ylongname
[
0
]
)
fprintf
(
fp
,
"ylongname = %s
\n
"
,
gridptr
->
ylongname
);
if
(
gridptr
->
yunits
[
0
]
)
fprintf
(
fp
,
"yunits = %s
\n
"
,
gridptr
->
yunits
);
if
(
type
==
GRID_
CELL
)
fprintf
(
fp
,
"nvertex = %d
\n
"
,
nvertex
);
if
(
type
==
GRID_
UNSTRUCTURED
)
fprintf
(
fp
,
"nvertex = %d
\n
"
,
nvertex
);
}
switch
(
type
)
...
...
@@ -3152,9 +3152,9 @@ void gridPrint(int gridID, int opt)
case
GRID_SINUSOIDAL
:
case
GRID_LAEA
:
case
GRID_CURVILINEAR
:
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
{
if
(
type
==
GRID_CURVILINEAR
||
type
==
GRID_
CELL
)
if
(
type
==
GRID_CURVILINEAR
||
type
==
GRID_
UNSTRUCTURED
)
{
xdim
=
gridsize
;
ydim
=
gridsize
;
...
...
@@ -3165,7 +3165,7 @@ void gridPrint(int gridID, int opt)
ydim
=
ysize
;
}
if
(
type
!=
GRID_
CELL
)
if
(
type
!=
GRID_
UNSTRUCTURED
)
{
if
(
xsize
>
0
)
fprintf
(
fp
,
"xsize = %d
\n
"
,
xsize
);
if
(
ysize
>
0
)
fprintf
(
fp
,
"ysize = %d
\n
"
,
ysize
);
...
...
src/stream_cdf.c
View file @
4c2e9191
...
...
@@ -1899,7 +1899,7 @@ void cdfDefCell(int streamID, int gridID)
{
gridID0
=
vlistGrid
(
vlistID
,
index
);
gridtype0
=
gridInqType
(
gridID0
);
if
(
gridtype0
==
GRID_
CELL
)
if
(
gridtype0
==
GRID_
UNSTRUCTURED
)
{
dimlen0
=
gridInqSize
(
gridID0
);
if
(
dimlen
==
dimlen0
)
...
...
@@ -2475,7 +2475,7 @@ void cdfDefGrid(int streamID, int gridID)
cdfDefTrajLon
(
streamID
,
gridID
);
cdfDefTrajLat
(
streamID
,
gridID
);
}
else
if
(
gridtype
==
GRID_
CELL
)
else
if
(
gridtype
==
GRID_
UNSTRUCTURED
)
{
cdfDefCell
(
streamID
,
gridID
);
}
...
...
@@ -2776,7 +2776,7 @@ int cdfDefVar(int streamID, int varID)
{
cdf_put_att_text
(
fileID
,
ncvarid
,
"coordinates"
,
9
,
"tlon tlat"
);
}
else
if
(
gridtype
==
GRID_
CELL
||
gridtype
==
GRID_CURVILINEAR
)
else
if
(
gridtype
==
GRID_
UNSTRUCTURED
||
gridtype
==
GRID_CURVILINEAR
)
{
char
coordinates
[
256
]
=
""
;
char
cellarea
[
256
]
=
"area: "
;
...
...
@@ -3215,7 +3215,7 @@ int cdfReadVarSliceDP(int streamID, int varID, int levelID, double *data, int *n
{
cdfReadGridTraj
(
streamID
,
gridID
);
}
else
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
)
else
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
)
{
xid
=
streamptr
->
xdimID
[
gridindex
];
}
...
...
@@ -4225,7 +4225,7 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
else
if
(
strcmp
(
attstring
,
"generic"
)
==
0
)
ncvars
[
ncvarid
].
gridtype
=
GRID_GENERIC
;
else
if
(
strcmp
(
attstring
,
"cell"
)
==
0
)
ncvars
[
ncvarid
].
gridtype
=
GRID_
CELL
;
ncvars
[
ncvarid
].
gridtype
=
GRID_
UNSTRUCTURED
;
else
if
(
strcmp
(
attstring
,
"curvilinear"
)
==
0
)
ncvars
[
ncvarid
].
gridtype
=
GRID_CURVILINEAR
;
else
if
(
strcmp
(
attstring
,
"sinusoidal"
)
==
0
)
...
...
@@ -4603,7 +4603,7 @@ void setDimType(int nvars, ncvar_t *ncvars, ncdim_t *ncdims)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
X_AXIS
);
lxdim
=
TRUE
;
}
else
if
(
lydim
==
FALSE
&&
ncvars
[
ncvarid
].
gridtype
!=
GRID_
CELL
)
else
if
(
lydim
==
FALSE
&&
ncvars
[
ncvarid
].
gridtype
!=
GRID_
UNSTRUCTURED
)
{
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
Y_AXIS
);
lydim
=
TRUE
;
...
...
@@ -4893,7 +4893,7 @@ void define_igrids(stream_t *streamptr, int fileID, int vlistID, ncdim_t *ncdims
}
if
(
ncvars
[
ncvarid
].
gridtype
==
UNDEFID
||
ncvars
[
ncvarid
].
gridtype
==
GRID_GENERIC
)
if
(
ydimid
==
xdimid
)
ncvars
[
ncvarid
].
gridtype
=
GRID_
CELL
;
if
(
ydimid
==
xdimid
)
ncvars
[
ncvarid
].
gridtype
=
GRID_
UNSTRUCTURED
;
memset
(
&
grid
,
0
,
sizeof
(
grid_t
));
...
...
@@ -5092,7 +5092,7 @@ void define_igrids(stream_t *streamptr, int fileID, int vlistID, ncdim_t *ncdims
if
(
(
int
)
ysize
==
0
)
size
=
xsize
;
else
if
(
(
int
)
xsize
==
0
)
size
=
ysize
;
else
if
(
ncvars
[
ncvarid
].
gridtype
==
GRID_
CELL
)
size
=
xsize
;
else
if
(
ncvars
[
ncvarid
].
gridtype
==
GRID_
UNSTRUCTURED
)
size
=
xsize
;
else
size
=
xsize
*
ysize
;
}
...
...
@@ -5126,7 +5126,7 @@ void define_igrids(stream_t *streamptr, int fileID, int vlistID, ncdim_t *ncdims
case
GRID_GENERIC
:
case
GRID_LONLAT
:
case
GRID_GAUSSIAN
:
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
case
GRID_CURVILINEAR
:
{
grid
.
size
=
size
;
...
...
src/stream_gribapi.c
View file @
4c2e9191
...
...
@@ -76,7 +76,7 @@ int gribapiGetGridType(grib_handle *gh, int gribgridtype)
}
case
GRIBAPI_GTYPE_CELL
:
{
gridtype
=
GRID_
CELL
;
gridtype
=
GRID_
UNSTRUCTURED
;
break
;
}
default:
...
...
@@ -571,7 +571,7 @@ void gribapiAddRecord(int streamID, int param, grib_handle *gh,
break
;
}
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
{
int
n1
=
0
,
n2
=
0
;
grid
.
size
=
numberOfPoints
;
...
...
@@ -2218,7 +2218,7 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
break
;
}
case
GRID_
CELL
:
case
GRID_
UNSTRUCTURED
:
{
static
int
warning
=
1
;
status
=
grib_set_long
(
gh
,
"gridDefinitionTemplateNumber"
,
GRIBAPI_GTYPE_CELL
);
...
...
src/stream_srv.c
View file @
4c2e9191
...
...
@@ -227,7 +227,7 @@ int srvDefRecord(int streamID)
xsize
=
gridInqSize
(
gridID
);
ysize
=
1
;
}
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
)
ysize
=
1
;
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
)
ysize
=
1
;
if
(
gridInqSize
(
gridID
)
!=
xsize
*
ysize
)
Error
(
"Internal problem with gridsize!"
);
...
...
@@ -996,7 +996,7 @@ void srvWriteVarDP(int streamID, int varID, const double *data)
xsize
=
gridInqSize
(
gridID
);
ysize
=
1
;
}
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
)
ysize
=
1
;
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
)
ysize
=
1
;
if
(
gridInqSize
(
gridID
)
!=
xsize
*
ysize
)
Error
(
"Internal problem with gridsize!"
);
...
...
@@ -1063,7 +1063,7 @@ void srvWriteVarSliceDP(int streamID, int varID, int levID, const double *data)
xsize
=
gridInqSize
(
gridID
);
ysize
=
1
;
}
if
(
gridInqType
(
gridID
)
==
GRID_
CELL
)
ysize
=
1
;
if
(
gridInqType
(
gridID
)
==
GRID_
UNSTRUCTURED
)
ysize
=
1
;
if
(
gridInqSize
(
gridID
)
!=
xsize
*
ysize
)
Error
(
"Internal problem with gridsize!"
);
...
...
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