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
88c4d967
Commit
88c4d967
authored
Sep 22, 2017
by
Uwe Schulzweida
Browse files
Renamed prec to datatype.
parent
95107baa
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/cdi.h
View file @
88c4d967
...
...
@@ -883,10 +883,10 @@ void gridInqXstdname(int gridID, char *xstdname);
/* gridInqYstdname: Get the standard name of a Y-axis */
void
gridInqYstdname
(
int
gridID
,
char
*
ystdname
);
/* gridDefDatatype: Define the
precision
of a Grid */
/* gridDefDatatype: Define the
data type
of a Grid */
void
gridDefDatatype
(
int
gridID
,
int
prec
);
/* gridInqDatatype: Get the
precision
of a Grid */
/* gridInqDatatype: Get the
data type
of a Grid */
int
gridInqDatatype
(
int
gridID
);
/* gridInqXval: Get one value of a X-axis */
...
...
src/grid.c
View file @
88c4d967
...
...
@@ -150,7 +150,7 @@ void grid_init(grid_t *gridptr)
gridptr
->
number
=
0
;
gridptr
->
position
=
0
;
gridptr
->
reference
=
NULL
;
gridptr
->
prec
=
0
;
gridptr
->
datatype
=
0
;
gridptr
->
size
=
0
;
gridptr
->
x
.
size
=
0
;
gridptr
->
y
.
size
=
0
;
...
...
@@ -1210,14 +1210,14 @@ void gridDefXsize(int gridID, int xsize)
@EndFunction
*/
void
gridDefDatatype
(
int
gridID
,
int
prec
)
void
gridDefDatatype
(
int
gridID
,
int
datatype
)
{
grid_t
*
gridptr
=
grid_to_pointer
(
gridID
);
if
(
gridptr
->
prec
!=
prec
)
if
(
gridptr
->
datatype
!=
datatype
)
{
gridMark4Update
(
gridID
);
gridptr
->
prec
=
prec
;
gridptr
->
datatype
=
datatype
;
}
}
...
...
@@ -1234,7 +1234,7 @@ void gridDefDatatype(int gridID, int prec)
int
gridInqDatatype
(
int
gridID
)
{
grid_t
*
gridptr
=
grid_to_pointer
(
gridID
);
return
gridptr
->
prec
;
return
gridptr
->
datatype
;
}
/*
...
...
@@ -2405,7 +2405,7 @@ int gridCompareP(void *gridptr1, void *gridptr2)
xassert
(
g2
);
if
(
g1
->
type
!=
g2
->
type
)
return
differ
;
if
(
g1
->
prec
!=
g2
->
prec
)
return
differ
;
if
(
g1
->
datatype
!=
g2
->
datatype
)
return
differ
;
if
(
g1
->
isCyclic
!=
g2
->
isCyclic
)
return
differ
;
if
(
g1
->
x
.
flag
!=
g2
->
x
.
flag
)
return
differ
;
if
(
g1
->
y
.
flag
!=
g2
->
y
.
flag
)
return
differ
;
...
...
@@ -2569,7 +2569,7 @@ static
void
gridComplete
(
grid_t
*
grid
)
{
int
gridID
=
grid
->
self
;
gridDefDatatype
(
gridID
,
grid
->
prec
);
gridDefDatatype
(
gridID
,
grid
->
datatype
);
int
gridtype
=
grid
->
type
;
switch
(
gridtype
)
...
...
@@ -2711,7 +2711,7 @@ int gridGenerate(const grid_t *grid)
int
gridtype
=
grid
->
type
;
int
gridID
=
gridCreate
(
gridtype
,
grid
->
size
);
grid_t
*
restrict
gridptr
=
grid_to_pointer
(
gridID
);
gridptr
->
prec
=
grid
->
prec
;
gridptr
->
datatype
=
grid
->
datatype
;
gridptr
->
x
.
size
=
grid
->
x
.
size
;
gridptr
->
y
.
size
=
grid
->
y
.
size
;
gridptr
->
np
=
grid
->
np
;
...
...
@@ -3394,9 +3394,9 @@ void gridPrintKernel(int gridID, int opt, FILE *fp)
int
xstrlen
=
gridInqXIsc
(
gridID
);
int
ystrlen
=
gridInqYIsc
(
gridID
);
int
nvertex
=
gridInqNvertex
(
gridID
);
int
prec
=
gridInqDatatype
(
gridID
);
int
datatype
=
gridInqDatatype
(
gridID
);
int
dig
=
(
prec
==
CDI_DATATYPE_FLT64
)
?
15
:
7
;
int
dig
=
(
datatype
==
CDI_DATATYPE_FLT64
)
?
15
:
7
;
fprintf
(
fp
,
"gridtype = %s
\n
"
"gridsize = %d
\n
"
,
gridNamePtr
(
type
),
gridsize
);
...
...
@@ -3673,7 +3673,7 @@ void gridPrintP(void *voidptr, FILE *fp)
gridPrintKernel
(
gridID
,
0
,
fp
);
fprintf
(
fp
,
"
precision
= %d
\n
"
"
datatype
= %d
\n
"
"nd = %d
\n
"
"ni = %d
\n
"
"ni2 = %d
\n
"
...
...
@@ -3683,7 +3683,7 @@ void gridPrintP(void *voidptr, FILE *fp)
"trunc = %d
\n
"
"lcomplex = %d
\n
"
"nrowlon = %d
\n
"
,
gridptr
->
prec
,
gridptr
->
gme
.
nd
,
gridptr
->
gme
.
ni
,
gridptr
->
gme
.
ni2
,
gridptr
->
datatype
,
gridptr
->
gme
.
nd
,
gridptr
->
gme
.
ni
,
gridptr
->
gme
.
ni2
,
gridptr
->
gme
.
ni3
,
gridptr
->
number
,
gridptr
->
position
,
gridptr
->
trunc
,
gridptr
->
lcomplex
,
gridptr
->
nrowlon
);
...
...
@@ -4213,7 +4213,7 @@ gridTxCode ()
enum
{
GRID_PACK_INT_IDX_SELF
,
GRID_PACK_INT_IDX_TYPE
,
GRID_PACK_INT_IDX_
PREC
,
GRID_PACK_INT_IDX_
DATATYPE
,
GRID_PACK_INT_IDX_IS_CYCLIC
,
GRID_PACK_INT_IDX_X_FLAG
,
GRID_PACK_INT_IDX_Y_FLAG
,
...
...
@@ -4419,7 +4419,7 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
xassert
(
!
force_id
||
targetID
==
gridP
->
self
);
gridP
->
type
=
intBuffer
[
GRID_PACK_INT_IDX_TYPE
];
gridP
->
prec
=
intBuffer
[
GRID_PACK_INT_IDX_
PREC
];
gridP
->
datatype
=
intBuffer
[
GRID_PACK_INT_IDX_
DATATYPE
];
gridP
->
isCyclic
=
(
signed
char
)
intBuffer
[
GRID_PACK_INT_IDX_IS_CYCLIC
];
gridP
->
x
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_X_FLAG
];
gridP
->
y
.
flag
=
(
short
)
intBuffer
[
GRID_PACK_INT_IDX_Y_FLAG
];
...
...
@@ -4605,7 +4605,7 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
intBuffer
[
GRID_PACK_INT_IDX_SELF
]
=
gridP
->
self
;
intBuffer
[
GRID_PACK_INT_IDX_TYPE
]
=
gridP
->
type
;
intBuffer
[
GRID_PACK_INT_IDX_
PREC
]
=
gridP
->
prec
;
intBuffer
[
GRID_PACK_INT_IDX_
DATATYPE
]
=
gridP
->
datatype
;
intBuffer
[
GRID_PACK_INT_IDX_IS_CYCLIC
]
=
gridP
->
isCyclic
;
intBuffer
[
GRID_PACK_INT_IDX_X_FLAG
]
=
gridP
->
x
.
flag
;
intBuffer
[
GRID_PACK_INT_IDX_Y_FLAG
]
=
gridP
->
y
.
flag
;
...
...
src/grid.h
View file @
88c4d967
...
...
@@ -83,7 +83,7 @@ struct grid_t {
int
self
;
int
size
;
int
type
;
/* grid type */
int
prec
;
/* grid
precision
*/
int
datatype
;
/* grid
data type
*/
int
proj
;
/* grid projection */
int
projtype
;
/* grid projection type */
mask_t
*
mask
;
...
...
src/stream_cdf_i.c
View file @
88c4d967
...
...
@@ -2157,7 +2157,7 @@ bool cdf_read_xcoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
*
islon
=
axisvar
->
islon
;
int
ndims
=
axisvar
->
ndims
;
size_t
size
=
0
;
int
prec
=
cdfInqDatatype
(
axisvar
->
xtype
,
axisvar
->
lunsigned
);
int
datatype
=
cdfInqDatatype
(
axisvar
->
xtype
,
axisvar
->
lunsigned
);
if
(
(
ndims
-
ntdims
)
==
2
)
{
...
...
@@ -2167,7 +2167,7 @@ bool cdf_read_xcoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
dimid
=
axisvar
->
dimids
[
ndims
-
1
];
size_t
dimsize2
=
ncdims
[
dimid
].
len
;
if
(
prec
==
CDI_DATATYPE_UINT8
)
if
(
datatype
==
CDI_DATATYPE_UINT8
)
{
ncvar
->
gridtype
=
GRID_CHARXY
;
size
=
dimsize1
*
dimsize2
;
...
...
@@ -2201,9 +2201,9 @@ bool cdf_read_xcoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
return
true
;
}
if
(
prec
!=
-
1
)
grid
->
prec
=
prec
;
if
(
datatype
!=
-
1
)
grid
->
datatype
=
datatype
;
if
(
prec
==
CDI_DATATYPE_UINT8
&&
!
CDI_netcdf_lazy_grid_load
)
if
(
datatype
==
CDI_DATATYPE_UINT8
&&
!
CDI_netcdf_lazy_grid_load
)
{
cdf_load_cvals
(
size
,
xvarid
,
axisvar
,
&
grid
->
x
.
cvals
,
*
xsize
);
grid
->
x
.
clength
=
size
/
(
*
xsize
)
;
...
...
@@ -2225,7 +2225,7 @@ bool cdf_read_ycoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
*
islat
=
axisvar
->
islat
;
int
ndims
=
axisvar
->
ndims
;
size_t
size
=
0
;
int
prec
=
cdfInqDatatype
(
axisvar
->
xtype
,
axisvar
->
lunsigned
);
int
datatype
=
cdfInqDatatype
(
axisvar
->
xtype
,
axisvar
->
lunsigned
);
if
(
(
ndims
-
ntdims
)
==
2
)
{
...
...
@@ -2235,7 +2235,7 @@ bool cdf_read_ycoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
dimid
=
axisvar
->
dimids
[
ndims
-
1
];
size_t
dimsize2
=
ncdims
[
dimid
].
len
;
if
(
prec
==
CDI_DATATYPE_UINT8
)
if
(
datatype
==
CDI_DATATYPE_UINT8
)
{
ncvar
->
gridtype
=
GRID_CHARXY
;
size
=
dimsize1
*
dimsize2
;
...
...
@@ -2270,9 +2270,9 @@ bool cdf_read_ycoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
return
true
;
}
if
(
prec
!=
-
1
)
grid
->
prec
=
prec
;
if
(
datatype
!=
-
1
)
grid
->
datatype
=
datatype
;
if
(
prec
==
CDI_DATATYPE_UINT8
&&
!
CDI_netcdf_lazy_grid_load
)
if
(
datatype
==
CDI_DATATYPE_UINT8
&&
!
CDI_netcdf_lazy_grid_load
)
{
cdf_load_cvals
(
size
,
yvarid
,
axisvar
,
&
grid
->
y
.
cvals
,
*
ysize
);
grid
->
y
.
clength
=
size
/
(
*
ysize
)
;
...
...
@@ -2292,7 +2292,7 @@ bool cdf_read_coordinates(struct cdfLazyGrid *restrict lazyGrid, ncvar_t *ncvar,
grid_t
*
grid
=
&
lazyGrid
->
base
;
size_t
size
=
0
;
grid
->
prec
=
CDI_DATATYPE_FLT64
;
grid
->
datatype
=
CDI_DATATYPE_FLT64
;
if
(
ncvar
->
gridtype
==
GRID_TRAJECTORY
)
{
...
...
@@ -2865,7 +2865,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if
(
zvarid
!=
CDI_UNDEFID
)
zaxisType
=
ncvars
[
zvarid
].
zaxistype
;
if
(
zaxisType
==
CDI_UNDEFID
)
zaxisType
=
ZAXIS_GENERIC
;
int
z
prec
=
CDI_DATATYPE_FLT64
;
int
z
datatype
=
CDI_DATATYPE_FLT64
;
double
*
restrict
lbounds
=
NULL
;
double
*
restrict
ubounds
=
NULL
;
...
...
@@ -2875,7 +2875,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
pname
=
ncvars
[
zvarid
].
name
;
plongname
=
ncvars
[
zvarid
].
longname
;
punits
=
ncvars
[
zvarid
].
units
;
if
(
ncvars
[
zvarid
].
xtype
==
NC_FLOAT
)
z
prec
=
CDI_DATATYPE_FLT32
;
if
(
ncvars
[
zvarid
].
xtype
==
NC_FLOAT
)
z
datatype
=
CDI_DATATYPE_FLT32
;
/* don't change the name !!! */
/*
if ( (len = strlen(pname)) > 2 )
...
...
@@ -2886,7 +2886,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
{
if
(
ncvars
[
zvarid
].
ndims
==
2
)
{
z
prec
=
CDI_DATATYPE_UINT8
;
z
datatype
=
CDI_DATATYPE_UINT8
;
zclength
=
ncdims
[
ncvars
[
zvarid
].
dimids
[
1
]].
len
;
cdf_load_cvals
(
zsize
*
zclength
,
zvarid
,
ncvar
,
&
zcvals
,
zsize
);
}
...
...
@@ -2954,7 +2954,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
}
ncvar
->
zaxisID
=
varDefZaxis
(
vlistID
,
zaxisType
,
(
int
)
zsize
,
zvar
,
(
const
char
**
)
zcvals
,
zclength
,
with_bounds
,
lbounds
,
ubounds
,
(
int
)
vctsize
,
vct
,
pname
,
plongname
,
punits
,
z
prec
,
1
,
0
);
(
int
)
vctsize
,
vct
,
pname
,
plongname
,
punits
,
z
datatype
,
1
,
0
);
int
zaxisID
=
ncvar
->
zaxisID
;
...
...
src/zaxis.c
View file @
88c4d967
...
...
@@ -139,7 +139,7 @@ void zaxis_init(zaxis_t *zaxisptr)
zaxisptr
->
positive
=
0
;
zaxisptr
->
scalar
=
0
;
zaxisptr
->
direction
=
0
;
zaxisptr
->
prec
=
0
;
zaxisptr
->
datatype
=
0
;
zaxisptr
->
size
=
0
;
zaxisptr
->
vctsize
=
0
;
zaxisptr
->
vct
=
NULL
;
...
...
@@ -659,13 +659,13 @@ void zaxisInqStdname(int zaxisID, char *stdname)
}
void
zaxisDefDatatype
(
int
zaxisID
,
int
prec
)
void
zaxisDefDatatype
(
int
zaxisID
,
int
datatype
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
if
(
zaxisptr
->
prec
!=
prec
)
if
(
zaxisptr
->
datatype
!=
datatype
)
{
zaxisptr
->
prec
=
prec
;
zaxisptr
->
datatype
=
datatype
;
reshSetStatus
(
zaxisID
,
&
zaxisOps
,
RESH_DESYNC_IN_USE
);
}
}
...
...
@@ -674,7 +674,7 @@ void zaxisDefDatatype(int zaxisID, int prec)
int
zaxisInqDatatype
(
int
zaxisID
)
{
zaxis_t
*
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
return
zaxisptr
->
prec
;
return
zaxisptr
->
datatype
;
}
...
...
@@ -1406,9 +1406,9 @@ void zaxisPrintKernel(zaxis_t *zaxisptr, FILE *fp)
int
zaxisID
=
zaxisptr
->
self
;
int
type
=
zaxisptr
->
type
;
int
nlevels
=
zaxisptr
->
size
;
int
prec
=
zaxisptr
->
prec
;
int
datatype
=
zaxisptr
->
datatype
;
int
dig
=
(
prec
==
CDI_DATATYPE_FLT64
)
?
15
:
7
;
int
dig
=
(
datatype
==
CDI_DATATYPE_FLT64
)
?
15
:
7
;
int
nbyte
;
int
nbyte0
=
0
;
...
...
@@ -1442,7 +1442,7 @@ void zaxisPrintKernel(zaxis_t *zaxisptr, FILE *fp)
if
(
zaxisptr
->
cvals
)
{
dig
=
prec
;
dig
=
datatype
;
nbyte0
=
fprintf
(
fp
,
"types = "
);
nbyte
=
nbyte0
;
for
(
int
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
...
...
@@ -1565,7 +1565,7 @@ int zaxisCompareP(zaxis_t *z1, zaxis_t *z2)
diff
|=
(
z1
->
type
!=
z2
->
type
)
|
(
z1
->
ltype
!=
z2
->
ltype
)
|
(
z1
->
direction
!=
z2
->
direction
)
|
(
z1
->
prec
!=
z2
->
prec
)
|
(
z1
->
datatype
!=
z2
->
datatype
)
|
(
z1
->
size
!=
z2
->
size
)
|
(
z1
->
vctsize
!=
z2
->
vctsize
)
|
(
z1
->
positive
!=
z2
->
positive
);
...
...
@@ -1739,7 +1739,7 @@ zaxisUnpack(char * unpackBuffer, int unpackBufferSize,
=
zaxisNewEntry
(
force_id
?
namespaceAdaptKey
(
intBuffer
[
0
],
originNamespace
)
:
CDI_UNDEFID
);
zaxisP
->
prec
=
intBuffer
[
1
];
zaxisP
->
datatype
=
intBuffer
[
1
];
zaxisP
->
type
=
intBuffer
[
2
];
zaxisP
->
ltype
=
intBuffer
[
3
];
zaxisP
->
size
=
intBuffer
[
4
];
...
...
@@ -1840,7 +1840,7 @@ zaxisPack(void * voidP, void * packBuffer, int packBufferSize,
uint32_t
d
;
intBuffer
[
0
]
=
zaxisP
->
self
;
intBuffer
[
1
]
=
zaxisP
->
prec
;
intBuffer
[
1
]
=
zaxisP
->
datatype
;
intBuffer
[
2
]
=
zaxisP
->
type
;
intBuffer
[
3
]
=
zaxisP
->
ltype
;
intBuffer
[
4
]
=
zaxisP
->
size
;
...
...
src/zaxis.h
View file @
88c4d967
...
...
@@ -26,7 +26,7 @@ typedef struct {
double
*
ubounds
;
double
*
weights
;
int
self
;
int
prec
;
int
datatype
;
int
scalar
;
int
type
;
int
ltype
;
/* GRIB level type */
...
...
tests/test_resource_copy.c
View file @
88c4d967
...
...
@@ -22,7 +22,7 @@ typedef int MPI_Comm;
#endif
enum
{
DOUBLE_PRECISION
=
8
,
DOUBLE_PRECISION
=
CDI_DATATYPE_FLT64
,
nlon
=
12
,
nlat
=
6
,
nlev
=
5
,
...
...
@@ -61,7 +61,7 @@ static int defineGrid (void)
gridDefYname
(
gridID
,
"myYname"
);
gridDefYlongname
(
gridID
,
"myYlongname"
);
gridDefYunits
(
gridID
,
"myYunits"
);
gridDef
Prec
(
gridID
,
DOUBLE_PRECISION
);
gridDef
Datatype
(
gridID
,
DOUBLE_PRECISION
);
gridDefTrunc
(
gridID
,
1
);
gridDefParamGME
(
gridID
,
2
,
3
,
4
,
5
);
gridDefNumber
(
gridID
,
6
);
...
...
@@ -94,7 +94,7 @@ static int defineZaxis (void)
zaxisDefName
(
zaxisID
,
"myName"
);
zaxisDefLongname
(
zaxisID
,
"myLongname"
);
zaxisDefUnits
(
zaxisID
,
"myUnits"
);
zaxisDef
Prec
(
zaxisID
,
DOUBLE_PRECISION
);
zaxisDef
Datatype
(
zaxisID
,
DOUBLE_PRECISION
);
zaxisDefLtype
(
zaxisID
,
1
);
zaxisDefVct
(
zaxisID
,
3
,
vct
);
zaxisDefLbounds
(
zaxisID
,
&
levs
[
0
]
);
...
...
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