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

replace gridInqXdimname/gridInqYdimname by cdiGridInqString

parent 590d54a5
......@@ -772,9 +772,6 @@ int cdiGridDefString(int gridID, int key, int size, const char *mesg);
// cdiGridInqString: Get a CDI grid string value from a key
int cdiGridInqString(int gridID, int key, int size, char *mesg);
/* gridInqXdimname: Get the dimension name of a X-axis */
void gridInqXdimname(int gridID, char *xdimname);
/* gridDefXname: Define the name of a X-axis */
void gridDefXname(int gridID, const char *xname);
......@@ -793,9 +790,6 @@ void gridDefXunits(int gridID, const char *xunits);
/* gridInqXunits: Get the units of a X-axis */
void gridInqXunits(int gridID, char *xunits);
/* gridInqYdimname: Get the dimension name of a Y-axis */
void gridInqYdimname(int gridID, char *ydimname);
/* gridDefYname: Define the name of a Y-axis */
void gridDefYname(int gridID, const char *yname);
......
......@@ -836,32 +836,6 @@ void gridDefYunits(int gridID, const char *yunits)
}
}
/*
@Function gridInqXdimname
@Title Get the dimension name of a X-axis
@Prototype void gridInqXdimname(int gridID, char *dimname)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item dimname Dimension name of the X-axis. The caller must allocate space for the
returned string. The maximum possible length, in characters, of
the string is given by the predefined constant @func{CDI_MAX_NAME}.
@Description
The function @func{gridInqXdimname} returns the dimension name of a X-axis.
@Result
@func{gridInqXname} returns the dimension name of the X-axis to the parameter dimname.
@EndFunction
*/
void gridInqXdimname(int gridID, char *xdimname)
{
grid_t *gridptr = gridID2Ptr(gridID);
strcpy(xdimname, gridptr->xdimname);
}
/*
@Function gridInqXname
@Title Get the name of a X-axis
......@@ -950,32 +924,6 @@ void gridInqXstdname(int gridID, char *xstdname)
xstdname[0] = 0;
}
/*
@Function gridInqYdimname
@Title Get the dimension name of a Y-axis
@Prototype void gridInqYdimname(int gridID, char *dimname)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item dimname Dimension name of the Y-axis. The caller must allocate space for the
returned string. The maximum possible length, in characters, of
the string is given by the predefined constant @func{CDI_MAX_NAME}.
@Description
The function @func{gridInqYdimname} returns the dimension name of a Y-axis.
@Result
@func{gridInqYname} returns the dimension name of the Y-axis to the parameter dimname.
@EndFunction
*/
void gridInqYdimname(int gridID, char *ydimname)
{
grid_t *gridptr = gridID2Ptr(gridID);
strcpy(ydimname, gridptr->ydimname);
}
/*
@Function gridInqYname
@Title Get the name of a Y-axis
......
......@@ -454,14 +454,12 @@ module mo_cdi
integer(c_int), public, parameter :: CDI_GRID_YUNITS = 908
public :: cdiGridDefString
public :: cdiGridInqString
public :: gridInqXdimname
public :: gridDefXname
public :: gridInqXname
public :: gridDefXlongname
public :: gridInqXlongname
public :: gridDefXunits
public :: gridInqXunits
public :: gridInqYdimname
public :: gridDefYname
public :: gridInqYname
public :: gridDefYlongname
......@@ -4980,37 +4978,6 @@ contains
end do
end function cdiGridInqString
subroutine gridInqXdimname(gridID_dummy, xdimname_dummy)
integer(c_int), value :: gridID_dummy
character(kind = c_char, len = *), intent(inout) :: xdimname_dummy
character(kind = c_char) :: xdimname_temp(len(xdimname_dummy) + 1)
integer :: xdimname_i
interface
subroutine lib_gridInqXdimname(gridID_dummy, xdimname_dummy) bind(c, name&
& = 'gridInqXdimname')
import c_char, c_int
integer(c_int), value :: gridID_dummy
character(kind = c_char) :: xdimname_dummy(*)
end subroutine lib_gridInqXdimname
end interface
xdimname_temp(len(xdimname_dummy) + 1) = c_null_char
do xdimname_i = len(xdimname_dummy), 1, -1
if(xdimname_dummy(xdimname_i:xdimname_i) /= ' ') exit
xdimname_temp(xdimname_i) = c_null_char
end do
do xdimname_i = xdimname_i, 1, -1
xdimname_temp(xdimname_i) = xdimname_dummy(xdimname_i:xdimname_i)
end do
call lib_gridInqXdimname(gridID_dummy, xdimname_temp)
do xdimname_i = 1, len(xdimname_dummy)
if(xdimname_temp(xdimname_i) == c_null_char) exit
xdimname_dummy(xdimname_i:xdimname_i) = xdimname_temp(xdimname_i)
end do
do xdimname_i = xdimname_i, len(xdimname_dummy)
xdimname_dummy(xdimname_i:xdimname_i) = ' '
end do
end subroutine gridInqXdimname
subroutine gridDefXname(gridID_dummy, xname_dummy)
integer(c_int), value :: gridID_dummy
character(kind = c_char, len = *), intent(in) :: xname_dummy
......@@ -5164,37 +5131,6 @@ contains
end do
end subroutine gridInqXunits
subroutine gridInqYdimname(gridID_dummy, ydimname_dummy)
integer(c_int), value :: gridID_dummy
character(kind = c_char, len = *), intent(inout) :: ydimname_dummy
character(kind = c_char) :: ydimname_temp(len(ydimname_dummy) + 1)
integer :: ydimname_i
interface
subroutine lib_gridInqYdimname(gridID_dummy, ydimname_dummy) bind(c, name&
& = 'gridInqYdimname')
import c_char, c_int
integer(c_int), value :: gridID_dummy
character(kind = c_char) :: ydimname_dummy(*)
end subroutine lib_gridInqYdimname
end interface
ydimname_temp(len(ydimname_dummy) + 1) = c_null_char
do ydimname_i = len(ydimname_dummy), 1, -1
if(ydimname_dummy(ydimname_i:ydimname_i) /= ' ') exit
ydimname_temp(ydimname_i) = c_null_char
end do
do ydimname_i = ydimname_i, 1, -1
ydimname_temp(ydimname_i) = ydimname_dummy(ydimname_i:ydimname_i)
end do
call lib_gridInqYdimname(gridID_dummy, ydimname_temp)
do ydimname_i = 1, len(ydimname_dummy)
if(ydimname_temp(ydimname_i) == c_null_char) exit
ydimname_dummy(ydimname_i:ydimname_i) = ydimname_temp(ydimname_i)
end do
do ydimname_i = ydimname_i, len(ydimname_dummy)
ydimname_dummy(ydimname_i:ydimname_i) = ' '
end do
end subroutine gridInqYdimname
subroutine gridDefYname(gridID_dummy, yname_dummy)
integer(c_int), value :: gridID_dummy
character(kind = c_char, len = *), intent(in) :: yname_dummy
......
......@@ -1485,8 +1485,6 @@ void cdfDefCurvilinear(stream_t *streamptr, int gridID)
char ystdname[CDI_MAX_NAME];
char xaxisname[CDI_MAX_NAME];
char yaxisname[CDI_MAX_NAME];
char xdimname[CDI_MAX_NAME+3];
char ydimname[CDI_MAX_NAME+3];
int index;
int xdimID = UNDEFID;
int ydimID = UNDEFID;
......@@ -1508,20 +1506,22 @@ void cdfDefCurvilinear(stream_t *streamptr, int gridID)
size_t ydimlen = (size_t)gridInqYsize(gridID);
int gridindex = vlistGridIndex(vlistID, gridID);
gridInqXdimname(gridID, xdimname);
char xdimname[CDI_MAX_NAME+3];
char ydimname[CDI_MAX_NAME+3];
cdiGridInqString(gridID, CDI_GRID_XDIMNAME, CDI_MAX_NAME, xdimname);
cdiGridInqString(gridID, CDI_GRID_YDIMNAME, CDI_MAX_NAME, ydimname);
if ( xdimname[0] == 0 ) xdimname[0] = 'x';
if ( ydimname[0] == 0 ) ydimname[0] = 'y';
gridInqXname(gridID, xaxisname);
gridInqXlongname(gridID, xlongname);
gridInqXstdname(gridID, xstdname);
gridInqXunits(gridID, xunits);
gridInqYdimname(gridID, ydimname);
gridInqYname(gridID, yaxisname);
gridInqYlongname(gridID, ylongname);
gridInqYstdname(gridID, ystdname);
gridInqYunits(gridID, yunits);
if ( xdimname[0] == 0 ) xdimname[0] = 'x';
if ( ydimname[0] == 0 ) ydimname[0] = 'y';
for ( index = 0; index < ngrids; index++ )
{
if ( streamptr->xdimID[index] != UNDEFID )
......@@ -1876,7 +1876,6 @@ void cdfDefUnstructured(stream_t *streamptr, int gridID)
char ystdname[CDI_MAX_NAME];
char xaxisname[CDI_MAX_NAME];
char yaxisname[CDI_MAX_NAME];
char xdimname[CDI_MAX_NAME+3];
int index;
int dimID = UNDEFID;
size_t len;
......@@ -1895,7 +1894,10 @@ void cdfDefUnstructured(stream_t *streamptr, int gridID)
size_t dimlen = (size_t)gridInqSize(gridID);
int gridindex = vlistGridIndex(vlistID, gridID);
gridInqXdimname(gridID, xdimname);
char xdimname[CDI_MAX_NAME+3];
cdiGridInqString(gridID, CDI_GRID_XDIMNAME, CDI_MAX_NAME, xdimname);
if ( xdimname[0] == 0 ) strcpy(xdimname, "ncells");
gridInqXname(gridID, xaxisname);
gridInqXlongname(gridID, xlongname);
gridInqXstdname(gridID, xstdname);
......@@ -1905,8 +1907,6 @@ void cdfDefUnstructured(stream_t *streamptr, int gridID)
gridInqYstdname(gridID, ystdname);
gridInqYunits(gridID, yunits);
if ( xdimname[0] == 0 ) strcpy(xdimname, "ncells");
for ( index = 0; index < ngrids; index++ )
{
if ( streamptr->xdimID[index] != UNDEFID )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment