Commit 8a16f687 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced recinfo_t by recinfo_type.

parent 58eb2e4e
......@@ -35,12 +35,6 @@
#include "pstream.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Runstat(void *argument)
{
int timestat_date = TIMESTAT_MEAN;
......@@ -105,8 +99,7 @@ void *Runstat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date);
......@@ -147,6 +140,7 @@ void *Runstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = samp1 ? &samp1[tsID][varID][levelID] : NULL;
......@@ -228,6 +222,8 @@ void *Runstat(void *argument)
{
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = samp1 ? &samp1[0][varID][levelID] : NULL;
......@@ -235,8 +231,6 @@ void *Runstat(void *argument)
field_type *pvars2 = vars2 ? &vars2[0][varID][levelID] : NULL;
int nsets = ndates;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( !runstat_nomiss ) fardiv(pvars1, *psamp1);
......@@ -266,12 +260,12 @@ void *Runstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[0][varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, pvars1->nmiss);
}
......@@ -395,8 +389,6 @@ void *Runstat(void *argument)
dtlist_delete(dtlist);
Free(recinfo);
pstreamClose(streamID2);
pstreamClose(streamID1);
......
......@@ -37,12 +37,6 @@
#include "pstream.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Seasstat(void *argument)
{
int timestat_date = TIMESTAT_MEAN;
......@@ -97,8 +91,7 @@ void *Seasstat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date);
......@@ -158,6 +151,7 @@ void *Seasstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = &samp1[varID][levelID];
......@@ -227,13 +221,13 @@ void *Seasstat(void *argument)
if ( nsets == 0 && lvarstd )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = &vars2[varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farmoq(pvars2, *pvars1);
}
......@@ -247,14 +241,14 @@ void *Seasstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[varID][levelID];
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( psamp1->ptr ) fardiv(pvars1, *psamp1);
......@@ -304,12 +298,12 @@ void *Seasstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, (int)pvars1->nmiss);
}
......@@ -325,8 +319,6 @@ void *Seasstat(void *argument)
dtlist_delete(dtlist);
Free(recinfo);
if ( field.ptr ) Free(field.ptr);
pstreamClose(streamID2);
......
......@@ -37,12 +37,6 @@
#include "pstream.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Timselstat(void *argument)
{
int timestat_date = TIMESTAT_MEAN;
......@@ -98,8 +92,7 @@ void *Timselstat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date);
......@@ -129,6 +122,7 @@ void *Timselstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
}
}
......@@ -157,6 +151,7 @@ void *Timselstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = &samp1[varID][levelID];
......@@ -226,13 +221,13 @@ void *Timselstat(void *argument)
if ( nsets == 0 && lvarstd )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = &vars2[varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farmoq(pvars2, *pvars1);
}
......@@ -243,14 +238,14 @@ void *Timselstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[varID][levelID];
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( psamp1->ptr ) fardiv(pvars1, *psamp1);
......@@ -280,12 +275,12 @@ void *Timselstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, (int)pvars1->nmiss);
}
......@@ -312,8 +307,6 @@ void *Timselstat(void *argument)
dtlist_delete(dtlist);
Free(recinfo);
if ( field.ptr ) Free(field.ptr);
pstreamClose(streamID2);
......
......@@ -77,12 +77,6 @@
#include "pstream.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Timstat(void *argument)
{
enum {HOUR_LEN=4, DAY_LEN=6, MON_LEN=8, YEAR_LEN=10};
......@@ -194,7 +188,6 @@ void *Timstat(void *argument)
vlistDefTaxis(vlistID2, taxisID2);
int nvars = vlistNvars(vlistID1);
int maxrecs = vlistNrecs(vlistID1);
if ( cmplen == 0 && CDO_Reduce_Dim )
for ( varID = 0; varID < nvars; ++varID )
......@@ -237,7 +230,8 @@ void *Timstat(void *argument)
pstreamDefVlist(streamID3, vlistID3);
}
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
int maxrecs = vlistNrecs(vlistID1);
std::vector<recinfo_type> recinfo(maxrecs);
dtlist_type *dtlist = dtlist_new();
dtlist_set_stat(dtlist, timestat_date);
......@@ -286,6 +280,7 @@ void *Timstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = &samp1[varID][levelID];
......@@ -359,13 +354,13 @@ void *Timstat(void *argument)
if ( nsets == 0 && lvarstd )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = &vars2[varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farmoq(pvars2, *pvars1);
}
......@@ -379,14 +374,14 @@ void *Timstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[varID][levelID];
field_type *pvars1 = &vars1[varID][levelID];
field_type *pvars2 = vars2 ? &vars2[varID][levelID] : NULL;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( psamp1->ptr ) fardiv(pvars1, *psamp1);
......@@ -422,13 +417,13 @@ void *Timstat(void *argument)
if ( lvfrac && operfunc == func_mean )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[varID][levelID];
field_type *pvars1 = &vars1[varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
int nwpv = pvars1->nwpv;
int gridsize = gridInqSize(pvars1->grid);
double missval = pvars1->missval;
......@@ -464,13 +459,13 @@ void *Timstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[varID][levelID];
field_type *pvars1 = &vars1[varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, pvars1->nmiss);
......@@ -505,7 +500,6 @@ void *Timstat(void *argument)
pstreamClose(streamID1);
if ( field.ptr ) Free(field.ptr);
Free(recinfo);
cdoFinish();
......
......@@ -74,15 +74,10 @@
//#include "pstream_write.h"
typedef struct {
short varID;
short levelID;
} recinfo_t;
typedef struct {
int tsIDnext;
int streamID, nrecs;
recinfo_t *recinfo;
recinfo_type *recinfo;
field_type **vars;
}
readarg_t;
......@@ -95,7 +90,7 @@ void *cdoReadTimestep(void *rarg)
int varID, levelID, nmiss;
readarg_t *readarg = (readarg_t *) rarg;
field_type **input_vars = readarg->vars;
recinfo_t *recinfo = readarg->recinfo;
recinfo_type *recinfo = readarg->recinfo;
int streamID = readarg->streamID;
int tsIDnext = readarg->tsIDnext;
int nrecs = readarg->nrecs;
......@@ -321,7 +316,7 @@ void *XTimstat(void *argument)
int otsID = 0;
int nrecs = pstreamInqTimestep(streamID1, tsID);
int maxrecs = nrecs;
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
recinfo_type *recinfo = (recinfo_type *) Malloc(maxrecs*sizeof(recinfo_type));
tsID++;
while ( TRUE )
......
......@@ -38,11 +38,6 @@
#define MAX_DOY 373
typedef struct {
short varID;
short levelID;
} recinfo_t;
void *Ydaystat(void *argument)
{
......@@ -100,8 +95,7 @@ void *Ydaystat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
int gridsizemax = vlistGridsizeMax(vlistID1);
......@@ -145,6 +139,7 @@ void *Ydaystat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = &samp1[dayoy][varID][levelID];
......@@ -215,13 +210,13 @@ void *Ydaystat(void *argument)
if ( dayoy_nsets[dayoy] == 0 && lvarstd )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[dayoy][varID][levelID];
field_type *pvars2 = &vars2[dayoy][varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farmoq(pvars2, *pvars1);
}
......@@ -251,14 +246,14 @@ void *Ydaystat(void *argument)
int nsets = dayoy_nsets[dayoy];
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[dayoy][varID][levelID];
field_type *pvars1 = &vars1[dayoy][varID][levelID];
field_type *pvars2 = vars2[dayoy] ? &vars2[dayoy][varID][levelID] : NULL;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( psamp1->ptr ) fardiv(pvars1, *psamp1);
......@@ -289,12 +284,12 @@ void *Ydaystat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[dayoy][varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, (int)pvars1->nmiss);
}
......@@ -314,8 +309,6 @@ void *Ydaystat(void *argument)
if ( field.ptr ) Free(field.ptr);
Free(recinfo);
pstreamClose(streamID2);
pstreamClose(streamID1);
......
......@@ -38,11 +38,6 @@
#define NDAY 373
typedef struct {
short varID;
short levelID;
} recinfo_t;
typedef struct {
int vdate[NDAY];
......@@ -110,8 +105,7 @@ void *Ydrunstat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
cdo_datetime_t *datetime = (cdo_datetime_t*) Malloc((ndates+1)*sizeof(cdo_datetime_t));
......@@ -145,6 +139,7 @@ void *Ydrunstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *pvars1 = &vars1[tsID][varID][levelID];
......@@ -265,12 +260,12 @@ void *Ydrunstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &stats->vars1[dayoy][varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, pvars1->nmiss);
}
......@@ -290,8 +285,6 @@ void *Ydrunstat(void *argument)
if ( datetime ) Free(datetime);
Free(recinfo);
pstreamClose(streamID2);
pstreamClose(streamID1);
......
......@@ -38,11 +38,6 @@
#define MAX_HOUR 9301 /* 31*12*25 + 1 */
typedef struct {
short varID;
short levelID;
} recinfo_t;
static
int hour_of_year(int vdate, int vtime)
......@@ -126,8 +121,7 @@ void *Yhourstat(void *argument)
pstreamDefVlist(streamID2, vlistID2);
int maxrecs = vlistNrecs(vlistID1);
recinfo_t *recinfo = (recinfo_t *) Malloc(maxrecs*sizeof(recinfo_t));
std::vector<recinfo_type> recinfo(maxrecs);
int gridsizemax = vlistGridsizeMax(vlistID1);
......@@ -165,6 +159,7 @@ void *Yhourstat(void *argument)
{
recinfo[recID].varID = varID;
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT;
}
field_type *psamp1 = &samp1[houroy][varID][levelID];
......@@ -235,13 +230,13 @@ void *Yhourstat(void *argument)
if ( houroy_nsets[houroy] == 0 && lvarstd )
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[houroy][varID][levelID];
field_type *pvars2 = &vars2[houroy][varID][levelID];
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
farmoq(pvars2, *pvars1);
}
......@@ -255,14 +250,14 @@ void *Yhourstat(void *argument)
int nsets = houroy_nsets[houroy];
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *psamp1 = &samp1[houroy][varID][levelID];
field_type *pvars1 = &vars1[houroy][varID][levelID];
field_type *pvars2 = vars2[houroy] ? &vars2[houroy][varID][levelID] : NULL;
if ( vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
if ( lmean )
{
if ( psamp1->ptr ) fardiv(pvars1, *psamp1);
......@@ -293,12 +288,12 @@ void *Yhourstat(void *argument)
for ( int recID = 0; recID < maxrecs; recID++ )
{
if ( otsID && recinfo[recID].lconst ) continue;
int varID = recinfo[recID].varID;
int levelID = recinfo[recID].levelID;
field_type *pvars1 = &vars1[houroy][varID][levelID];
if ( otsID && vlistInqVarTsteptype(vlistID1, varID) == TSTEP_CONSTANT ) continue;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, pvars1->ptr, (int)pvars1->nmiss);
}
......@@ -318,8 +313,6 @@ void *Yhourstat(void *argument)
if ( field.ptr ) Free(field.ptr);
Free(recinfo);
pstreamClose(streamID2);
pstreamClose(streamID1);
......
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