Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
b6cad026
Commit
b6cad026
authored
7 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
cdfDefDatatype(): changed interface.
parent
cb41b907
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cdf_write.c
+13
-10
13 additions, 10 deletions
src/cdf_write.c
src/stream_cdf.h
+1
-1
1 addition, 1 deletion
src/stream_cdf.h
src/stream_cdf_o.c
+2
-2
2 additions, 2 deletions
src/stream_cdf_o.c
with
16 additions
and
13 deletions
src/cdf_write.c
+
13
−
10
View file @
b6cad026
...
...
@@ -39,29 +39,30 @@ void cdfDefVarDeflate(int ncid, int ncvarid, int deflate_level)
}
int
cdfDefDatatype
(
int
datatype
,
int
filetype
)
int
cdfDefDatatype
(
int
datatype
,
stream_t
*
streamptr
)
{
int
xtype
=
NC_FLOAT
;
if
(
datatype
==
CDI_DATATYPE_CPX32
||
datatype
==
CDI_DATATYPE_CPX64
)
Error
(
"CDI library does not support complex numbers with NetCDF!"
);
if
(
filetype
==
CDI_FILETYPE_NC4
)
if
(
streamptr
->
filetype
==
CDI_FILETYPE_NC4
)
{
if
(
datatype
==
CDI_DATATYPE_INT8
)
xtype
=
NC_BYTE
;
else
if
(
datatype
==
CDI_DATATYPE_INT16
)
xtype
=
NC_SHORT
;
else
if
(
datatype
==
CDI_DATATYPE_INT32
)
xtype
=
NC_INT
;
#if
def
ined
(
HAVE_NETCDF4
)
#ifdef HAVE_NETCDF4
else
if
(
datatype
==
CDI_DATATYPE_UINT8
)
xtype
=
NC_UBYTE
;
else
if
(
datatype
==
CDI_DATATYPE_UINT16
)
xtype
=
NC_USHORT
;
else
if
(
datatype
==
CDI_DATATYPE_UINT32
)
xtype
=
NC_UINT
;
else
if
(
datatype
==
CDI_DATATYPE_CPX32
||
datatype
==
CDI_DATATYPE_CPX64
)
Error
(
"CDI library does not support complex numbers with NetCDF!"
);
#else
else
if
(
datatype
==
CDI_DATATYPE_UINT8
)
xtype
=
NC_SHORT
;
else
if
(
datatype
==
CDI_DATATYPE_UINT16
)
xtype
=
NC_INT
;
else
if
(
datatype
==
CDI_DATATYPE_UINT32
)
xtype
=
NC_INT
;
else
if
(
datatype
==
CDI_DATATYPE_CPX32
||
datatype
==
CDI_DATATYPE_CPX64
)
Error
(
"CDI library does not support complex numbers with NetCDF4 classic!"
);
#endif
else
if
(
datatype
==
CDI_DATATYPE_FLT64
)
xtype
=
NC_DOUBLE
;
else
xtype
=
NC_FLOAT
;
else
if
(
datatype
==
CDI_DATATYPE_FLT32
)
xtype
=
NC_FLOAT
;
}
else
{
...
...
@@ -72,7 +73,9 @@ int cdfDefDatatype(int datatype, int filetype)
else
if
(
datatype
==
CDI_DATATYPE_UINT16
)
xtype
=
NC_INT
;
else
if
(
datatype
==
CDI_DATATYPE_UINT32
)
xtype
=
NC_INT
;
else
if
(
datatype
==
CDI_DATATYPE_FLT64
)
xtype
=
NC_DOUBLE
;
else
xtype
=
NC_FLOAT
;
else
if
(
datatype
==
CDI_DATATYPE_FLT32
)
xtype
=
NC_FLOAT
;
else
if
(
datatype
==
CDI_DATATYPE_CPX32
||
datatype
==
CDI_DATATYPE_CPX64
)
Error
(
"CDI library does not support complex numbers with NetCDF classic!"
);
}
return
xtype
;
...
...
@@ -90,7 +93,7 @@ void cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck)
if
(
lcheck
&&
streamptr
->
ncmode
==
2
)
cdf_redef
(
fileID
);
int
xtype
=
cdfDefDatatype
(
dtype
,
streamptr
->
filetype
);
int
xtype
=
cdfDefDatatype
(
dtype
,
streamptr
);
if
(
xtype
==
NC_BYTE
&&
missval
>
127
&&
missval
<
256
)
xtype
=
NC_INT
;
...
...
@@ -514,7 +517,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
/* if ( streamptr->ncmode == 2 ) cdf_redef(fileID); */
int
dtype
=
vlistInqVarDatatype
(
vlistID
,
varID
);
int
xtype
=
cdfDefDatatype
(
dtype
,
streamptr
->
filetype
);
int
xtype
=
cdfDefDatatype
(
dtype
,
streamptr
);
cdf_def_var
(
fileID
,
name
,
(
nc_type
)
xtype
,
ndims
,
dims
,
&
ncvarid
);
...
...
This diff is collapsed.
Click to expand it.
src/stream_cdf.h
+
1
−
1
View file @
b6cad026
...
...
@@ -35,7 +35,7 @@ void cdfDefTime(stream_t* streamptr);
void
cdf_scale_add
(
size_t
size
,
double
*
data
,
double
addoffset
,
double
scalefactor
);
int
cdfDefDatatype
(
int
datatype
,
int
filetype
);
int
cdfDefDatatype
(
int
datatype
,
stream_t
*
streamptr
);
#endif
/*
...
...
This diff is collapsed.
Click to expand it.
src/stream_cdf_o.c
+
2
−
2
View file @
b6cad026
...
...
@@ -452,7 +452,7 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
int
nvdimID
=
CDI_UNDEFID
;
int
fileID
=
streamptr
->
fileID
;
size_t
dimlen
=
gridAxisInq
->
axisSize
(
gridID
);
nc_type
xtype
=
(
nc_type
)
cdfDefDatatype
(
gridInqDatatype
(
gridID
),
streamptr
->
filetype
);
nc_type
xtype
=
(
nc_type
)
cdfDefDatatype
(
gridInqDatatype
(
gridID
),
streamptr
);
ncgrid_t
*
ncgrid
=
streamptr
->
ncgrid
;
...
...
@@ -663,7 +663,7 @@ cdfDefIrregularGridCommon(stream_t *streamptr, int gridID,
size_t
nvertex
,
const
char
*
vdimname_default
,
bool
setVdimname
)
{
nc_type
xtype
=
(
nc_type
)
cdfDefDatatype
(
gridInqDatatype
(
gridID
),
streamptr
->
filetype
);
nc_type
xtype
=
(
nc_type
)
cdfDefDatatype
(
gridInqDatatype
(
gridID
),
streamptr
);
int
xdimID
=
CDI_UNDEFID
;
int
ydimID
=
CDI_UNDEFID
;
int
ncxvarid
=
CDI_UNDEFID
,
ncyvarid
=
CDI_UNDEFID
,
ncavarid
=
CDI_UNDEFID
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment