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

Merge declaration and definition

parent 069d3b0c
......@@ -81,8 +81,6 @@ void *Timstat(void *argument)
int vdate0 = 0, vtime0 = 0;
int nrecs;
int varID, levelID, recID;
int tsID;
int otsID;
long nsets;
int i;
int streamID3 = -1;
......@@ -94,8 +92,6 @@ void *Timstat(void *argument)
char indate1[DATE_LEN+1], indate2[DATE_LEN+1];
double vfrac = 1;
double missval;
field_t **vars1 = NULL, **vars2 = NULL, **samp1 = NULL;
field_t field;
cdoInitialize(argument);
......@@ -227,16 +223,17 @@ void *Timstat(void *argument)
gridsize = vlistGridsizeMax(vlistID1);
if ( vlistNumber(vlistID1) != CDI_REAL ) gridsize *= 2;
field_t field;
field_init(&field);
field.ptr = (double*) malloc(gridsize*sizeof(double));
vars1 = field_malloc(vlistID1, FIELD_PTR);
samp1 = field_malloc(vlistID1, FIELD_NONE);
if ( lvarstd )
vars2 = field_malloc(vlistID1, FIELD_PTR);
field_t **vars1 = field_malloc(vlistID1, FIELD_PTR);
field_t **samp1 = field_malloc(vlistID1, FIELD_NONE);
field_t **vars2 = NULL;
if ( lvarstd ) vars2 = field_malloc(vlistID1, FIELD_PTR);
tsID = 0;
otsID = 0;
int tsID = 0;
int otsID = 0;
while ( TRUE )
{
nsets = 0;
......
......@@ -107,66 +107,56 @@ int covariance_t(long gridsize, double missval1, double missval2, int *nofvals,
void *Timstat2(void *argument)
{
int operatorID;
int operfunc;
int nwork = 0;
int streamID1, streamID2, streamID3;
int vdate = 0, vtime = 0;
int nrecs, nrecs2, nrecs3, nvars, nlevs;
int nrecs2, nlevs;
long i, gridsize;
int tsID;
int varID, recID, levelID, gridID;
int nmiss;
int *recVarID, *recLevelID;
int vlistID1, vlistID2, vlistID3;
int taxisID1, taxisID2, taxisID3;
double missval1, missval2;
double ****work = NULL;
int ***nofvals = NULL;
double *array1 = NULL, *array2 = NULL;
cdoInitialize(argument);
cdoOperatorAdd("timcor", func_cor, 0, NULL);
cdoOperatorAdd("timcovar", func_covar, 0, NULL);
operatorID = cdoOperatorID();
operfunc = cdoOperatorF1(operatorID);
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
if ( operfunc == func_cor ) nwork = 5;
else if ( operfunc == func_covar ) nwork = 3;
streamID1 = streamOpenRead(cdoStreamName(0));
streamID2 = streamOpenRead(cdoStreamName(1));
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID2 = streamOpenRead(cdoStreamName(1));
vlistID1 = streamInqVlist(streamID1);
vlistID2 = streamInqVlist(streamID2);
vlistID3 = vlistDuplicate(vlistID1);
int vlistID1 = streamInqVlist(streamID1);
int vlistID2 = streamInqVlist(streamID2);
int vlistID3 = vlistDuplicate(vlistID1);
vlistCompare(vlistID1, vlistID2, CMP_ALL);
nvars = vlistNvars(vlistID1);
nrecs = vlistNrecs(vlistID1);
nrecs3 = nrecs;
recVarID = (int*) malloc(nrecs*sizeof(int));
recLevelID = (int*) malloc(nrecs*sizeof(int));
taxisID1 = vlistInqTaxis(vlistID1);
taxisID2 = vlistInqTaxis(vlistID2);
taxisID3 = taxisDuplicate(taxisID1);
int nvars = vlistNvars(vlistID1);
int nrecs = vlistNrecs(vlistID1);
int nrecs3 = nrecs;
int *recVarID = (int*) malloc(nrecs*sizeof(int));
int *recLevelID = (int*) malloc(nrecs*sizeof(int));
int taxisID1 = vlistInqTaxis(vlistID1);
//int taxisID2 = vlistInqTaxis(vlistID2);
int taxisID3 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID3, taxisID3);
streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
int streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
streamDefVlist(streamID3, vlistID3);
gridsize = vlistGridsizeMax(vlistID1);
array1 = (double*) malloc(gridsize*sizeof(double));
array2 = (double*) malloc(gridsize*sizeof(double));
double *array1 = (double*) malloc(gridsize*sizeof(double));
double *array2 = (double*) malloc(gridsize*sizeof(double));
work = (double ****) malloc(nvars*sizeof(double ***));
nofvals = (int ***) malloc(nvars*sizeof(int **));
double ****work = (double ****) malloc(nvars*sizeof(double ***));
int ***nofvals = (int ***) malloc(nvars*sizeof(int **));
for ( varID = 0; varID < nvars; varID++ )
{
......@@ -191,7 +181,7 @@ void *Timstat2(void *argument)
}
}
tsID=0;
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
{
vdate = taxisInqVdate(taxisID1);
......
......@@ -37,18 +37,14 @@
void *Timstat3(void *argument)
{
int VARQUOT2TEST, MEANDIFF2TEST;
int operatorID;
int streamID[NIN], streamID3;
int vlistID[NIN], vlistID2 = -1, vlistID3 = -1;
int streamID[NIN];
int vlistID[NIN], vlistID2 = -1;
int gridsize;
int vdate = 0, vtime = 0;
int nrecs, nrecs3, nvars, nlevs ;
int nlevs;
int i, iw, is;
int tsID;
int varID, recID, levelID, gridID;
int nmiss3;
int *recVarID, *recLevelID;
int taxisID1, taxisID3;
double rconst, risk;
double fnvals0, fnvals1;
double missval, missval1, missval2;
......@@ -66,7 +62,7 @@ void *Timstat3(void *argument)
VARQUOT2TEST = cdoOperatorAdd("varquot2test", 0, 0, NULL);
MEANDIFF2TEST = cdoOperatorAdd("meandiff2test", 0, 0, NULL);
operatorID = cdoOperatorID();
int operatorID = cdoOperatorID();
operatorInputArg("constant and risk (e.g. 0.05)");
operatorCheckArgc(2);
......@@ -94,20 +90,20 @@ void *Timstat3(void *argument)
}
}
vlistID3 = vlistDuplicate(vlistID[0]);
int vlistID3 = vlistDuplicate(vlistID[0]);
gridsize = vlistGridsizeMax(vlistID[0]);
nvars = vlistNvars(vlistID[0]);
nrecs = vlistNrecs(vlistID[0]);
nrecs3 = nrecs;
recVarID = (int*) malloc(nrecs*sizeof(int));
recLevelID = (int*) malloc(nrecs*sizeof(int));
taxisID1 = vlistInqTaxis(vlistID[0]);
taxisID3 = taxisDuplicate(taxisID1);
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 taxisID1 = vlistInqTaxis(vlistID[0]);
int taxisID3 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID3, taxisID3);
streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
int streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
streamDefVlist(streamID3, vlistID3);
......@@ -163,7 +159,7 @@ void *Timstat3(void *argument)
}
}
tsID=0;
int tsID = 0;
while ( TRUE )
{
for ( is = 0; is < NIN; ++is )
......@@ -219,10 +215,10 @@ void *Timstat3(void *argument)
tsID++;
}
tsID = 0;
taxisDefVdate(taxisID3, vdate);
taxisDefVtime(taxisID3, vtime);
streamDefTimestep(streamID3, tsID);
streamDefTimestep(streamID3, 0);
for ( recID = 0; recID < nrecs3; recID++ )
{
......
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