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
33b3111c
Commit
33b3111c
authored
Jun 03, 2020
by
Uwe Schulzweida
Browse files
Replaced zaxisInqLongname()/zaxisDefLongname() by cdiInqKeyString()/cdiDefKeyString().
parent
e70a08d2
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/printinfo.c
View file @
33b3111c
...
@@ -547,8 +547,10 @@ printZaxisInfo(int vlistID)
...
@@ -547,8 +547,10 @@ printZaxisInfo(int vlistID)
// int dig = (prec == CDI_DATATYPE_FLT64) ? 15 : 7;
// int dig = (prec == CDI_DATATYPE_FLT64) ? 15 : 7;
zaxisName
(
zaxistype
,
zaxisname
);
zaxisName
(
zaxistype
,
zaxisname
);
zaxisInqName
(
zaxisID
,
zname
);
int
length
=
CDI_MAX_NAME
;
zaxisInqUnits
(
zaxisID
,
zunits
);
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
zname
,
&
length
);
length
=
CDI_MAX_NAME
;
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_UNITS
,
zunits
,
&
length
);
zunits
[
12
]
=
0
;
zunits
[
12
]
=
0
;
fprintf
(
stdout
,
" %4d : "
,
vlistZaxisIndex
(
vlistID
,
zaxisID
)
+
1
);
fprintf
(
stdout
,
" %4d : "
,
vlistZaxisIndex
(
vlistID
,
zaxisID
)
+
1
);
...
...
src/cdf_write.c
View file @
33b3111c
...
@@ -655,7 +655,8 @@ void cdfDefineAttrLeveltype(int fileID, int ncvarID, int zaxisID, int zaxistype)
...
@@ -655,7 +655,8 @@ void cdfDefineAttrLeveltype(int fileID, int ncvarID, int zaxisID, int zaxistype)
zaxistype
==
ZAXIS_ATMOSPHERE
)
zaxistype
==
ZAXIS_ATMOSPHERE
)
{
{
char
varname
[
CDI_MAX_NAME
];
char
varname
[
CDI_MAX_NAME
];
zaxisInqName
(
zaxisID
,
varname
);
int
length
=
CDI_MAX_NAME
;
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
varname
,
&
length
);
cdf_put_att_text
(
fileID
,
ncvarID
,
"level_type"
,
strlen
(
varname
),
varname
);
cdf_put_att_text
(
fileID
,
ncvarID
,
"level_type"
,
strlen
(
varname
),
varname
);
}
}
}
}
...
...
src/iterator_fallback.c
View file @
33b3111c
...
@@ -247,20 +247,21 @@ int cdiFallbackIterator_levelType(CdiIterator *super, int levelSelector, char **
...
@@ -247,20 +247,21 @@ int cdiFallbackIterator_levelType(CdiIterator *super, int levelSelector, char **
CdiFallbackIterator
*
me
=
(
CdiFallbackIterator
*
)(
void
*
)
super
;
CdiFallbackIterator
*
me
=
(
CdiFallbackIterator
*
)(
void
*
)
super
;
int
zaxisId
=
vlistInqVarZaxis
(
me
->
vlistId
,
me
->
curVariable
);
int
zaxisId
=
vlistInqVarZaxis
(
me
->
vlistId
,
me
->
curVariable
);
(
void
)
levelSelector
;
(
void
)
levelSelector
;
#define copyString(outPointer,
function
) do \
#define copyString(outPointer,
key
) do \
{ \
{ \
if(outPointer) \
if(outPointer) \
{ \
{ \
char tempBuffer[CDI_MAX_NAME]; \
char tempBuffer[CDI_MAX_NAME]; \
function(zaxisId, tempBuffer); \
int length = CDI_MAX_NAME; \
cdiInqKeyString(zaxisId, CDI_GLOBAL, key, tempBuffer, &length); \
*outPointer = strdup(tempBuffer); \
*outPointer = strdup(tempBuffer); \
} \
} \
} \
} \
while(0)
while(0)
copyString
(
outName
,
zaxisInqName
);
//FIXME: zaxisInqName is unsafe.
copyString
(
outName
,
CDI_KEY_NAME
);
copyString
(
outLongName
,
zaxisInqLongname
);
//FIXME: zaxisInqLongname is unsafe.
copyString
(
outLongName
,
CDI_KEY_LONGNAME
);
copyString
(
outStdName
,
zaxisInqStdname
);
//FIXME: zaxisInqStdname is unsafe.
copyString
(
outStdName
,
CDI_KEY_STDNAME
);
copyString
(
outUnit
,
zaxisInqUnits
);
//FIXME: zaxisInqUnits is unsafe.
copyString
(
outUnit
,
CDI_KEY_UNITS
);
#undef copyString
#undef copyString
int
ltype
=
0
;
int
ltype
=
0
;
cdiInqKeyInt
(
zaxisId
,
CDI_GLOBAL
,
CDI_KEY_TYPEOFFIRSTFIXEDSURFACE
,
&
ltype
);
cdiInqKeyInt
(
zaxisId
,
CDI_GLOBAL
,
CDI_KEY_TYPEOFFIRSTFIXEDSURFACE
,
&
ltype
);
...
...
src/stream_cdf_o.c
View file @
33b3111c
...
@@ -1452,7 +1452,6 @@ static
...
@@ -1452,7 +1452,6 @@ static
void
cdfDefZaxis
(
stream_t
*
streamptr
,
int
zaxisID
)
void
cdfDefZaxis
(
stream_t
*
streamptr
,
int
zaxisID
)
{
{
/* char zaxisname0[CDI_MAX_NAME]; */
/* char zaxisname0[CDI_MAX_NAME]; */
char
axisname
[
CDI_MAX_NAME
];
int
dimID
=
CDI_UNDEFID
;
int
dimID
=
CDI_UNDEFID
;
int
ncvarid
=
CDI_UNDEFID
,
ncbvarid
=
CDI_UNDEFID
;
int
ncvarid
=
CDI_UNDEFID
,
ncbvarid
=
CDI_UNDEFID
;
const
int
xtype
=
zaxisInqDatatype
(
zaxisID
)
==
CDI_DATATYPE_FLT32
?
NC_FLOAT
:
NC_DOUBLE
;
const
int
xtype
=
zaxisInqDatatype
(
zaxisID
)
==
CDI_DATATYPE_FLT32
?
NC_FLOAT
:
NC_DOUBLE
;
...
@@ -1500,7 +1499,9 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
...
@@ -1500,7 +1499,9 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
}
}
}
}
zaxisInqName
(
zaxisID
,
axisname
);
char
axisname
[
CDI_MAX_NAME
];
int
length
=
CDI_MAX_NAME
;
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
axisname
,
&
length
);
if
(
dimID
==
CDI_UNDEFID
)
if
(
dimID
==
CDI_UNDEFID
)
{
{
...
...
src/varscan.c
View file @
33b3111c
...
@@ -853,8 +853,9 @@ bool zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool lbounds, const d
...
@@ -853,8 +853,9 @@ bool zaxisCompare(int zaxisID, int zaxistype, int nlevels, bool lbounds, const d
{
{
if
(
longname
&&
longname
[
0
]
)
if
(
longname
&&
longname
[
0
]
)
{
{
char
zlongname
[
CDI_MAX_NAME
];
zlongname
[
0
]
=
0
;
char
zlongname
[
CDI_MAX_NAME
];
zaxisInqLongname
(
zaxisID
,
zlongname
);
int
length
=
CDI_MAX_NAME
;
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_LONGNAME
,
zlongname
,
&
length
)
if
(
zlongname
[
0
]
&&
(
strcmp
(
longname
,
zlongname
)
!=
0
)
)
differ
=
true
;
if
(
zlongname
[
0
]
&&
(
strcmp
(
longname
,
zlongname
)
!=
0
)
)
differ
=
true
;
}
}
if
(
units
&&
units
[
0
]
)
if
(
units
&&
units
[
0
]
)
...
@@ -972,7 +973,7 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, c
...
@@ -972,7 +973,7 @@ int varDefZaxis(int vlistID, int zaxistype, int nlevels, const double *levels, c
zaxisDefVct
(
zaxisID
,
vctsize
,
vct
);
zaxisDefVct
(
zaxisID
,
vctsize
,
vct
);
if
(
name
&&
name
[
0
]
)
cdiDefKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
name
);
if
(
name
&&
name
[
0
]
)
cdiDefKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
name
);
if
(
longname
&&
longname
[
0
]
)
zaxisDefLongname
(
zaxisID
,
longname
);
if
(
longname
&&
longname
[
0
]
)
cdiDefKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_LONGNAME
,
longname
);
if
(
units
&&
units
[
0
]
)
zaxisDefUnits
(
zaxisID
,
units
);
if
(
units
&&
units
[
0
]
)
zaxisDefUnits
(
zaxisID
,
units
);
zaxisDefDatatype
(
zaxisID
,
prec
);
zaxisDefDatatype
(
zaxisID
,
prec
);
cdiDefKeyInt
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_TYPEOFFIRSTFIXEDSURFACE
,
ltype1
);
cdiDefKeyInt
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_TYPEOFFIRSTFIXEDSURFACE
,
ltype1
);
...
...
src/vlist.c
View file @
33b3111c
...
@@ -596,7 +596,6 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
...
@@ -596,7 +596,6 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
double
*
levels
=
NULL
;
double
*
levels
=
NULL
;
double
*
lbounds
=
NULL
,
*
ubounds
=
NULL
;
double
*
lbounds
=
NULL
,
*
ubounds
=
NULL
;
const
double
*
vct
=
NULL
;
const
double
*
vct
=
NULL
;
char
ctemp
[
CDI_MAX_NAME
];
if
(
!
vars1
[
varID
].
levinfo
)
cdiVlistCreateVarLevInfo
(
vlistptr1
,
varID
);
if
(
!
vars1
[
varID
].
levinfo
)
cdiVlistCreateVarLevInfo
(
vlistptr1
,
varID
);
...
@@ -690,10 +689,13 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
...
@@ -690,10 +689,13 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
Free
(
cvals2
);
Free
(
cvals2
);
}
}
zaxisInqName
(
zaxisID
,
ctemp
);
char
ctemp
[
CDI_MAX_NAME
];
int
length
=
CDI_MAX_NAME
;
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
ctemp
,
&
length
);
cdiDefKeyString
(
zaxisID2
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
ctemp
);
cdiDefKeyString
(
zaxisID2
,
CDI_GLOBAL
,
CDI_KEY_NAME
,
ctemp
);
zaxisInqLongname
(
zaxisID
,
ctemp
);
length
=
CDI_MAX_NAME
;
zaxisDefLongname
(
zaxisID2
,
ctemp
);
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_LONGNAME
,
ctemp
,
&
length
);
cdiDefKeyString
(
zaxisID2
,
CDI_GLOBAL
,
CDI_KEY_LONGNAME
,
ctemp
);
zaxisInqUnits
(
zaxisID
,
ctemp
);
zaxisInqUnits
(
zaxisID
,
ctemp
);
zaxisDefUnits
(
zaxisID2
,
ctemp
);
zaxisDefUnits
(
zaxisID2
,
ctemp
);
zaxisDefDatatype
(
zaxisID2
,
zaxisInqDatatype
(
zaxisID
));
zaxisDefDatatype
(
zaxisID2
,
zaxisInqDatatype
(
zaxisID
));
...
@@ -702,7 +704,7 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
...
@@ -702,7 +704,7 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
if
(
zaxisType
==
ZAXIS_CHAR
)
if
(
zaxisType
==
ZAXIS_CHAR
)
{
{
char
dimname
[
CDI_MAX_NAME
+
3
];
char
dimname
[
CDI_MAX_NAME
+
3
];
int
length
=
sizeof
(
dimname
);
length
=
sizeof
(
dimname
);
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_DIMNAME
,
dimname
,
&
length
);
cdiInqKeyString
(
zaxisID
,
CDI_GLOBAL
,
CDI_KEY_DIMNAME
,
dimname
,
&
length
);
if
(
dimname
[
0
]
==
0
)
{
memcpy
(
dimname
,
"area_type"
,
10
);
dimname
[
10
]
=
0
;
}
if
(
dimname
[
0
]
==
0
)
{
memcpy
(
dimname
,
"area_type"
,
10
);
dimname
[
10
]
=
0
;
}
cdiDefKeyString
(
zaxisID2
,
CDI_GLOBAL
,
CDI_KEY_DIMNAME
,
dimname
);
cdiDefKeyString
(
zaxisID2
,
CDI_GLOBAL
,
CDI_KEY_DIMNAME
,
dimname
);
...
...
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