Commit 80737277 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced cdiZaxisDefKeyStr() by cdiDefKeyString() for CDI_KEY_DIMNAME.

parent d2f2c891
......@@ -471,8 +471,8 @@ static void
printZaxisHybridInfo(const int zaxisID)
{
char psname[CDI_MAX_NAME];
psname[0] = 0;
cdiZaxisInqKeyStr(zaxisID, CDI_KEY_PSNAME, CDI_MAX_NAME, psname);
int length = CDI_MAX_NAME;
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_PSNAME, psname, &length);
const int vctsize = zaxisInqVctSize(zaxisID);
if (vctsize || psname[0])
{
......
......@@ -51,6 +51,15 @@ Define an integer attribute.
Define a text attribute.
\section*{\tt \htmlref{cdiDefKeyFloat}{cdiDefKeyFloat}}
\begin{verbatim}
int cdiDefKeyFloat (int cdiID, int varID, int key, double value);
\end{verbatim}
Define a float value from a key of a CDI variable.
\section*{\tt \htmlref{cdiDefKeyInt}{cdiDefKeyInt}}
\begin{verbatim}
......@@ -143,42 +152,6 @@ Get a string value from a key of a CDI variable.
Get number of attributes assigned to this variable.
\section*{\tt \htmlref{cdiZaxisDefKeyFlt}{cdiZaxisDefKeyFlt}}
\begin{verbatim}
int cdiZaxisDefKeyFlt (int zaxisID, int key, double value);
\end{verbatim}
Define a CDI Z-axis floating point value from a key.
\section*{\tt \htmlref{cdiZaxisDefKeyStr}{cdiZaxisDefKeyStr}}
\begin{verbatim}
int cdiZaxisDefKeyStr (int zaxisID, int key, int size, const char *mesg);
\end{verbatim}
Define a CDI Z-axis string value from a key.
\section*{\tt \htmlref{cdiZaxisInqKeyFlt}{cdiZaxisInqKeyFlt}}
\begin{verbatim}
int cdiZaxisInqKeyFlt (int zaxisID, int key, double *value);
\end{verbatim}
Get a CDI Z-axis floating point value from a key.
\section*{\tt \htmlref{cdiZaxisInqKeyStr}{cdiZaxisInqKeyStr}}
\begin{verbatim}
int cdiZaxisInqKeyStr (int zaxisID, int key, int size, char *mesg);
\end{verbatim}
Get a CDI Z-axis string value from a key.
\section*{\tt \htmlref{gridCreate}{gridCreate}}
\begin{verbatim}
......
......@@ -51,6 +51,16 @@ Define an integer attribute.
Define a text attribute.
\section*{\tt \htmlref{cdiDefKeyFloat}{cdiDefKeyFloat}}
\begin{verbatim}
INTEGER FUNCTION cdiDefKeyFloat (INTEGER cdiID, INTEGER varID, INTEGER key,
DOUBLEPRECISION value)
\end{verbatim}
Define a float value from a key of a CDI variable.
\section*{\tt \htmlref{cdiDefKeyInt}{cdiDefKeyInt}}
\begin{verbatim}
......@@ -150,46 +160,6 @@ Get a string value from a key of a CDI variable.
Get number of attributes assigned to this variable.
\section*{\tt \htmlref{cdiZaxisDefKeyFlt}{cdiZaxisDefKeyFlt}}
\begin{verbatim}
INTEGER FUNCTION cdiZaxisDefKeyFlt (INTEGER zaxisID, INTEGER key,
DOUBLEPRECISION value)
\end{verbatim}
Define a CDI Z-axis floating point value from a key.
\section*{\tt \htmlref{cdiZaxisDefKeyStr}{cdiZaxisDefKeyStr}}
\begin{verbatim}
INTEGER FUNCTION cdiZaxisDefKeyStr (INTEGER zaxisID, INTEGER key, INTEGER size,
CHARACTER*(*) mesg)
\end{verbatim}
Define a CDI Z-axis string value from a key.
\section*{\tt \htmlref{cdiZaxisInqKeyFlt}{cdiZaxisInqKeyFlt}}
\begin{verbatim}
INTEGER FUNCTION cdiZaxisInqKeyFlt (INTEGER zaxisID, INTEGER key,
DOUBLEPRECISION value)
\end{verbatim}
Get a CDI Z-axis floating point value from a key.
\section*{\tt \htmlref{cdiZaxisInqKeyStr}{cdiZaxisInqKeyStr}}
\begin{verbatim}
INTEGER FUNCTION cdiZaxisInqKeyStr (INTEGER zaxisID, INTEGER key, INTEGER size,
CHARACTER*(*) mesg)
\end{verbatim}
Get a CDI Z-axis string value from a key.
\section*{\tt \htmlref{gridCreate}{gridCreate}}
\begin{verbatim}
......
......@@ -808,6 +808,20 @@ size_t gridInqYCvals(int gridID, char *ycvals[]);
#define CDI_KEY_CONSTITUENTTYPE 822 // GRIB2 constituentType
#define CDI_KEY_TYPEOFTIMEINCREMENT 823 // GRIB2 typeOfTimeIncrement
#define CDI_KEY_VDIMNAME 920 // Vertex dimension name
#define CDI_KEY_GRIDMAP_VARTYPE 921 // Grid mapping var datatype
#define CDI_KEY_GRIDMAP_VARNAME 922 // Grid mapping var name
#define CDI_KEY_GRIDMAP_NAME 923 // Grid mapping name
#define CDI_KEY_DIMNAME 941 // Dimension name
#define CDI_KEY_NAME 942 // Variable name
#define CDI_KEY_LONGNAME 943 // Long name of the variable
#define CDI_KEY_STDNAME 944 // CF Standard name of the variable
#define CDI_KEY_UNITS 945 // Units of the variable
#define CDI_KEY_PSNAME 950 // Z-axis surface pressure name
#define CDI_KEY_P0NAME 951 // Z-axis reference pressure name
#define CDI_KEY_P0VALUE 952 // Z-axis reference pressure in Pa
// cdiDefKeyInt: Define an integer value from a key of a CDI variable
int cdiDefKeyInt(int cdiID, int varID, int key, int value);
......@@ -837,27 +851,7 @@ int cdiInqKeyLen(int cdiID, int varID, int key, int *length);
int cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2);
// CDI grid keys
#define CDI_KEY_VDIMNAME 920 // Vertex dimension name
#define CDI_KEY_GRIDMAP_VARTYPE 921 // Grid mapping var datatype
#define CDI_KEY_GRIDMAP_VARNAME 922 // Grid mapping var name
#define CDI_KEY_GRIDMAP_NAME 923 // Grid mapping name
// CDI zaxis keys
#define CDI_KEY_DIMNAME 941 // Dimension name
#define CDI_KEY_NAME 942 // Variable name
#define CDI_KEY_LONGNAME 943 // Long name of the variable
#define CDI_KEY_STDNAME 944 // CF Standard name of the variable
#define CDI_KEY_UNITS 945 // Units of the variable
#define CDI_KEY_PSNAME 950 // Z-axis surface pressure name
#define CDI_KEY_P0NAME 951 // Z-axis reference pressure name
#define CDI_KEY_P0VALUE 952 // Z-axis reference pressure in Pa
// cdiZaxisDefKeyStr: Define a CDI Z-axis string value from a key
int cdiZaxisDefKeyStr(int zaxisID, int key, int size, const char *mesg);
// cdiZaxisInqKeyStr: Get a CDI Z-axis string value from a key
int cdiZaxisInqKeyStr(int zaxisID, int key, int size, char *mesg);
// GRID routines
// gridDefXname: Define the name of a X-axis
void gridDefXname(int gridID, const char *xname);
......
......@@ -1610,6 +1610,30 @@
PARAMETER (CDI_KEY_CONSTITUENTTYPE = 822)
INTEGER CDI_KEY_TYPEOFTIMEINCREMENT
PARAMETER (CDI_KEY_TYPEOFTIMEINCREMENT = 823)
INTEGER CDI_KEY_VDIMNAME
PARAMETER (CDI_KEY_VDIMNAME = 920)
INTEGER CDI_KEY_GRIDMAP_VARTYPE
PARAMETER (CDI_KEY_GRIDMAP_VARTYPE = 921)
INTEGER CDI_KEY_GRIDMAP_VARNAME
PARAMETER (CDI_KEY_GRIDMAP_VARNAME = 922)
INTEGER CDI_KEY_GRIDMAP_NAME
PARAMETER (CDI_KEY_GRIDMAP_NAME = 923)
INTEGER CDI_KEY_DIMNAME
PARAMETER (CDI_KEY_DIMNAME = 941)
INTEGER CDI_KEY_NAME
PARAMETER (CDI_KEY_NAME = 942)
INTEGER CDI_KEY_LONGNAME
PARAMETER (CDI_KEY_LONGNAME = 943)
INTEGER CDI_KEY_STDNAME
PARAMETER (CDI_KEY_STDNAME = 944)
INTEGER CDI_KEY_UNITS
PARAMETER (CDI_KEY_UNITS = 945)
INTEGER CDI_KEY_PSNAME
PARAMETER (CDI_KEY_PSNAME = 950)
INTEGER CDI_KEY_P0NAME
PARAMETER (CDI_KEY_P0NAME = 951)
INTEGER CDI_KEY_P0VALUE
PARAMETER (CDI_KEY_P0VALUE = 952)
INTEGER cdiDefKeyInt
! (INTEGER cdiID,
! INTEGER varID,
......@@ -1624,6 +1648,23 @@
! INTEGER value)
EXTERNAL cdiInqKeyInt
INTEGER cdiDefKeyFloat
! (INTEGER cdiID,
! INTEGER varID,
! INTEGER key,
! DOUBLEPRECISION value)
EXTERNAL cdiDefKeyFloat
!
! cdiInqKeyFloat Get a float value from a key of a CDI variable
!
INTEGER cdiInqKeyFloat
! (INTEGER cdiID,
! INTEGER varID,
! INTEGER key,
! DOUBLEPRECISION value)
EXTERNAL cdiInqKeyFloat
INTEGER cdiDefKeyString
! (INTEGER cdiID,
! INTEGER varID,
......@@ -1654,59 +1695,8 @@
EXTERNAL cdiCopyKeys
!
! CDI grid keys
!
INTEGER CDI_KEY_VDIMNAME
PARAMETER (CDI_KEY_VDIMNAME = 920)
INTEGER CDI_KEY_GRIDMAP_VARTYPE
PARAMETER (CDI_KEY_GRIDMAP_VARTYPE = 921)
INTEGER CDI_KEY_GRIDMAP_VARNAME
PARAMETER (CDI_KEY_GRIDMAP_VARNAME = 922)
INTEGER CDI_KEY_GRIDMAP_NAME
PARAMETER (CDI_KEY_GRIDMAP_NAME = 923)
!
! CDI zaxis keys
! GRID routines
!
INTEGER CDI_KEY_DIMNAME
PARAMETER (CDI_KEY_DIMNAME = 941)
INTEGER CDI_KEY_NAME
PARAMETER (CDI_KEY_NAME = 942)
INTEGER CDI_KEY_LONGNAME
PARAMETER (CDI_KEY_LONGNAME = 943)
INTEGER CDI_KEY_UNITS
PARAMETER (CDI_KEY_UNITS = 944)
INTEGER CDI_KEY_PSNAME
PARAMETER (CDI_KEY_PSNAME = 950)
INTEGER CDI_KEY_P0NAME
PARAMETER (CDI_KEY_P0NAME = 951)
INTEGER CDI_KEY_P0VALUE
PARAMETER (CDI_KEY_P0VALUE = 952)
INTEGER cdiZaxisDefKeyStr
! (INTEGER zaxisID,
! INTEGER key,
! INTEGER size,
! CHARACTER*(*) mesg)
EXTERNAL cdiZaxisDefKeyStr
INTEGER cdiZaxisInqKeyStr
! (INTEGER zaxisID,
! INTEGER key,
! INTEGER size,
! CHARACTER*(*) mesg)
EXTERNAL cdiZaxisInqKeyStr
INTEGER cdiZaxisDefKeyFlt
! (INTEGER zaxisID,
! INTEGER key,
! DOUBLEPRECISION value)
EXTERNAL cdiZaxisDefKeyFlt
INTEGER cdiZaxisInqKeyFlt
! (INTEGER zaxisID,
! INTEGER key,
! DOUBLEPRECISION value)
EXTERNAL cdiZaxisInqKeyFlt
! gridDefXname
! (INTEGER gridID,
! CHARACTER*(*) xname)
......
......@@ -534,20 +534,18 @@ FCALLSCFUN1 (INT, gridInqYIsc, GRIDINQYISC, gridinqyisc, INT)
FCALLSCFUN4 (INT, cdiDefKeyInt, CDIDEFKEYINT, cdidefkeyint, INT, INT, INT, INT)
FCALLSCFUN4 (INT, cdiInqKeyInt, CDIINQKEYINT, cdiinqkeyint, INT, INT, INT, PINT)
FCALLSCFUN4 (INT, cdiDefKeyFloat, CDIDEFKEYFLOAT, cdidefkeyfloat, INT, INT, INT, DOUBLE)
/* cdiInqKeyFloat Get a float value from a key of a CDI variable */
FCALLSCFUN4 (INT, cdiInqKeyFloat, CDIINQKEYFLOAT, cdiinqkeyfloat, INT, INT, INT, PDOUBLE)
FCALLSCFUN4 (INT, cdiDefKeyString, CDIDEFKEYSTRING, cdidefkeystring, INT, INT, INT, STRING)
FCALLSCFUN5 (INT, cdiInqKeyString, CDIINQKEYSTRING, cdiinqkeystring, INT, INT, INT, PSTRING, PINT)
FCALLSCFUN4 (INT, cdiInqKeyLen, CDIINQKEYLEN, cdiinqkeylen, INT, INT, INT, PINT)
FCALLSCFUN4 (INT, cdiCopyKeys, CDICOPYKEYS, cdicopykeys, INT, INT, INT, INT)
/* CDI grid keys */
/* CDI zaxis keys */
/* GRID routines */
FCALLSCFUN4 (INT, cdiZaxisDefKeyStr, CDIZAXISDEFKEYSTR, cdizaxisdefkeystr, INT, INT, INT, STRING)
FCALLSCFUN4 (INT, cdiZaxisInqKeyStr, CDIZAXISINQKEYSTR, cdizaxisinqkeystr, INT, INT, INT, PSTRING)
FCALLSCFUN3 (INT, cdiZaxisDefKeyFlt, CDIZAXISDEFKEYFLT, cdizaxisdefkeyflt, INT, INT, DOUBLE)
FCALLSCFUN3 (INT, cdiZaxisInqKeyFlt, CDIZAXISINQKEYFLT, cdizaxisinqkeyflt, INT, INT, PDOUBLE)
FCALLSCSUB2 (gridDefXname, GRIDDEFXNAME, griddefxname, INT, STRING)
FCALLSCSUB2 (gridInqXname, GRIDINQXNAME, gridinqxname, INT, PSTRING)
FCALLSCSUB2 (gridDefXlongname, GRIDDEFXLONGNAME, griddefxlongname, INT, STRING)
......
......@@ -481,14 +481,6 @@ module mo_cdi
integer(c_int), public, parameter :: CDI_KEY_UVRELATIVETOGRID = 821
integer(c_int), public, parameter :: CDI_KEY_CONSTITUENTTYPE = 822
integer(c_int), public, parameter :: CDI_KEY_TYPEOFTIMEINCREMENT = 823
public :: cdiDefKeyInt
public :: cdiInqKeyInt
public :: cdiDefKeyBytes
public :: cdiInqKeyBytes
public :: cdiDefKeyString
public :: cdiInqKeyString
public :: cdiInqKeyLen
public :: cdiCopyKeys
integer(c_int), public, parameter :: CDI_KEY_VDIMNAME = 920
integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARTYPE = 921
integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARNAME = 922
......@@ -496,14 +488,21 @@ module mo_cdi
integer(c_int), public, parameter :: CDI_KEY_DIMNAME = 941
integer(c_int), public, parameter :: CDI_KEY_NAME = 942
integer(c_int), public, parameter :: CDI_KEY_LONGNAME = 943
integer(c_int), public, parameter :: CDI_KEY_UNITS = 944
integer(c_int), public, parameter :: CDI_KEY_STDNAME = 944
integer(c_int), public, parameter :: CDI_KEY_UNITS = 945
integer(c_int), public, parameter :: CDI_KEY_PSNAME = 950
integer(c_int), public, parameter :: CDI_KEY_P0NAME = 951
integer(c_int), public, parameter :: CDI_KEY_P0VALUE = 952
public :: cdiZaxisDefKeyStr
public :: cdiZaxisInqKeyStr
public :: cdiZaxisDefKeyFlt
public :: cdiZaxisInqKeyFlt
public :: cdiDefKeyInt
public :: cdiInqKeyInt
public :: cdiDefKeyFloat
public :: cdiInqKeyFloat
public :: cdiDefKeyBytes
public :: cdiInqKeyBytes
public :: cdiDefKeyString
public :: cdiInqKeyString
public :: cdiInqKeyLen
public :: cdiCopyKeys
public :: gridDefXname
public :: gridInqXname
public :: gridDefXlongname
......@@ -1957,6 +1956,26 @@ module mo_cdi
integer(c_int) :: f_result
end function cdiInqKeyInt
function cdiDefKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)&
& bind(c, name = 'cdiDefKeyFloat') result(f_result)
import c_double, c_int
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
real(c_double), value :: value_dummy
integer(c_int) :: f_result
end function cdiDefKeyFloat
function cdiInqKeyFloat(cdiID_dummy, varID_dummy, key_dummy, value_dummy)&
& bind(c, name = 'cdiInqKeyFloat') result(f_result)
import c_double, c_int
integer(c_int), value :: cdiID_dummy
integer(c_int), value :: varID_dummy
integer(c_int), value :: key_dummy
real(c_double), intent(inout) :: value_dummy
integer(c_int) :: f_result
end function cdiInqKeyFloat
function cdiDefKeyBytes(cdiID_dummy, varID_dummy, key_dummy, bytes_dummy,&
& length_dummy) bind(c, name = 'cdiDefKeyBytes') result(f_result)
import c_int, c_signed_char
......@@ -1999,24 +2018,6 @@ module mo_cdi
integer(c_int) :: f_result
end function cdiCopyKeys
function cdiZaxisDefKeyFlt(zaxisID_dummy, key_dummy, value_dummy) bind(c,&
& name = 'cdiZaxisDefKeyFlt') result(f_result)
import c_double, c_int
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
real(c_double), value :: value_dummy
integer(c_int) :: f_result
end function cdiZaxisDefKeyFlt
function cdiZaxisInqKeyFlt(zaxisID_dummy, key_dummy, value_dummy) bind(c,&
& name = 'cdiZaxisInqKeyFlt') result(f_result)
import c_double, c_int
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
real(c_double), intent(inout) :: value_dummy
integer(c_int) :: f_result
end function cdiZaxisInqKeyFlt
subroutine gridDefDatatype(gridID_dummy, prec_dummy) bind(c, name =&
& 'gridDefDatatype')
import c_int
......@@ -5040,73 +5041,6 @@ contains
end do
end function cdiInqKeyString
function cdiZaxisDefKeyStr(zaxisID_dummy, key_dummy, size_dummy, mesg_dummy)&
& result(f_result)
integer(c_int) :: f_result
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
integer(c_int), value :: size_dummy
character(kind = c_char, len = *), intent(in) :: mesg_dummy
character(kind = c_char) :: mesg_temp(len(mesg_dummy) + 1)
integer :: mesg_i
interface
function lib_cdiZaxisDefKeyStr(zaxisID_dummy, key_dummy, size_dummy,&
& mesg_dummy) bind(c, name = 'cdiZaxisDefKeyStr') result(c_result)
import c_char, c_int
integer(c_int) :: c_result
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
integer(c_int), value :: size_dummy
character(kind = c_char) :: mesg_dummy(*)
end function lib_cdiZaxisDefKeyStr
end interface
do mesg_i = 1, len(mesg_dummy)
mesg_temp(mesg_i) = mesg_dummy(mesg_i:mesg_i)
end do
mesg_temp(len(mesg_dummy) + 1) = c_null_char
f_result = lib_cdiZaxisDefKeyStr(zaxisID_dummy, key_dummy, size_dummy,&
& mesg_temp)
end function cdiZaxisDefKeyStr
function cdiZaxisInqKeyStr(zaxisID_dummy, key_dummy, size_dummy, mesg_dummy)&
& result(f_result)
integer(c_int) :: f_result
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
integer(c_int), value :: size_dummy
character(kind = c_char, len = *), intent(inout) :: mesg_dummy
character(kind = c_char) :: mesg_temp(len(mesg_dummy) + 1)
integer :: mesg_i
interface
function lib_cdiZaxisInqKeyStr(zaxisID_dummy, key_dummy, size_dummy,&
& mesg_dummy) bind(c, name = 'cdiZaxisInqKeyStr') result(c_result)
import c_char, c_int
integer(c_int) :: c_result
integer(c_int), value :: zaxisID_dummy
integer(c_int), value :: key_dummy
integer(c_int), value :: size_dummy
character(kind = c_char) :: mesg_dummy(*)
end function lib_cdiZaxisInqKeyStr
end interface
mesg_temp(len(mesg_dummy) + 1) = c_null_char
do mesg_i = len(mesg_dummy), 1, -1
if(mesg_dummy(mesg_i:mesg_i) /= ' ') exit
mesg_temp(mesg_i) = c_null_char
end do
do mesg_i = mesg_i, 1, -1
mesg_temp(mesg_i) = mesg_dummy(mesg_i:mesg_i)
end do
f_result = lib_cdiZaxisInqKeyStr(zaxisID_dummy, key_dummy, size_dummy,&
& mesg_temp)
do mesg_i = 1, len(mesg_dummy)
if(mesg_temp(mesg_i) == c_null_char) exit
mesg_dummy(mesg_i:mesg_i) = mesg_temp(mesg_i)
end do
do mesg_i = mesg_i, len(mesg_dummy)
mesg_dummy(mesg_i:mesg_i) = ' '
end do
end function cdiZaxisInqKeyStr
subroutine gridDefXname(gridID_dummy, xname_dummy)
integer(c_int), value :: gridID_dummy
character(kind = c_char, len = *), intent(in) :: xname_dummy
......
......@@ -2997,7 +2997,7 @@ int cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if ( is_scalar ) zaxisDefScalar(zaxisID);
if ( zdimid != CDI_UNDEFID )
cdiZaxisDefKeyStr(zaxisID, CDI_KEY_DIMNAME, (int)(strlen(ncdims[zdimid].name)+1), ncdims[zdimid].name);
cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, ncdims[zdimid].name);
if ( zvar ) Free(zvar);
if ( zcvals )
......
......@@ -1235,14 +1235,16 @@ void cdf_def_zaxis_hybrid_cf(stream_t *streamptr, int type, int *ncvaridp, int z
cdf_put_att_text(fileID, p0varid, "units", strlen(units), units);
}
char zname[CDI_MAX_NAME]; zname[0] = 0;
char zlongname[CDI_MAX_NAME]; zlongname[0] = 0;
char zunits[CDI_MAX_NAME]; zunits[0] = 0;
cdiZaxisInqKeyStr(zaxisID, CDI_KEY_NAME, CDI_MAX_NAME, zname);
//cdiZaxisInqKeyStr(zaxisID, CDI_KEY_LONGNAME, CDI_MAX_NAME, zlongname);
cdiZaxisInqKeyStr(zaxisID, CDI_KEY_UNITS, CDI_MAX_NAME, zunits);
char zname[CDI_MAX_NAME];
char zlongname[CDI_MAX_NAME];
char zunits[CDI_MAX_NAME];
length = CDI_MAX_NAME;
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, zname, &length);
if ( zname[0] ) strcpy(axisname, zname);
zlongname[0] = 0;
if ( zlongname[0] == 0 ) strcpy(zlongname, "hybrid sigma pressure coordinate");
length = CDI_MAX_NAME;
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, zunits, &length);
if ( zunits[0] == 0 ) strcpy(zunits, "1");
cdf_def_dim(fileID, axisname, dimlen, dimID);
......@@ -1413,8 +1415,9 @@ void cdfDefZaxisChar(stream_t *streamptr, int zaxisID, char *axisname, int *dimI
if ( strlenID == CDI_UNDEFID ) cdf_def_dim(fileID, strlen, clen, &strlenID);
/* Check 'areatype'dimID */
char dimname[CDI_MAX_NAME+3]; dimname[0] = 0;
cdiZaxisInqKeyStr(zaxisID, CDI_KEY_DIMNAME, CDI_MAX_NAME, dimname);
char dimname[CDI_MAX_NAME+3];
int length = sizeof(dimname);
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length);
*dimID = checkDimName(fileID, dimlen, dimname);
if (dimlen <= 0)
Error("No strings delivered for a character axis.");
......@@ -1516,7 +1519,6 @@ void cdfDefZaxis(stream_t *streamptr, int zaxisID)
checkZaxisName(axisname, fileID, vlistID, zaxisID, nzaxis);
char dimname[CDI_MAX_NAME+3]; dimname[0] = 0;
//cdiZaxisInqKeyStr(zaxisID, CDI_KEY_DIMNAME, CDI_MAX_NAME, dimname);
if ( dimname[0] == 0 ) strcpy(dimname, axisname);
if ( type == ZAXIS_REFERENCE ) cdfDefZaxisUUID(streamptr, zaxisID);
......
......@@ -700,10 +700,11 @@ void vlistCopyFlag(int vlistID2, int vlistID1)
if ( zaxisType == ZAXIS_CHAR )
{
char dimname[CDI_MAX_NAME+3]; dimname[0] = 0;
cdiZaxisInqKeyStr(zaxisID, CDI_KEY_DIMNAME, CDI_MAX_NAME, dimname);
char dimname[CDI_MAX_NAME+3];
int length = sizeof(dimname);
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname, &length);
if ( dimname[0] == 0 ) { memcpy(dimname, "area_type", 10); dimname[10] = 0; }
cdiZaxisDefKeyStr(zaxisID2, CDI_KEY_DIMNAME, CDI_MAX_NAME, dimname);
cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_DIMNAME, dimname);
}
if ( zaxisType == ZAXIS_GENERIC ) zaxisDefLtype(zaxisID2, zaxisInqLtype(zaxisID));
......
......@@ -113,8 +113,6 @@ static
void zaxis_init(zaxis_t *zaxisptr)
{
zaxisptr->self = CDI_UNDEFID;
zaxisptr->dimname[0] = 0;
zaxisptr->vdimname[0] = 0;
zaxisptr->vals = NULL;
#ifndef USE_MPI
zaxisptr->cvals = NULL;
......@@ -327,115 +325,6 @@ void zaxisName(int zaxistype, char *zaxisname)
strcpy(zaxisname, zaxisNamePtr(zaxistype));
}
static inline
void zaxisSetString(char *zaxisstrname, const char *name, size_t len)
{
if ( len > CDI_MAX_NAME ) len = CDI_MAX_NAME;
strncpy(zaxisstrname, name, len - 1);
zaxisstrname[len-1] = 0;
}
static inline
void zaxisGetString(char *name, const char *zaxisstrname, size_t len)
{
size_t slen = strlen(zaxisstrname) + 1;
if ( slen > len ) slen = len;
if ( slen > CDI_MAX_NAME ) slen = CDI_MAX_NAME;
strncpy(name, zaxisstrname, slen - 1);
name[slen-1] = 0;
}
static
void *zaxis_key_to_ptr(zaxis_t *zaxisptr, int key)
{
void *keyptr = NULL;
switch (key)
{
case CDI_KEY_DIMNAME: keyptr = (void*)zaxisptr->dimname; break;
case CDI_KEY_VDIMNAME: keyptr = (void*)zaxisptr->vdimname; break;