Skip to content
GitLab
Menu
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
d51c5435
Commit
d51c5435
authored
Apr 08, 2020
by
Uwe Schulzweida
Browse files
cdfScanVarAttr: fix problem with standard_name attribute.
parent
4eabf6f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
d51c5435
...
...
@@ -4,6 +4,7 @@
2020-03-05 Uwe Schulzweida
* cdfScanVarAttr: fix problem with standard_name attribute
* vlistCopyFlag: init mlevelID with levID2 (bug fix)
2020-02-26 Uwe Schulzweida
...
...
src/stream_cdf_i.c
View file @
d51c5435
...
...
@@ -1168,6 +1168,10 @@ void cdfScanVarAttr(int nvars, ncvar_t *ncvars, int ndims, ncdim_t *ncdims, int
{
memcpy
(
ncvars
[
ncvarid
].
longname
,
attstring
,
attstringsize
);
}
else
if
(
isText
&&
strIsEqual
(
attname
,
"standard_name"
)
)
{
memcpy
(
ncvars
[
ncvarid
].
stdname
,
attstring
,
attstringsize
);
}
else
if
(
isText
&&
strIsEqual
(
attname
,
"units"
)
)
{
memcpy
(
ncvars
[
ncvarid
].
units
,
attstring
,
attstringsize
);
...
...
@@ -1576,10 +1580,12 @@ void cdfVerifyVarAttr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims)
{
cdfScanAttrAxis
(
ncvars
,
ncdims
,
ncvarid
,
strToLower
(
attstring
),
nvdims
,
dimidsp
);
}
/*
else if (strIsEqual(attname, "standard_name"))
{
memcpy(ncvars[ncvarid].stdname, attstring, attstringsize);
}
*/
}
}
}
...
...
@@ -2078,14 +2084,17 @@ void cdf_load_cellarea(size_t size, ncvar_t *ncvar, double **gridarea, struct cd
}
static
void
cdf_copy_axis_attr
(
ncvar_t
*
ncvar
,
struct
gridaxis_t
*
gridaxis
)
void
cdf_copy_
grid_
axis_attr
(
ncvar_t
*
ncvar
,
struct
gridaxis_t
*
gridaxis
)
{
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_NAME
,
(
const
unsigned
char
*
)
ncvar
->
name
,
(
int
)
sizeof
(
ncvar
->
name
)
+
1
);
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_LONGNAME
,
(
const
unsigned
char
*
)
ncvar
->
longname
,
(
int
)
sizeof
(
ncvar
->
longname
)
+
1
);
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_UNITS
,
(
const
unsigned
char
*
)
ncvar
->
units
,
(
int
)
sizeof
(
ncvar
->
units
)
+
1
);
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_NAME
,
(
const
unsigned
char
*
)
ncvar
->
name
,
(
int
)
strlen
(
ncvar
->
name
)
+
1
);
if
(
ncvar
->
longname
[
0
])
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_LONGNAME
,
(
const
unsigned
char
*
)
ncvar
->
longname
,
(
int
)
strlen
(
ncvar
->
longname
)
+
1
);
if
(
ncvar
->
units
[
0
])
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_UNITS
,
(
const
unsigned
char
*
)
ncvar
->
units
,
(
int
)
strlen
(
ncvar
->
units
)
+
1
);
#ifndef USE_MPI
if
(
gridaxis
->
cvals
)
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_STDNAME
,
(
const
unsigned
char
*
)
ncvar
->
stdname
,
(
int
)
sizeof
(
ncvar
->
stdname
)
+
1
);
if
(
ncvar
->
stdname
[
0
])
cdiDefVarKeyBytes
(
&
gridaxis
->
keys
,
CDI_KEY_STDNAME
,
(
const
unsigned
char
*
)
ncvar
->
stdname
,
(
int
)
strlen
(
ncvar
->
stdname
)
+
1
);
#endif
}
...
...
@@ -2225,7 +2234,7 @@ bool cdf_read_xcoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
else
cdf_load_vals
(
size
,
ndims
,
xvarid
,
axisvar
,
&
grid
->
x
.
vals
,
&
lazyGrid
->
xValsGet
,
ntdims
,
start
,
count
);
cdf_copy_axis_attr
(
axisvar
,
&
grid
->
x
);
cdf_copy_
grid_
axis_attr
(
axisvar
,
&
grid
->
x
);
return
false
;
}
...
...
@@ -2296,7 +2305,7 @@ bool cdf_read_ycoord(struct cdfLazyGrid *restrict lazyGrid, ncdim_t *ncdims, ncv
else
cdf_load_vals
(
size
,
ndims
,
yvarid
,
axisvar
,
&
grid
->
y
.
vals
,
&
lazyGrid
->
yValsGet
,
ntdims
,
start
,
count
);
cdf_copy_axis_attr
(
axisvar
,
&
grid
->
y
);
cdf_copy_
grid_
axis_attr
(
axisvar
,
&
grid
->
y
);
return
false
;
}
...
...
@@ -3008,6 +3017,9 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if
(
CDI_cmor_mode
&&
zsize
==
1
&&
zaxisType
!=
ZAXIS_HYBRID
)
zaxisDefScalar
(
zaxisID
);
if
(
ncvar
->
stdname
[
0
])
cdiDefKeyBytes
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_STDNAME
,
(
const
unsigned
char
*
)
ncvar
->
stdname
,
(
int
)
strlen
(
ncvar
->
stdname
)
+
1
);
if
(
uuidOfVGrid
[
0
]
!=
0
)
cdiDefKeyBytes
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_UUID
,
uuidOfVGrid
,
CDI_UUID_SIZE
);
...
...
Write
Preview
Supports
Markdown
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