Commit 576d2b3e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added createZaxisFromZvar(9.

parent 76eebaf7
......@@ -260,6 +260,27 @@ vert_gen_weights3d1d(bool expol, size_t gridsize, int nlev1, Field3D &field1, in
}
}
static int
createZaxisFromZvar(const Varray<double> &levels, int vlistID, int varID)
{
int nlevels = levels.size();
int zaxisID = zaxisCreate(ZAXIS_GENERIC, nlevels);
char str[CDI_MAX_NAME];
strcpy(str, "zlev");
cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_NAME, str);
str[0] = 0;
vlistInqVarLongname(vlistID, varID, str);
if (str[0]) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_LONGNAME, str);
str[0] = 0;
vlistInqVarUnits(vlistID, varID, str);
if (str[0]) cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, str);
zaxisDefLevels(zaxisID, levels.data());
return zaxisID;
}
static void
intlevelGetParameter(Varray<double> &lev2, std::string &zdescription, std::string &zvarname)
......@@ -404,22 +425,7 @@ Intlevel(void *process)
zvarGridsize = varList1[zvarID].gridsize;
nlev1 = varList1[zvarID].nlevels;
if (zaxisID2 == CDI_UNDEFID)
{
zaxisID2 = zaxisCreate(ZAXIS_GENERIC, nlev2);
char str[CDI_MAX_NAME];
strcpy(str, "zlev");
cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_NAME, str);
str[0] = 0;
vlistInqVarLongname(vlistID1, zvarID, str);
if (str[0]) cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_LONGNAME, str);
str[0] = 0;
vlistInqVarUnits(vlistID1, zvarID, str);
if (str[0]) cdiDefKeyString(zaxisID2, CDI_GLOBAL, CDI_KEY_UNITS, str);
zaxisDefLevels(zaxisID2, lev2.data());
}
if (zaxisID2 == CDI_UNDEFID) zaxisID = createZaxisFromZvar(lev2, vlistID1, zvarID);
wisize = zvarGridsize * nlev2;
......
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