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

Added function zaxisTypeIsSingleLayer().

parent c4996c2d
......@@ -442,20 +442,44 @@ printGridInfo(int vlistID)
static void
printZaxisBoundsInfo(const int zaxisID, const int dig, const int levelsize, const double zinc, const char *zunits)
{
fprintf(stdout, "%33s : ", "bounds");
double level1 = zaxisInqLbound(zaxisID, 0);
double level2 = zaxisInqUbound(zaxisID, 0);
fprintf(stdout, "%.*g-%.*g", dig, level1, dig, level2);
if (levelsize > 1)
if (!(levelsize == 1 && IS_EQUAL(level1, level2) && fabs(level1) <= 0))
{
fprintf(stdout, "%33s : ", "bounds");
fprintf(stdout, "%.*g-%.*g", dig, level1, dig, level2);
if (levelsize > 1)
{
level1 = zaxisInqLbound(zaxisID, levelsize - 1);
level2 = zaxisInqUbound(zaxisID, levelsize - 1);
fprintf(stdout, " to %.*g-%.*g", dig, level1, dig, level2);
if (IS_NOT_EQUAL(zinc, 0)) fprintf(stdout, " by %.*g", dig, zinc);
}
fprintf(stdout, " %s", zunits);
fprintf(stdout, "\n");
}
}
static bool
zaxisTypeIsSingleLayer(int zaxistype)
{
switch (zaxistype)
{
level1 = zaxisInqLbound(zaxisID, levelsize - 1);
level2 = zaxisInqUbound(zaxisID, levelsize - 1);
fprintf(stdout, " to %.*g-%.*g", dig, level1, dig, level2);
if (IS_NOT_EQUAL(zinc, 0)) fprintf(stdout, " by %.*g", dig, zinc);
case ZAXIS_MEANSEA:
case ZAXIS_TOA:
case ZAXIS_SEA_BOTTOM:
case ZAXIS_ATMOSPHERE:
case ZAXIS_CLOUD_BASE:
case ZAXIS_CLOUD_TOP:
case ZAXIS_ISOTHERM_ZERO:
case ZAXIS_LAKE_BOTTOM:
case ZAXIS_SEDIMENT_BOTTOM:
case ZAXIS_SEDIMENT_BOTTOM_TA:
case ZAXIS_SEDIMENT_BOTTOM_TW:
case ZAXIS_SURFACE: return true;
}
fprintf(stdout, " %s", zunits);
fprintf(stdout, "\n");
return false;
}
static void
......@@ -465,7 +489,7 @@ printZaxisLevelInfo(const int levelsize, const int zaxisID, const int zaxistype,
double *levels = (double *) malloc((size_t) levelsize * sizeof(double));
zaxisInqLevels(zaxisID, levels);
if (!(zaxistype == ZAXIS_SURFACE && levelsize == 1 && fabs(levels[0]) <= 0))
if (!(zaxisTypeIsSingleLayer(zaxistype) && levelsize == 1 && fabs(levels[0]) <= 0))
{
const double zfirst = levels[0];
const double zlast = levels[levelsize - 1];
......
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