Commit 41798beb authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced gridInqXstdname()/gridInqYstdname() by cdiInqKeyInt() with CDI_KEY_STDNAME.

parent 4d5ac71c
2019-11-20 Uwe Schulzweida 2019-11-20 Uwe Schulzweida
* Replaced gridInqXstdname()/gridInqYstdname() by cdiInqKeyInt() with CDI_KEY_STDNAME
* Replaced gridDefScannigMode()/gridInqScanningMode() by cdiDefKeyInt()/cdiInqKeyInt() with CDI_KEY_SCANNINGMODE * Replaced gridDefScannigMode()/gridInqScanningMode() by cdiDefKeyInt()/cdiInqKeyInt() with CDI_KEY_SCANNINGMODE
2019-11-12 Uwe Schulzweida 2019-11-12 Uwe Schulzweida
......
...@@ -7,9 +7,11 @@ gridDefYunits(gridID, yunits) -> cdiDefKeyString(gridID, CDI_YAXIS, CDI_ ...@@ -7,9 +7,11 @@ gridDefYunits(gridID, yunits) -> cdiDefKeyString(gridID, CDI_YAXIS, CDI_
gridInqXname(gridID, xname) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, xname, &length) gridInqXname(gridID, xname) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_NAME, xname, &length)
gridInqXlongname(gridID, xlongname) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, xlongname, &length) gridInqXlongname(gridID, xlongname) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_LONGNAME, xlongname, &length)
gridInqXunits(gridID, xunits) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, xunits, &length) gridInqXunits(gridID, xunits) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, xunits, &length)
gridInqXstdname(gridID, xstdname) -> cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_STDNAME, xstdname, &length)
gridInqYname(gridID, yname) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, yname, &length) gridInqYname(gridID, yname) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_NAME, yname, &length)
gridInqYlongname(gridID, ylongname) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, ylongname, &length) gridInqYlongname(gridID, ylongname) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_LONGNAME, ylongname, &length)
gridInqYunits(gridID, yunits) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, yunits, &length) gridInqYunits(gridID, yunits) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, yunits, &length)
gridInqYstdname(gridID, ylongname) -> cdiInqKeyString(gridID, CDI_YAXIS, CDI_KEY_STDNAME, ystdname, &length)
gridDefNumber(zaxisID, number) -> cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, number) gridDefNumber(zaxisID, number) -> cdiDefKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, number)
gridInqNumber(zaxisID) -> cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number) gridInqNumber(zaxisID) -> cdiInqKeyInt(gridID, CDI_GLOBAL, CDI_KEY_NUMBEROFGRIDUSED, &number)
......
...@@ -901,12 +901,6 @@ void gridDefYunits(int gridID, const char *yunits); ...@@ -901,12 +901,6 @@ void gridDefYunits(int gridID, const char *yunits);
// gridInqYunits: Get the units of a Y-axis // gridInqYunits: Get the units of a Y-axis
void gridInqYunits(int gridID, char *yunits); void gridInqYunits(int gridID, char *yunits);
// gridInqXstdname: Get the standard name of a X-axis
void gridInqXstdname(int gridID, char *xstdname);
// gridInqYstdname: Get the standard name of a Y-axis
void gridInqYstdname(int gridID, char *ystdname);
// gridDefDatatype: Define the data type of a Grid // gridDefDatatype: Define the data type of a Grid
void gridDefDatatype(int gridID, int prec); void gridDefDatatype(int gridID, int prec);
......
...@@ -126,7 +126,6 @@ void grid_axis_init(struct gridaxis_t *axisptr) ...@@ -126,7 +126,6 @@ void grid_axis_init(struct gridaxis_t *axisptr)
axisptr->clength = 0; axisptr->clength = 0;
axisptr->cvals = NULL; axisptr->cvals = NULL;
#endif #endif
axisptr->stdname = NULL;
cdiInitKeys(&axisptr->keys); cdiInitKeys(&axisptr->keys);
} }
...@@ -302,16 +301,16 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size) ...@@ -302,16 +301,16 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size)
gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees_east"); gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees_east");
gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees_north"); gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees_north");
gridptr->x.stdname = xystdname_tab[grid_xystdname_latlon][0]; gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_latlon][0]);
gridptr->y.stdname = xystdname_tab[grid_xystdname_latlon][1]; gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_latlon][1]);
break; break;
} }
#ifndef USE_MPI #ifndef USE_MPI
case GRID_CHARXY: case GRID_CHARXY:
{ {
if ( gridptr->x.cvals ) gridptr->x.stdname = xystdname_tab[grid_xystdname_char][0]; if ( gridptr->x.cvals ) gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_char][0]);
if ( gridptr->y.cvals ) gridptr->y.stdname = xystdname_tab[grid_xystdname_char][0]; if ( gridptr->y.cvals ) gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_char][1]);
break; break;
} }
...@@ -326,9 +325,8 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size) ...@@ -326,9 +325,8 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, size_t size)
const char *gmapname = "Projection"; const char *gmapname = "Projection";
cdiDefVarKeyBytes(&gridptr->keys, CDI_KEY_GRIDMAP_NAME, (const unsigned char *)gmapname, (int)sizeof(gmapname)+1); cdiDefVarKeyBytes(&gridptr->keys, CDI_KEY_GRIDMAP_NAME, (const unsigned char *)gmapname, (int)sizeof(gmapname)+1);
gridptr->x.stdname = xystdname_tab[grid_xystdname_projection][0]; gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][0]);
gridptr->y.stdname = xystdname_tab[grid_xystdname_projection][1]; gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][1]);
gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m"); gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m");
gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m"); gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m");
} }
...@@ -781,17 +779,6 @@ void gridInqXunits(int gridID, char *units) ...@@ -781,17 +779,6 @@ void gridInqXunits(int gridID, char *units)
(void)cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, units, &length); (void)cdiInqKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, units, &length);
} }
void gridInqXstdname(int gridID, char *xstdname)
{
if ( xstdname )
{
xstdname[0] = 0;
grid_t *gridptr = grid_to_pointer(gridID);
if ( gridptr->x.stdname ) strcpy(xstdname, gridptr->x.stdname);
}
}
/* /*
@Function gridInqYname @Function gridInqYname
@Title Get the name of a Y-axis @Title Get the name of a Y-axis
...@@ -868,17 +855,6 @@ void gridInqYunits(int gridID, char *units) ...@@ -868,17 +855,6 @@ void gridInqYunits(int gridID, char *units)
} }
void gridInqYstdname(int gridID, char *ystdname)
{
if ( ystdname )
{
ystdname[0] = 0;
grid_t *gridptr = grid_to_pointer(gridID);
if ( gridptr->y.stdname ) strcpy(ystdname, gridptr->y.stdname);
}
}
void gridDefProj(int gridID, int projID) void gridDefProj(int gridID, int projID)
{ {
grid_t *gridptr = grid_to_pointer(gridID); grid_t *gridptr = grid_to_pointer(gridID);
...@@ -936,15 +912,15 @@ void gridVerifyProj(int gridID) ...@@ -936,15 +912,15 @@ void gridVerifyProj(int gridID)
const int projtype = gridInqProjType(gridID); const int projtype = gridInqProjType(gridID);
if ( projtype == CDI_PROJ_RLL ) if ( projtype == CDI_PROJ_RLL )
{ {
gridptr->x.stdname = xystdname_tab[grid_xystdname_grid_latlon][0]; gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][0]);
gridptr->y.stdname = xystdname_tab[grid_xystdname_grid_latlon][1]; gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][1]);
gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees"); gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "degrees");
gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees"); gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "degrees");
} }
else if ( projtype == CDI_PROJ_LCC ) else if ( projtype == CDI_PROJ_LCC )
{ {
gridptr->x.stdname = xystdname_tab[grid_xystdname_projection][0]; gridaxisSetKey(&gridptr->x, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][0]);
gridptr->y.stdname = xystdname_tab[grid_xystdname_projection][1]; gridaxisSetKey(&gridptr->y, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_projection][1]);
gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m"); gridaxisSetKey(&gridptr->x, CDI_KEY_UNITS, "m");
gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m"); gridaxisSetKey(&gridptr->y, CDI_KEY_UNITS, "m");
} }
...@@ -2504,8 +2480,8 @@ int gridCompareP(void *gridptr1, void *gridptr2) ...@@ -2504,8 +2480,8 @@ int gridCompareP(void *gridptr1, void *gridptr2)
if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_LONGNAME))) return differ; if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_LONGNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_LONGNAME))) return differ;
if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_UNITS))) return differ; if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_UNITS))) return differ;
if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_UNITS))) return differ; if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_UNITS), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_UNITS))) return differ;
if (g1->x.stdname != g2->x.stdname) return differ; if (strcmp(cdiInqVarKeyString(&g1->x.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->x.keys, CDI_KEY_STDNAME))) return differ;
if (g1->y.stdname != g2->y.stdname) return differ; if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_STDNAME), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_STDNAME))) return differ;
if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_REFERENCEURI), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_REFERENCEURI))) return differ; if (strcmp(cdiInqVarKeyString(&g1->y.keys, CDI_KEY_REFERENCEURI), cdiInqVarKeyString(&g2->y.keys, CDI_KEY_REFERENCEURI))) return differ;
...@@ -2595,8 +2571,8 @@ void gridComplete(grid_t *grid) ...@@ -2595,8 +2571,8 @@ void gridComplete(grid_t *grid)
if ( name[0] == 0 ) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "degrees"); if ( name[0] == 0 ) cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "degrees");
name = cdiInqVarKeyString(&grid->y.keys, CDI_KEY_UNITS); name = cdiInqVarKeyString(&grid->y.keys, CDI_KEY_UNITS);
if ( name[0] == 0 ) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "degrees"); if ( name[0] == 0 ) cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "degrees");
grid->x.stdname = xystdname_tab[grid_xystdname_grid_latlon][0]; cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][0]);
grid->y.stdname = xystdname_tab[grid_xystdname_grid_latlon][1]; cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_STDNAME, xystdname_tab[grid_xystdname_grid_latlon][1]);
} }
if ( gridtype == GRID_UNSTRUCTURED ) if ( gridtype == GRID_UNSTRUCTURED )
...@@ -4290,8 +4266,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize, ...@@ -4290,8 +4266,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->y.size = intBuffer[GRID_PACK_INT_IDX_Y_SIZE]; gridP->y.size = intBuffer[GRID_PACK_INT_IDX_Y_SIZE];
gridP->lcomplex = (bool)intBuffer[GRID_PACK_INT_IDX_LCOMPLEX]; gridP->lcomplex = (bool)intBuffer[GRID_PACK_INT_IDX_LCOMPLEX];
memberMask = intBuffer[GRID_PACK_INT_IDX_MEMBERMASK]; memberMask = intBuffer[GRID_PACK_INT_IDX_MEMBERMASK];
gridP->x.stdname = xystdname_tab[intBuffer[GRID_PACK_INT_IDX_XTSTDNNAME]][0];
gridP->y.stdname = xystdname_tab[intBuffer[GRID_PACK_INT_IDX_YTSTDNNAME]][1];
} }
if (memberMask & gridHasReducedPointsFlag) if (memberMask & gridHasReducedPointsFlag)
...@@ -4447,11 +4421,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize, ...@@ -4447,11 +4421,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
intBuffer[GRID_PACK_INT_IDX_LCOMPLEX] = gridP->lcomplex; intBuffer[GRID_PACK_INT_IDX_LCOMPLEX] = gridP->lcomplex;
intBuffer[GRID_PACK_INT_IDX_MEMBERMASK] = memberMask intBuffer[GRID_PACK_INT_IDX_MEMBERMASK] = memberMask
= gridGetComponentFlags(gridP); = gridGetComponentFlags(gridP);
intBuffer[GRID_PACK_INT_IDX_XTSTDNNAME] =
(int)((const char (*)[2][24])gridP->x.stdname - xystdname_tab);
intBuffer[GRID_PACK_INT_IDX_YTSTDNNAME] =
(int)((const char (*)[2][24])gridP->y.stdname
- (const char (*)[2][24])xystdname_tab[0][1]);
serializePack(intBuffer, gridNint, CDI_DATATYPE_INT, serializePack(intBuffer, gridNint, CDI_DATATYPE_INT,
packBuffer, packBufferSize, packBufferPos, context); packBuffer, packBufferSize, packBufferPos, context);
......
...@@ -62,9 +62,8 @@ struct gridVirtTable ...@@ -62,9 +62,8 @@ struct gridVirtTable
}; };
struct gridaxis_t { struct gridaxis_t {
const char *stdname; size_t size; // number of values
size_t size; // number of values short flag; // 0: undefined 1:vals 2:first+inc
short flag; // 0: undefined 1:vals 2:first+inc
double first, last, inc; double first, last, inc;
double *vals; double *vals;
double *bounds; double *bounds;
...@@ -77,31 +76,30 @@ struct gridaxis_t { ...@@ -77,31 +76,30 @@ struct gridaxis_t {
// GME Grid // GME Grid
struct grid_gme_t { struct grid_gme_t {
int nd, ni, ni2, ni3; /* parameter for GRID_GME */ int nd, ni, ni2, ni3; // parameter for GRID_GME
}; };
struct grid_t { struct grid_t {
char *name; char *name;
int self; int self;
size_t size; size_t size;
int type; /* grid type */ int type; // grid type
int datatype; /* grid data type */ int datatype; // grid data type
int proj; /* grid projection */ int proj; // grid projection
int projtype; /* grid projection type */ int projtype; // grid projection type
mask_t *mask; mask_t *mask;
mask_t *mask_gme; mask_t *mask_gme;
double *area; double *area;
struct grid_gme_t gme; struct grid_gme_t gme;
int trunc; /* parameter for GRID_SPECTRAL */ int trunc; // parameter for GRID_SPECTRAL
int nvertex; int nvertex;
int *reducedPoints; int *reducedPoints;
int reducedPointsSize; int reducedPointsSize;
int np; /* number of parallels between a pole and the equator */ int np; // number of parallels between a pole and the equator
signed char isCyclic; /* three possible states: signed char isCyclic; // three possible states:
* -1 if unknown, // -1 if unknown,
* 0 if found not cyclic, or // 0 if found not cyclic, or
* 1 for global cyclic grids // 1 for global cyclic grids
*/
bool lcomplex; bool lcomplex;
bool hasdims; bool hasdims;
struct gridaxis_t x; struct gridaxis_t x;
......
...@@ -2074,7 +2074,7 @@ void cdf_copy_axis_attr(ncvar_t *ncvar, struct gridaxis_t *gridaxis) ...@@ -2074,7 +2074,7 @@ void cdf_copy_axis_attr(ncvar_t *ncvar, struct gridaxis_t *gridaxis)
cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_UNITS, (const unsigned char*)ncvar->units, (int)sizeof(ncvar->units)+1); cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_UNITS, (const unsigned char*)ncvar->units, (int)sizeof(ncvar->units)+1);
#ifndef USE_MPI #ifndef USE_MPI
if ( gridaxis->cvals ) if ( gridaxis->cvals )
gridaxis->stdname = ncvar->stdname; cdiDefVarKeyBytes(&gridaxis->keys, CDI_KEY_STDNAME, (const unsigned char*)ncvar->stdname, (int)sizeof(ncvar->stdname)+1);
#endif #endif
} }
......
...@@ -228,7 +228,7 @@ static const struct cdfDefGridAxisInqs { ...@@ -228,7 +228,7 @@ static const struct cdfDefGridAxisInqs {
int (*axisName)(int cdiID, int varID, int key, char *string, int *length); int (*axisName)(int cdiID, int varID, int key, char *string, int *length);
int (*axisLongname)(int cdiID, int varID, int key, char *string, int *length); int (*axisLongname)(int cdiID, int varID, int key, char *string, int *length);
int (*axisUnits)(int cdiID, int varID, int key, char *string, int *length); int (*axisUnits)(int cdiID, int varID, int key, char *string, int *length);
void (*axisStdname)(int cdiID, char *dimstdname); void (*axisStdname)(int cdiID, int varID, int key, char *string, int *length);
double (*axisVal)(int gridID, size_t index); double (*axisVal)(int gridID, size_t index);
const double *(*axisValsPtr)(int gridID); const double *(*axisValsPtr)(int gridID);
const double *(*axisBoundsPtr)(int gridID); const double *(*axisBoundsPtr)(int gridID);
...@@ -238,7 +238,7 @@ static const struct cdfDefGridAxisInqs { ...@@ -238,7 +238,7 @@ static const struct cdfDefGridAxisInqs {
.axisName = cdiInqKeyString, .axisName = cdiInqKeyString,
.axisLongname = cdiInqKeyString, .axisLongname = cdiInqKeyString,
.axisUnits = cdiInqKeyString, .axisUnits = cdiInqKeyString,
.axisStdname = gridInqXstdname, .axisStdname = cdiInqKeyString,
.axisVal = gridInqXval, .axisVal = gridInqXval,
.axisValsPtr = gridInqXvalsPtr, .axisValsPtr = gridInqXvalsPtr,
.axisBoundsPtr = gridInqXboundsPtr, .axisBoundsPtr = gridInqXboundsPtr,
...@@ -248,14 +248,14 @@ static const struct cdfDefGridAxisInqs { ...@@ -248,14 +248,14 @@ static const struct cdfDefGridAxisInqs {
.axisName = cdiInqKeyString, .axisName = cdiInqKeyString,
.axisLongname = cdiInqKeyString, .axisLongname = cdiInqKeyString,
.axisUnits = cdiInqKeyString, .axisUnits = cdiInqKeyString,
.axisStdname = gridInqYstdname, .axisStdname = cdiInqKeyString,
.axisVal = gridInqYval, .axisVal = gridInqYval,
.axisValsPtr = gridInqYvalsPtr, .axisValsPtr = gridInqYvalsPtr,
.axisBoundsPtr = gridInqYboundsPtr, .axisBoundsPtr = gridInqYboundsPtr,
}, gridInqsZ = { }, gridInqsZ = {
.axisLongname = cdiInqKeyString, .axisLongname = cdiInqKeyString,
.axisUnits = cdiInqKeyString, .axisUnits = cdiInqKeyString,
.axisStdname = zaxisInqStdname, .axisStdname = cdiInqKeyString,
}; };
static static
...@@ -263,14 +263,16 @@ void cdfPutGridStdAtts(int fileID, int ncvarid, int gridID, int dimtype, const s ...@@ -263,14 +263,16 @@ void cdfPutGridStdAtts(int fileID, int ncvarid, int gridID, int dimtype, const s
{ {
size_t len; size_t len;
int axisKey = (dimtype == 'Z') ? CDI_GLOBAL : ((dimtype == 'X') ? CDI_XAXIS : CDI_YAXIS);
char stdname[CDI_MAX_NAME]; char stdname[CDI_MAX_NAME];
inqs->axisStdname(gridID, stdname); int length = CDI_MAX_NAME;
if ( (len = strlen(stdname)) ) inqs->axisStdname(gridID, axisKey, CDI_KEY_STDNAME, stdname, &length);
if ( stdname[0] && (len = strlen(stdname)) )
cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname); cdf_put_att_text(fileID, ncvarid, "standard_name", len, stdname);
char longname[CDI_MAX_NAME]; char longname[CDI_MAX_NAME];
int length = CDI_MAX_NAME; length = CDI_MAX_NAME;
int axisKey = (dimtype == 'Z') ? CDI_GLOBAL : ((dimtype == 'X') ? CDI_XAXIS : CDI_YAXIS);
inqs->axisLongname(gridID, axisKey, CDI_KEY_LONGNAME, longname, &length); inqs->axisLongname(gridID, axisKey, CDI_KEY_LONGNAME, longname, &length);
if ( longname[0] && (len = strlen(longname)) ) if ( longname[0] && (len = strlen(longname)) )
cdf_put_att_text(fileID, ncvarid, "long_name", len, longname); cdf_put_att_text(fileID, ncvarid, "long_name", len, longname);
......
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