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

cdfDefAxisCommon: compare dimname.

parent 60dabc2a
......@@ -433,6 +433,7 @@ void cdfDefFC(stream_t *streamptr, int gridID, int gridindex)
static const struct cdfDefGridAxisInqs {
int (*axisSize)(int gridID);
int (*axisDimname)(int cdiID, int key, int size, char *mesg);
int (*axisName)(int cdiID, int key, int size, char *mesg);
int (*axisLongname)(int cdiID, int key, int size, char *mesg);
int (*axisUnits)(int cdiID, int key, int size, char *mesg);
......@@ -442,6 +443,7 @@ static const struct cdfDefGridAxisInqs {
const double *(*axisBoundsPtr)(int gridID);
} gridInqsX = {
.axisSize = gridInqXsize,
.axisDimname = cdiGridInqKeyStr,
.axisName = cdiGridInqKeyStr,
.axisLongname = cdiGridInqKeyStr,
.axisUnits = cdiGridInqKeyStr,
......@@ -451,6 +453,7 @@ static const struct cdfDefGridAxisInqs {
.axisBoundsPtr = gridInqXboundsPtr,
}, gridInqsY = {
.axisSize = gridInqYsize,
.axisDimname = cdiGridInqKeyStr,
.axisName = cdiGridInqKeyStr,
.axisLongname = cdiGridInqKeyStr,
.axisUnits = cdiGridInqKeyStr,
......@@ -657,6 +660,10 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
ncgrid_t *ncgrid = streamptr->ncgrid;
const double *pvals = gridAxisInq->axisValsPtr(gridID);
char dimname[CDI_MAX_NAME+3]; dimname[0] = 0;
if ( ndims && pvals == NULL ) cdiGridInqKeyStr(gridID, dimKey, CDI_MAX_NAME, dimname);
for ( int index = 0; index < gridindex; ++index )
{
int gridID0 = ncgrid[index].gridID;
......@@ -669,7 +676,10 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
gridtype0 == GRID_GENERIC )
{
size_t dimlen0 = (size_t)gridAxisInq->axisSize(gridID0);
if ( dimlen == dimlen0 )
char dimname0[CDI_MAX_NAME]; dimname0[0] = 0;
if ( dimname[0] ) cdiGridInqKeyStr(gridID0, dimKey, CDI_MAX_NAME, dimname0);
bool lname = dimname0[0] ? strcmp(dimname, dimname0) == 0 : true;
if ( dimlen == dimlen0 && lname )
{
double (*inqVal)(int gridID, int index) = gridAxisInq->axisVal;
if ( IS_EQUAL(inqVal(gridID0, 0), inqVal(gridID, 0)) &&
......@@ -684,8 +694,6 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
if ( dimID == CDI_UNDEFID )
{
const double *pvals = gridAxisInq->axisValsPtr(gridID);
char axisname[CDI_MAX_NAME]; axisname[0] = 0;
int keyname = (axisLetter == 'X') ? CDI_KEY_XNAME : CDI_KEY_YNAME;
gridAxisInq->axisName(gridID, keyname, CDI_MAX_NAME, axisname);
......@@ -702,11 +710,6 @@ cdfDefAxisCommon(stream_t *streamptr, int gridID, int gridindex, int ndims,
if ( ndims )
{
char dimname[CDI_MAX_NAME+3]; dimname[0] = 0;
if ( pvals == NULL )
cdiGridInqKeyStr(gridID, dimKey, CDI_MAX_NAME, dimname);
if ( dimname[0] == 0 ) strcpy(dimname, extendedAxisname);
dimID = checkDimName(fileID, dimlen, dimname);
......
Markdown is supported
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