Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
67e304ba
Commit
67e304ba
authored
Nov 05, 2019
by
Uwe Schulzweida
Browse files
Added support for datatype of grid mapping var.
parent
b286f3b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf_i.c
View file @
67e304ba
...
...
@@ -2768,8 +2768,8 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
{
const
int
projID
=
lgrid
?
grid
->
proj
:
gridID
;
const
int
ncid
=
ncvars
[
gmapvarid
].
ncid
;
const
int
gmapvartype
=
cdfInqDatatype
(
ncvars
[
gmapvarid
].
xtype
,
ncvars
[
gmapvarid
].
lunsigned
)
;
if
(
gmapvartype
!=
-
1
)
cdiDefKeyInt
(
projID
,
CDI_GLOBAL
,
CDI_KEY_GRIDMAP_VARTYPE
,
gmapvartype
);
const
int
gmapvartype
=
ncvars
[
gmapvarid
].
xtype
;
cdiDefKeyInt
(
projID
,
CDI_GLOBAL
,
CDI_KEY_GRIDMAP_VARTYPE
,
gmapvartype
);
const
char
*
gmapvarname
=
ncvars
[
gmapvarid
].
name
;
cdf_read_mapping_atts
(
ncid
,
gmapvarid
,
projID
,
gmapvarname
);
cdiGridDefKeyStr
(
projID
,
CDI_KEY_GRIDMAP_VARNAME
,
(
int
)(
strlen
(
gmapvarname
)
+
1
),
gmapvarname
);
...
...
src/stream_cdf_o.c
View file @
67e304ba
...
...
@@ -1624,7 +1624,7 @@ void cdf_def_mapping(stream_t *streamptr, int gridID)
nc_type
gmapvartype
=
NC_INT
;
int
datatype
=
-
1
;
int
status
=
cdiInqKeyInt
(
gridID
,
CDI_GLOBAL
,
CDI_KEY_GRIDMAP_VARTYPE
,
&
datatype
);
if
(
status
==
CDI_NOERR
)
gmapvartype
=
cdfDefData
type
(
datatype
,
streamptr
)
;
if
(
status
==
CDI_NOERR
)
gmapvartype
=
(
nc_
type
)
datatype
;
char
gmapvarname
[
CDI_MAX_NAME
];
gmapvarname
[
0
]
=
0
;
cdiGridInqKeyStr
(
gridID
,
CDI_KEY_GRIDMAP_VARNAME
,
CDI_MAX_NAME
,
gmapvarname
);
...
...
@@ -1638,7 +1638,7 @@ void cdf_def_mapping(stream_t *streamptr, int gridID)
cdf_enddef
(
fileID
);
if
(
ncerrcode
==
NC_NOERR
)
if
(
ncerrcode
==
NC_NOERR
&&
gmapvartype
!=
NC_CHAR
)
{
int
dummy
=
1
;
cdf_put_var_int
(
fileID
,
ncvarid
,
&
dummy
);
...
...
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