Commit 4be72e83 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced zaxisInqStdname() by cdiInqKeyString().

parent b3fc0639
Pipeline #2525 passed with stages
in 15 minutes and 22 seconds
......@@ -78,7 +78,7 @@ cdoPrintAttributes(FILE *fp, int cdiID, int varID, int nblanks)
}
else if (atttype == CDI_DATATYPE_TXT)
{
std::vector<char> atttxt(attlen);
std::vector<char> atttxt(attlen+1);
cdiInqAttTxt(cdiID, varID, attname, attlen, atttxt.data());
atttxt[attlen] = 0;
fprintf(fp, "%*s", nblanks, "");
......@@ -92,11 +92,11 @@ printSource(FILE *fp, int vlistID, int varID)
{
// institute info
const auto instptr = institutInqLongnamePtr(vlistInqVarInstitut(vlistID, varID));
if (instptr) fprintf(fp, " institution = %s\n", instptr);
if (instptr) fprintf(fp, " institution = \"%s\"\n", instptr);
// source info
const auto modelptr = modelInqNamePtr(vlistInqVarModel(vlistID, varID));
if (modelptr) fprintf(fp, " source = %s\n", modelptr);
if (modelptr) fprintf(fp, " source = \"%s\"\n", modelptr);
}
static void
......@@ -187,7 +187,7 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
if (natts > 0)
{
fprintf(fp, "&parameter\n");
fprintf(fp, " name=_GLOBAL_\n");
fprintf(fp, " name = _GLOBAL_\n");
printSource(fp, vlistID, 0);
cdoPrintAttributes(fp, vlistID, CDI_GLOBAL, 2);
fprintf(fp, "/\n");
......@@ -210,12 +210,12 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
{
fprintf(fp, "&parameter");
if (linebreak) fprintf(fp, "\n");
fprintf(fp, " name=_default_");
fprintf(fp, " name = _default_");
if (linebreak) fprintf(fp, "\n");
auto datatypestr = cdi_datatype2str(datatype);
if (*datatypestr)
{
fprintf(fp, " datatype=%s", datatypestr);
fprintf(fp, " datatype = %s", datatypestr);
if (linebreak) fprintf(fp, "\n");
}
fprintf(fp, " /\n");
......@@ -244,22 +244,22 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
if (param >= 0)
{
cdiParamToString(param, paramstr, sizeof(paramstr));
fprintf(fp, " param=%s", paramstr);
fprintf(fp, " param = %s", paramstr);
if (linebreak) fprintf(fp, "\n");
}
if (strlen(varstdname))
{
fprintf(fp, " standard_name=%s", varstdname);
fprintf(fp, " standard_name = %s", varstdname);
if (linebreak) fprintf(fp, "\n");
}
if (strlen(varlongname))
{
fprintf(fp, " long_name=\"%s\"", varlongname);
fprintf(fp, " long_name = \"%s\"", varlongname);
if (linebreak) fprintf(fp, "\n");
}
if (strlen(varunits))
{
fprintf(fp, " units=\"%s\"", varunits);
fprintf(fp, " units = \"%s\"", varunits);
if (linebreak) fprintf(fp, "\n");
}
......@@ -268,7 +268,7 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
auto datatypestr = cdi_datatype2str(vlistInqVarDatatype(vlistID, varID));
if (*datatypestr)
{
fprintf(fp, " datatype=%s", datatypestr);
fprintf(fp, " datatype = %s", datatypestr);
if (linebreak) fprintf(fp, "\n");
}
}
......@@ -276,7 +276,7 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
int uvRelativeToGrid = 0;
if (cdiInqKeyInt(vlistID, varID, CDI_KEY_UVRELATIVETOGRID, &uvRelativeToGrid) == CDI_NOERR)
{
fprintf(fp, " uvRelativeToGrid=%d", uvRelativeToGrid);
fprintf(fp, " uvRelativeToGrid = %d", uvRelativeToGrid);
if (linebreak) fprintf(fp, "\n");
}
......@@ -291,8 +291,11 @@ partab(FILE *fp, CdoStreamID streamID, const int option)
if (linebreak) fprintf(fp, "\n");
}
if (option == 2) fprintf(fp, " missing_value=%g\n", missval);
if (option == 2) cdoPrintAttributes(fp, vlistID, varID, 2);
if (option == 2)
{
fprintf(fp, " missing_value=%g\n", missval);
cdoPrintAttributes(fp, vlistID, varID, 2);
}
if (!linebreak) fprintf(fp, " ");
fprintf(fp, "/\n");
......
......@@ -43,8 +43,10 @@ is_height_axis(int zaxisID, int nlevel)
if (zaxisInqType(zaxisID) == ZAXIS_REFERENCE)
{
char units[CDI_MAX_NAME], stdname[CDI_MAX_NAME];
zaxisInqUnits(zaxisID, units);
zaxisInqStdname(zaxisID, stdname);
int length = CDI_MAX_NAME;
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, units, &length);
length = CDI_MAX_NAME;
cdiInqKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_STDNAME, stdname, &length);
if (cstrIsEqual(stdname, "height") && *units == 0) isheight = true;
}
}
......
......@@ -134,7 +134,7 @@ constexpr std::chrono::milliseconds TIMEOUT = std::chrono::milliseconds(1000);
int processNumsActive(void);
int
pipe_t::pipeInqVlist(int p_vlistID)
pipe_t::pipeInqVlist(int &p_vlistID)
{
Debug(PIPE, "Inquiring vlist for vlistID: %d", p_vlistID);
std::chrono::milliseconds time_to_wait(0);
......
......@@ -39,7 +39,7 @@ struct pipe_t
{
public:
pipe_t();
int pipeInqVlist(int vlistID);
int pipeInqVlist(int &vlistID);
void pipe_init();
void pipeDefRecord(int p_varId, int p_levelID);
void pipeDefTimestep(int p_vlistID, int tsID);
......
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