Commit 91bd224e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Rename streamXXX() to pstreamXXX().

parent 0cf0f272
......@@ -176,9 +176,9 @@ void *Adisit(void *argument)
if ( operatorArgc() == 1 ) pin = parameter2double(operatorArgv()[0]);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int nvars = vlistNvars(vlistID1);
......@@ -294,31 +294,31 @@ void *Adisit(void *argument)
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
pstreamDefVlist(streamID2, vlistID2);
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; ++recID )
{
streamInqRecord(streamID1, &varID, &levelID);
pstreamInqRecord(streamID1, &varID, &levelID);
offset = gridsize*levelID;
if ( varID == thoID )
{
streamReadRecord(streamID1, tho.ptr+offset, &nmiss);
pstreamReadRecord(streamID1, tho.ptr+offset, &nmiss);
tho.nmiss = (size_t) nmiss;
}
if ( varID == saoID )
{
streamReadRecord(streamID1, sao.ptr+offset, &nmiss);
pstreamReadRecord(streamID1, sao.ptr+offset, &nmiss);
sao.nmiss = (size_t) nmiss;
}
}
......@@ -339,8 +339,8 @@ void *Adisit(void *argument)
for ( i = 0; i < gridsize; ++i )
if ( DBL_IS_EQUAL(single[i], tis.missval) ) nmiss++;
streamDefRecord(streamID2, tisID2, levelID);
streamWriteRecord(streamID2, single, nmiss);
pstreamDefRecord(streamID2, tisID2, levelID);
pstreamWriteRecord(streamID2, single, nmiss);
single = sao.ptr+offset;
......@@ -348,15 +348,15 @@ void *Adisit(void *argument)
for ( i = 0; i < gridsize; ++i )
if ( DBL_IS_EQUAL(single[i], sao.missval) ) nmiss++;
streamDefRecord(streamID2, saoID2, levelID);
streamWriteRecord(streamID2, single, nmiss);
pstreamDefRecord(streamID2, saoID2, levelID);
pstreamWriteRecord(streamID2, single, nmiss);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
vlistDestroy(vlistID2);
......
......@@ -61,8 +61,8 @@ void *Arith(void *argument)
int operfunc = cdoOperatorF1(operatorID);
operatorCheckArgc(0);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID2 = streamOpenRead(cdoStreamName(1));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int streamID2 = pstreamOpenRead(cdoStreamName(1));
int streamIDx1 = streamID1;
int streamIDx2 = streamID2;
......@@ -71,8 +71,8 @@ void *Arith(void *argument)
field_type *fieldx1 = &field1;
field_type *fieldx2 = &field2;
int vlistID1 = streamInqVlist(streamID1);
int vlistID2 = streamInqVlist(streamID2);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = pstreamInqVlist(streamID2);
int vlistIDx1 = vlistID1;
int vlistIDx2 = vlistID2;
......@@ -200,17 +200,16 @@ void *Arith(void *argument)
int taxisID3 = taxisDuplicate(taxisIDx1);
vlistDefTaxis(vlistID3, taxisID3);
int streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
streamDefVlist(streamID3, vlistID3);
int streamID3 = pstreamOpenWrite(cdoStreamName(2), cdoFiletype());
pstreamDefVlist(streamID3, vlistID3);
int tsID = 0;
int tsID2 = 0;
while ( (nrecs = streamInqTimestep(streamIDx1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamIDx1, tsID)) )
{
if ( tsID == 0 || filltype == FILL_NONE || filltype == FILL_FILE || filltype == FILL_VARTS )
{
nrecs2 = streamInqTimestep(streamIDx2, tsID2);
nrecs2 = pstreamInqTimestep(streamIDx2, tsID2);
if ( nrecs2 == 0 )
{
if ( filltype == FILL_NONE && streamIDx2 == streamID2 )
......@@ -222,16 +221,16 @@ void *Arith(void *argument)
if ( filltype == FILL_FILE )
{
tsID2 = 0;
streamClose(streamID2);
streamID2 = streamOpenRead(cdoStreamName(1));
pstreamClose(streamID2);
streamID2 = pstreamOpenRead(cdoStreamName(1));
streamIDx2 = streamID2;
vlistID2 = streamInqVlist(streamID2);
vlistID2 = pstreamInqVlist(streamID2);
vlistIDx2 = vlistID2;
vlistCompare(vlistID1, vlistID2, CMP_DIM);
nrecs2 = streamInqTimestep(streamIDx2, tsID2);
nrecs2 = pstreamInqTimestep(streamIDx2, tsID2);
if ( nrecs2 == 0 )
cdoAbort("Empty input stream %s!", cdoStreamName(1)->args);
}
......@@ -242,12 +241,12 @@ void *Arith(void *argument)
taxisCopyTimestep(taxisID3, taxisIDx1);
streamDefTimestep(streamID3, tsID);
pstreamDefTimestep(streamID3, tsID);
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamIDx1, &varID, &levelID);
streamReadRecord(streamIDx1, fieldx1->ptr, &nmiss);
pstreamInqRecord(streamIDx1, &varID, &levelID);
pstreamReadRecord(streamIDx1, fieldx1->ptr, &nmiss);
fieldx1->nmiss = (size_t) nmiss;
int varID2 = varID;
......@@ -257,8 +256,8 @@ void *Arith(void *argument)
if ( lstatus || (filltype != FILL_VAR && filltype != FILL_VARTS) )
{
streamInqRecord(streamIDx2, &varID2, &levelID2);
streamReadRecord(streamIDx2, fieldx2->ptr, &nmiss);
pstreamInqRecord(streamIDx2, &varID2, &levelID2);
pstreamReadRecord(streamIDx2, fieldx2->ptr, &nmiss);
fieldx2->nmiss = (size_t) nmiss;
if ( varID != varID2 ) cdoAbort("Internal error, varIDs of input streams differ!");
if ( levelID != levelID2 ) cdoAbort("Internal error, levelIDs of input streams differ!");
......@@ -309,17 +308,17 @@ void *Arith(void *argument)
farfun(&field1, field2, operfunc);
streamDefRecord(streamID3, varID, levelID);
streamWriteRecord(streamID3, field1.ptr, (int)field1.nmiss);
pstreamDefRecord(streamID3, varID, levelID);
pstreamWriteRecord(streamID3, field1.ptr, (int)field1.nmiss);
}
tsID++;
tsID2++;
}
streamClose(streamID3);
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID3);
pstreamClose(streamID2);
pstreamClose(streamID1);
vlistDestroy(vlistID3);
......
......@@ -91,9 +91,9 @@ void *Arithc(void *argument)
operatorCheckArgc(1);
double rconst = parameter2double(operatorArgv()[0]);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
int *vars = fill_vars(vlistID1);
......@@ -102,9 +102,8 @@ void *Arithc(void *argument)
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
int gridsize = vlistGridsizeMax(vlistID1);
......@@ -114,16 +113,16 @@ void *Arithc(void *argument)
field.weight = NULL;
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, field.ptr, &nmiss);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, field.ptr, &nmiss);
field.nmiss = (size_t) nmiss;
if ( vars[varID] )
......@@ -141,14 +140,14 @@ void *Arithc(void *argument)
}
nmiss = (int) field.nmiss;
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, field.ptr, nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, field.ptr, nmiss);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
if ( field.ptr ) Free(field.ptr);
if ( vars ) Free(vars);
......
......@@ -88,9 +88,9 @@ void *Arithdays(void *argument)
int operfunc = cdoOperatorF1(operatorID);
int operfunc2 = cdoOperatorF2(operatorID);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
......@@ -99,9 +99,8 @@ void *Arithdays(void *argument)
int calendar = taxisInqCalendar(taxisID1);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
int gridsize = vlistGridsizeMax(vlistID1);
......@@ -111,14 +110,14 @@ void *Arithdays(void *argument)
field.weight = NULL;
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
int vdate = taxisInqVdate(taxisID1);
int vtime = taxisInqVtime(taxisID1);
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
cdiDecodeDate(vdate, &year, &month, &day);
......@@ -139,8 +138,8 @@ void *Arithdays(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, field.ptr, &nmiss);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, field.ptr, &nmiss);
field.nmiss = (size_t)nmiss;
field.grid = vlistInqVarGrid(vlistID1, varID);
......@@ -148,14 +147,14 @@ void *Arithdays(void *argument)
farcfun(&field, rconst, operfunc);
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, field.ptr, (int)field.nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, field.ptr, (int)field.nmiss);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
if ( field.ptr ) Free(field.ptr);
......
......@@ -49,34 +49,33 @@ void *Arithlat(void *argument)
int operatorID = cdoOperatorID();
int operfunc = cdoOperatorF1(operatorID);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
long gridsize = vlistGridsizeMax(vlistID1);
double *array = (double*) Malloc(gridsize*sizeof(double));
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array, &nmiss);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, array, &nmiss);
int gridID = vlistInqVarGrid(vlistID1, varID);
......@@ -131,15 +130,15 @@ void *Arithlat(void *argument)
for ( i = 0; i < gridsize; ++i ) array[i] *= scale[i];
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, array, nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, array, nmiss);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
if ( array ) Free(array);
if ( scale ) Free(scale);
......
......@@ -116,11 +116,11 @@ void *CDIread(void *argument)
data_size = 0;
nvalues = 0;
int streamID = streamOpenRead(cdoStreamName(0));
int streamID = pstreamOpenRead(cdoStreamName(0));
int vlistID = streamInqVlist(streamID);
int vlistID = pstreamInqVlist(streamID);
filetype = streamInqFiletype(streamID);
filetype = pstreamInqFiletype(streamID);
datatype = vlistInqVarDatatype(vlistID, 0);
int gridsize = vlistGridsizeMax(vlistID);
......@@ -131,25 +131,25 @@ void *CDIread(void *argument)
t0 = timer_val(timer_read);
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID, tsID)) )
{
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID, &varID, &levelID);
pstreamInqRecord(streamID, &varID, &levelID);
gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID));
nvalues += gridsize;
if ( memtype == MEMTYPE_FLOAT )
{
streamReadRecordF(streamID, farray, &nmiss);
pstreamReadRecordF(streamID, farray, &nmiss);
// for ( int i = 0; i < gridsize; ++i ) darray[i] = farray[i];
data_size += gridsize*4;
}
else
{
streamReadRecord(streamID, darray, &nmiss);
pstreamReadRecord(streamID, darray, &nmiss);
data_size += gridsize*8;
}
}
......@@ -164,7 +164,7 @@ void *CDIread(void *argument)
tsID++;
}
streamClose(streamID);
pstreamClose(streamID);
tw = timer_val(timer_read) - tw0;
twsum += tw;
......
......@@ -54,51 +54,50 @@ void *CDItest(void *argument)
int n = 0;
while ( TRUE )
{
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int taxisID1 = vlistInqTaxis(vlistID1);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
int vlistID2 = vlistDuplicate(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
int gridsize = vlistGridsizeMax(vlistID1);
double *array = (double*) Malloc(gridsize*sizeof(double));
int tsID1 = 0;
int tsID2 = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID1)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID1)) )
{
taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID2);
pstreamDefTimestep(streamID2, tsID2);
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamDefRecord(streamID2, varID, levelID);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamDefRecord(streamID2, varID, levelID);
if ( lcopy )
{
streamCopyRecord(streamID2, streamID1);
pstreamCopyRecord(streamID2, streamID1);
}
else
{
streamReadRecord(streamID1, array, &nmiss);
streamWriteRecord(streamID2, array, nmiss);
pstreamReadRecord(streamID1, array, &nmiss);
pstreamWriteRecord(streamID2, array, nmiss);
}
}
tsID1++;
tsID2++;
}
streamClose(streamID1);
streamClose(streamID2);
pstreamClose(streamID1);
pstreamClose(streamID2);
vlistDestroy(vlistID2);
taxisDestroy(taxisID2);
......
......@@ -92,7 +92,6 @@ void *CDIwrite(void *argument)
int memtype = CDO_Memtype;
int nvars = 10, nlevs = 0, ntimesteps = 30;
const char *defaultgrid = "global_.2";
int streamID;
int tsID, varID, levelID;
int gridsize, i;
int vlistID;
......@@ -215,11 +214,11 @@ void *CDIwrite(void *argument)
data_size = 0;
nvalues = 0;
streamID = streamOpenWrite(cdoStreamName(0), cdoFiletype());
int streamID = pstreamOpenWrite(cdoStreamName(0), cdoFiletype());
streamDefVlist(streamID, vlistID);
pstreamDefVlist(streamID, vlistID);
filetype = streamInqFiletype(streamID);
filetype = pstreamInqFiletype(streamID);
datatype = vlistInqVarDatatype(vlistID, 0);
if ( datatype == CDI_UNDEFID ) datatype = CDI_DATATYPE_FLT32;
......@@ -233,24 +232,24 @@ void *CDIwrite(void *argument)
vtime = 0;
taxisDefVdate(taxisID, vdate);
taxisDefVtime(taxisID, vtime);
streamDefTimestep(streamID, tsID);
pstreamDefTimestep(streamID, tsID);
for ( varID = 0; varID < nvars; varID++ )
{
for ( levelID = 0; levelID < nlevs; levelID++ )
{
nvalues += gridsize;
streamDefRecord(streamID, varID, levelID);
pstreamDefRecord(streamID, varID, levelID);
if ( memtype == MEMTYPE_FLOAT )
{
double *darray = vars[varID][levelID];
for ( i = 0; i < gridsize; ++i ) farray[i] = darray[i];
streamWriteRecordF(streamID, farray, 0);
pstreamWriteRecordF(streamID, farray, 0);
data_size += gridsize*4;
}
else
{
streamWriteRecord(streamID, vars[varID][levelID], 0);
pstreamWriteRecord(streamID, vars[varID][levelID], 0);
data_size += gridsize*8;
}
}
......@@ -264,7 +263,7 @@ void *CDIwrite(void *argument)
}
}
streamClose(streamID);
pstreamClose(streamID);
tw = timer_val(timer_write) - tw0;
twsum += tw;
......
......@@ -715,12 +715,12 @@ static void addcharvar(keyValues_t *charvars, int vlistID, char *key, struct map
if ( cdoStreamName(0)->args[0] == '-' )
cdoAbort("No variables can be merged to one character axis since you piped several cdo operators.");
int streamID2 = streamOpenRead(cdoStreamName(0));
int streamID2 = pstreamOpenRead(cdoStreamName(0));
if ( ntsteps == -1 )
{
ntsteps = 0;
int dummy;
while ( ( dummy = streamInqTimestep(streamID2, ntsteps++) ) );
while ( ( dummy = pstreamInqTimestep(streamID2, ntsteps++) ) );
}
int axissize[3];
......@@ -803,16 +803,16 @@ static void addcharvar(keyValues_t *charvars, int vlistID, char *key, struct map
int tsID = 0, nrecs = 0;
while ( (nrecs = streamInqTimestep(streamID2, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID2, tsID)) )
{
while ( nrecs-- )
{
int varIDrw, levelIDrw, nmiss;
streamInqRecord(streamID2, &varIDrw, &levelIDrw);
pstreamInqRecord(streamID2, &varIDrw, &levelIDrw);
for ( int i = 0; i < charvars->nvalues; i++ )
if ( varIDrw == varIDs[i] )
{
streamReadRecord(streamID2, buffer_old, &nmiss);
pstreamReadRecord(streamID2, buffer_old, &nmiss);
int newIndex;
for ( int j = 0; j < oldgridsize; j++ )
{
......@@ -832,7 +832,7 @@ static void addcharvar(keyValues_t *charvars, int vlistID, char *key, struct map
}
var->charvars = 1;
streamClose(streamID2);
pstreamClose(streamID2);
Free(buffer_old);
if ( cdoVerbose )
......@@ -1057,7 +1057,7 @@ static int check_mem(list_t *kvl, char *project_id)
static void dump_global_attributes(list_t *pml, int streamID)
{
int natts;
int vlistID = streamInqVlist(streamID);
int vlistID = pstreamInqVlist(streamID);
cdiInqNatts(vlistID, CDI_GLOBAL, &natts);
for ( int i = 0; i < natts; i++ )
{
......@@ -1094,7 +1094,7 @@ static void dump_global_attributes(list_t *pml, int streamID)
static void dump_special_attributes(list_t *kvl, int streamID)
{
int vlistID = streamInqVlist(streamID);