Commit 67fb0584 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced int revVarID by struct recinfo_type.

parent 0ef8c0d9
......@@ -88,10 +88,9 @@ Timstat3(void *process)
size_t gridsize = vlistGridsizeMax(vlistID[0]);
int nvars = vlistNvars(vlistID[0]);
int nrecs = vlistNrecs(vlistID[0]);
int nrecs3 = nrecs;
int *recVarID = (int *) Malloc(nrecs * sizeof(int));
int *recLevelID = (int *) Malloc(nrecs * sizeof(int));
int maxrecs = vlistNrecs(vlistID[0]);
std::vector<recinfo_type> recinfo(maxrecs);
int taxisID1 = vlistInqTaxis(vlistID[0]);
int taxisID3 = taxisDuplicate(taxisID1);
......@@ -158,7 +157,7 @@ Timstat3(void *process)
{
if (reached_eof[is]) continue;
nrecs = cdoStreamInqTimestep(streamID[is], tsID);
int nrecs = cdoStreamInqTimestep(streamID[is], tsID);
if (nrecs == 0)
{
reached_eof[is] = 1;
......@@ -178,8 +177,9 @@ Timstat3(void *process)
if (tsID == 0 && is == 0)
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID[0], varID) == TIME_CONSTANT;
}
pstreamReadRecord(streamID[is], in[is].ptr, &nmiss);
......@@ -212,10 +212,10 @@ Timstat3(void *process)
taxisDefVtime(taxisID3, vtime);
pstreamDefTimestep(streamID3, 0);
for (int recID = 0; recID < nrecs3; recID++)
for (int recID = 0; recID < maxrecs; recID++)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
missval1 = fwork[0][varID][levelID].missval;
missval2 = missval1;
......@@ -329,9 +329,6 @@ Timstat3(void *process)
for (int i = 0; i < NOUT; ++i)
Free(out[i].ptr);
Free(recVarID);
Free(recLevelID);
cdoFinish();
return 0;
......
......@@ -88,10 +88,9 @@ Ydaypctl(void *process)
pstreamDefVlist(streamID4, vlistID4);
int nvars = vlistNvars(vlistID1);
int nrecords = vlistNrecs(vlistID1);
int *recVarID = (int *) Malloc(nrecords * sizeof(int));
int *recLevelID = (int *) Malloc(nrecords * sizeof(int));
int maxrecs = vlistNrecs(vlistID1);
std::vector<recinfo_type> recinfo(maxrecs);
size_t gridsize = vlistGridsizeMax(vlistID1);
......@@ -189,8 +188,9 @@ Ydaypctl(void *process)
if (tsID == 0)
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT;
}
pstreamReadRecord(streamID1, vars1[dayoy][varID][levelID].ptr, &nmiss);
......@@ -224,13 +224,12 @@ Ydaypctl(void *process)
taxisDefVtime(taxisID4, vtimes1[dayoy]);
pstreamDefTimestep(streamID4, otsID);
for (int recID = 0; recID < nrecords; recID++)
for (int recID = 0; recID < maxrecs; recID++)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
if (otsID && vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue;
if (otsID && recinfo[recID].lconst) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
pstreamDefRecord(streamID4, varID, levelID);
pstreamWriteRecord(streamID4, vars1[dayoy][varID][levelID].ptr, vars1[dayoy][varID][levelID].nmiss);
}
......@@ -249,9 +248,6 @@ Ydaypctl(void *process)
if (field.ptr) Free(field.ptr);
if (recVarID) Free(recVarID);
if (recLevelID) Free(recLevelID);
pstreamClose(streamID4);
pstreamClose(streamID3);
pstreamClose(streamID2);
......
......@@ -70,10 +70,9 @@ Yearmonstat(void *process)
pstreamDefVlist(streamID2, vlistID2);
int nvars = vlistNvars(vlistID1);
int nrecords = vlistNrecs(vlistID1);
int *recVarID = (int *) Malloc(nrecords * sizeof(int));
int *recLevelID = (int *) Malloc(nrecords * sizeof(int));
int maxrecs = vlistNrecs(vlistID1);
std::vector<recinfo_type> recinfo(maxrecs);
int calendar = taxisInqCalendar(taxisID1);
dtlist_type *dtlist = dtlist_new();
......@@ -125,8 +124,9 @@ Yearmonstat(void *process)
if (tsID == 0)
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT;
}
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
......@@ -210,13 +210,12 @@ Yearmonstat(void *process)
dtlist_stat_taxisDefTimestep(dtlist, taxisID2, nsets);
pstreamDefTimestep(streamID2, otsID);
for (int recID = 0; recID < nrecords; recID++)
for (int recID = 0; recID < maxrecs; recID++)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
if (otsID && vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue;
if (otsID && recinfo[recID].lconst) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, vars1[varID][levelID].ptr, vars1[varID][levelID].nmiss);
}
......@@ -230,9 +229,6 @@ Yearmonstat(void *process)
if (field.ptr) Free(field.ptr);
if (recVarID) Free(recVarID);
if (recLevelID) Free(recLevelID);
dtlist_delete(dtlist);
pstreamClose(streamID2);
......
......@@ -93,10 +93,9 @@ Ymonpctl(void *process)
pstreamDefVlist(streamID4, vlistID4);
int nvars = vlistNvars(vlistID1);
int nrecords = vlistNrecs(vlistID1);
int *recVarID = (int *) Malloc(nrecords * sizeof(int));
int *recLevelID = (int *) Malloc(nrecords * sizeof(int));
int maxrecs = vlistNrecs(vlistID1);
std::vector<recinfo_type> recinfo(maxrecs);
size_t gridsize = vlistGridsizeMax(vlistID1);
......@@ -182,8 +181,9 @@ Ymonpctl(void *process)
if (tsID == 0)
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT;
}
pstreamReadRecord(streamID1, vars1[month][varID][levelID].ptr, &nmiss);
......@@ -217,13 +217,12 @@ Ymonpctl(void *process)
taxisDefVtime(taxisID4, vtimes1[month]);
pstreamDefTimestep(streamID4, otsID);
for (int recID = 0; recID < nrecords; recID++)
for (int recID = 0; recID < maxrecs; recID++)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
if (otsID && vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue;
if (otsID && recinfo[recID].lconst) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
pstreamDefRecord(streamID4, varID, levelID);
pstreamWriteRecord(streamID4, vars1[month][varID][levelID].ptr, vars1[month][varID][levelID].nmiss);
}
......@@ -242,9 +241,6 @@ Ymonpctl(void *process)
if (field.ptr) Free(field.ptr);
if (recVarID) Free(recVarID);
if (recLevelID) Free(recLevelID);
pstreamClose(streamID4);
pstreamClose(streamID3);
pstreamClose(streamID2);
......
......@@ -99,10 +99,9 @@ Yseaspctl(void *process)
pstreamDefVlist(streamID4, vlistID4);
int nvars = vlistNvars(vlistID1);
int nrecords = vlistNrecs(vlistID1);
int *recVarID = (int *) Malloc(nrecords * sizeof(int));
int *recLevelID = (int *) Malloc(nrecords * sizeof(int));
int maxrecs = vlistNrecs(vlistID1);
std::vector<recinfo_type> recinfo(maxrecs);
size_t gridsize = vlistGridsizeMax(vlistID1);
......@@ -192,8 +191,9 @@ Yseaspctl(void *process)
if (tsID == 0)
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT;
}
pstreamReadRecord(streamID1, vars1[seas][varID][levelID].ptr, &nmiss);
......@@ -228,12 +228,11 @@ Yseaspctl(void *process)
taxisDefVtime(taxisID4, datetime1[seas].vtime);
pstreamDefTimestep(streamID4, otsID);
for (int recID = 0; recID < nrecords; recID++)
for (int recID = 0; recID < maxrecs; recID++)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
if (otsID && vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT) continue;
if (otsID && recinfo[recID].lconst) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
pstreamDefRecord(streamID4, varID, levelID);
pstreamWriteRecord(streamID4, vars1[seas][varID][levelID].ptr, vars1[seas][varID][levelID].nmiss);
......@@ -253,9 +252,6 @@ Yseaspctl(void *process)
if (field.ptr) Free(field.ptr);
if (recVarID) Free(recVarID);
if (recLevelID) Free(recLevelID);
pstreamClose(streamID4);
pstreamClose(streamID3);
pstreamClose(streamID2);
......
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