Commit 2861ddb5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed streamXXX() to pstreamXXX().

parent c8eee4b3
......@@ -145,9 +145,9 @@ void *Output(void *argument)
for ( int indf = 0; indf < cdoStreamCnt(); indf++ )
{
int streamID = streamOpenRead(cdoStreamName(indf));
int streamID = pstreamOpenRead(cdoStreamName(indf));
int vlistID = streamInqVlist(streamID);
int vlistID = pstreamInqVlist(streamID);
int ngrids = vlistNgrids(vlistID);
int ndiffgrids = 0;
......@@ -189,7 +189,7 @@ void *Output(void *argument)
int tsID = 0;
int taxisID = vlistInqTaxis(vlistID);
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID, tsID)) )
{
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
......@@ -200,7 +200,7 @@ void *Output(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID, &varID, &levelID);
pstreamInqRecord(streamID, &varID, &levelID);
vlistInqVarName(vlistID, varID, name);
int param = vlistInqVarParam(vlistID, varID);
......@@ -217,7 +217,7 @@ void *Output(void *argument)
if ( nlon*nlat != gridsize ) { nlon = gridsize; nlat = 1; }
streamReadRecord(streamID, array, &nmiss);
pstreamReadRecord(streamID, array, &nmiss);
if ( operatorID == OUTPUTSRV )
fprintf(stdout, "%4d %8g %8d %4d %8d %8d %d %d\n", code, level, vdate, vtime, nlon, nlat, 0, 0);
......@@ -432,9 +432,11 @@ void *Output(void *argument)
}
}
}
tsID++;
}
streamClose(streamID);
pstreamClose(streamID);
if ( array ) Free(array);
if ( grid_center_lon ) Free(grid_center_lon);
......
......@@ -258,9 +258,9 @@ void *Outputgmt(void *argument)
if ( cdoVerbose ) cptWrite(stderr, cpt);
}
int streamID = streamOpenRead(cdoStreamName(0));
int streamID = pstreamOpenRead(cdoStreamName(0));
int vlistID = streamInqVlist(streamID);
int vlistID = pstreamInqVlist(streamID);
int taxisID = vlistInqTaxis(vlistID);
int varID = 0;
......@@ -435,7 +435,7 @@ void *Outputgmt(void *argument)
}
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID, tsID)) )
{
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
......@@ -471,12 +471,12 @@ void *Outputgmt(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID, &varID, &levelID);
pstreamInqRecord(streamID, &varID, &levelID);
if ( varID != varID0 ) continue;
if ( recID > 0 && !lzon && !lmer ) continue;
streamReadRecord(streamID, array, &nmiss);
pstreamReadRecord(streamID, array, &nmiss);
if ( operatorID == OUTPUTCENTER2 && grid_is_circular )
make_cyclic(array, array2, nlon, nlat);
......@@ -561,8 +561,8 @@ void *Outputgmt(void *argument)
if ( nrecs < 2 ) cdoAbort("Too few fields!");
memcpy(uf, array, gridsize*sizeof(double));
streamInqRecord(streamID, &varID, &levelID);
streamReadRecord(streamID, vf, &nmiss);
pstreamInqRecord(streamID, &varID, &levelID);
pstreamReadRecord(streamID, vf, &nmiss);
for ( int j = 0; j < nlat; j += ninc )
for ( int i = 0; i < nlon; i += ninc )
......@@ -714,7 +714,7 @@ void *Outputgmt(void *argument)
tsID++;
}
streamClose(streamID);
pstreamClose(streamID);
if ( array ) Free(array);
if ( array2 ) Free(array2);
......
......@@ -94,9 +94,9 @@ void *Pack(void *argument)
cdoInitialize(argument);
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);
......@@ -106,7 +106,7 @@ void *Pack(void *argument)
int nvars = vlistNvars(vlistID1);
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
if ( tsID >= nalloc )
{
......@@ -120,11 +120,11 @@ void *Pack(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
pstreamInqRecord(streamID1, &varID, &levelID);
gridID = vlistInqVarGrid(vlistID1, varID);
gridsize = gridInqSize(gridID);
vars[tsID][varID][levelID].ptr = (double*) Malloc(gridsize*sizeof(double));
streamReadRecord(streamID1, vars[tsID][varID][levelID].ptr, &nmiss);
pstreamReadRecord(streamID1, vars[tsID][varID][levelID].ptr, &nmiss);
vars[tsID][varID][levelID].nmiss = nmiss;
}
......@@ -229,14 +229,13 @@ void *Pack(void *argument)
}
}
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
for ( tsID = 0; tsID < nts; tsID++ )
{
dtlist_taxisDefTimestep(dtlist, taxisID2, tsID);
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
for ( varID = 0; varID < nvars; varID++ )
{
......@@ -246,8 +245,8 @@ void *Pack(void *argument)
if ( vars[tsID][varID][levelID].ptr )
{
nmiss = vars[tsID][varID][levelID].nmiss;
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
Free(vars[tsID][varID][levelID].ptr);
vars[tsID][varID][levelID].ptr = NULL;
}
......@@ -261,8 +260,8 @@ void *Pack(void *argument)
dtlist_delete(dtlist);
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
cdoFinish();
......
......@@ -57,9 +57,9 @@ void *Pardup(void *argument)
else
cdoAbort("operator not implemented!");
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);
......@@ -92,20 +92,18 @@ void *Pardup(void *argument)
vlistDefVarParam(vlistID2, varID+nvars*i, cdiEncodeParam(-(varID+nvars*i+1), 255, 255));
}
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
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);
recVarID[recID] = varID;
recLevelID[recID] = levelID;
......@@ -114,7 +112,7 @@ void *Pardup(void *argument)
offset = gridsize*levelID;
single = vardata[varID] + offset;
streamReadRecord(streamID1, single, &nmiss);
pstreamReadRecord(streamID1, single, &nmiss);
varnmiss[varID][levelID] = nmiss;
}
......@@ -132,15 +130,15 @@ void *Pardup(void *argument)
memcpy(array, single, gridsize*sizeof(double));
streamDefRecord(streamID2, varID2, levelID);
streamWriteRecord(streamID2, array, nmiss);
pstreamDefRecord(streamID2, varID2, levelID);
pstreamWriteRecord(streamID2, array, nmiss);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
for ( varID = 0; varID < nvars; varID++ ) Free(vardata[varID]);
for ( varID = 0; varID < nvars; varID++ ) Free(varnmiss[varID]);
......
......@@ -49,18 +49,17 @@ void *Pinfo(void *argument)
int operatorID = cdoOperatorID();
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);
int gridsize = vlistGridsizeMax(vlistID1);
......@@ -69,14 +68,13 @@ void *Pinfo(void *argument)
int indg = 0;
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);
date2str(vdate, vdatestr, sizeof(vdatestr));
time2str(vtime, vtimestr, sizeof(vtimestr));
......@@ -93,8 +91,8 @@ void *Pinfo(void *argument)
" Minimum Mean Maximum\n");
}
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array1, &nmiss);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, array1, &nmiss);
indg += 1;
int code = vlistInqVarCode(vlistID1, varID);
......@@ -175,14 +173,15 @@ void *Pinfo(void *argument)
for ( i = 0; i < gridsize; i++ ) array2[i] = array1[i];
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, array2, nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, array2, nmiss);
}
tsID++;
}
streamClose(streamID1);
streamClose(streamID2);
pstreamClose(streamID1);
pstreamClose(streamID2);
if ( array1 ) Free(array1);
if ( array2 ) Free(array2);
......
......@@ -58,9 +58,9 @@ void *Pressure(void *argument)
int operatorID = cdoOperatorID();
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int gridsize = vlist_check_gridsize(vlistID1);
......@@ -221,24 +221,22 @@ void *Pressure(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 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);
if ( varID == pvarID )
{
streamReadRecord(streamID1, pdata, &nmiss);
pstreamReadRecord(streamID1, pdata, &nmiss);
if ( nmiss > 0 ) cdoAbort("Missing valus unsupported!");
}
}
......@@ -283,16 +281,16 @@ void *Pressure(void *argument)
varID = 0;
for ( levelID = 0; levelID < nlevel; levelID++ )
{
streamDefRecord(streamID2, varID, levelID);
pstreamDefRecord(streamID2, varID, levelID);
offset = levelID*gridsize;
streamWriteRecord(streamID2, pout+offset, 0);
pstreamWriteRecord(streamID2, pout+offset, 0);
}
tsID++;
}
streamClose(streamID2);
streamClose(streamID1);
pstreamClose(streamID2);
pstreamClose(streamID1);
if ( pdata ) Free(pdata);
if ( ps_prog ) Free(ps_prog);
......
......@@ -40,9 +40,9 @@ void *Regres(void *argument)
cdoInitialize(argument);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
vlistDefNtsteps(vlistID2, 1);
......@@ -51,13 +51,11 @@ void *Regres(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 streamID3 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID3, vlistID2);
int streamID3 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID3, vlistID2);
int nrecords = vlistNrecs(vlistID1);
......@@ -77,16 +75,16 @@ void *Regres(void *argument)
int vdate = 0, vtime = 0;
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
vdate = taxisInqVdate(taxisID1);
vtime = taxisInqVtime(taxisID1);
tsID++; /* don't move this line !!! */
tsID++; // don't move this line !!!
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
pstreamInqRecord(streamID1, &varID, &levelID);
if ( tsID == 1 )
{
......@@ -94,7 +92,7 @@ void *Regres(void *argument)
recLevelID[recID] = levelID;
}
streamReadRecord(streamID1, field1.ptr, &nmiss);
pstreamReadRecord(streamID1, field1.ptr, &nmiss);
double missval = vlistInqVarMissval(vlistID1, varID);
int gridID = vlistInqVarGrid(vlistID1, varID);
......@@ -115,8 +113,8 @@ void *Regres(void *argument)
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
/* streamDefTimestep(streamID2, 0); */
streamDefTimestep(streamID3, 0);
/* pstreamDefTimestep(streamID2, 0); */
pstreamDefTimestep(streamID3, 0);
for ( int recID = 0; recID < nrecords; recID++ )
{
......@@ -147,15 +145,15 @@ void *Regres(void *argument)
for ( i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(field1.ptr[i], missval) ) nmiss++;
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, field1.ptr, nmiss);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, field1.ptr, nmiss);
*/
nmiss = 0;
for ( int i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(field2.ptr[i], missval) ) nmiss++;
streamDefRecord(streamID3, varID, levelID);
streamWriteRecord(streamID3, field2.ptr, nmiss);
pstreamDefRecord(streamID3, varID, levelID);
pstreamWriteRecord(streamID3, field2.ptr, nmiss);
}
......@@ -167,9 +165,9 @@ void *Regres(void *argument)
if ( recVarID ) Free(recVarID);
if ( recLevelID ) Free(recLevelID);
streamClose(streamID3);
/* streamClose(streamID2); */
streamClose(streamID1);
pstreamClose(streamID3);
/* pstreamClose(streamID2); */
pstreamClose(streamID1);
cdoFinish();
......
......@@ -801,7 +801,7 @@ void *Remap(void *argument)
cdoPrint("Extrapolation disabled!");
}
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
if ( lremapxxx )
{
......@@ -829,9 +829,9 @@ void *Remap(void *argument)
if ( gridInqType(gridID2) == GRID_GENERIC ) cdoAbort("Unsupported target grid type (generic)!");
int filetype = streamInqFiletype(streamID1);
int filetype = pstreamInqFiletype(streamID1);
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
......@@ -957,22 +957,22 @@ void *Remap(void *argument)
if ( ! lwrite_remap )
{
streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
}
int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) )
while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{
taxisCopyTimestep(taxisID2, taxisID1);
if ( ! lwrite_remap )
streamDefTimestep(streamID2, tsID);
pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array1, &nmiss1);
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, array1, &nmiss1);
gridID1 = vlistInqVarGrid(vlistID1, varID);
......@@ -1247,13 +1247,14 @@ void *Remap(void *argument)
SKIPVAR:
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, array2, nmiss2);
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, array2, nmiss2);
}
tsID++;
}
streamClose(streamID2);
pstreamClose(streamID2);
WRITE_REMAP:
......@@ -1261,7 +1262,7 @@ void *Remap(void *argument)
write_remap_scrip(cdoStreamName(1)->args, map_type, submap_type, num_neighbors, remap_order,
remaps[r].src_grid, remaps[r].tgt_grid, remaps[r].vars);
streamClose(streamID1);
pstreamClose(streamID1);
if ( imask ) Free(imask);
if ( array2 ) Free(array2);
......
......@@ -281,7 +281,7 @@ void *Remapeta(void *argument)
for ( i = 0; i < nhlevf2+1; ++i )
cdoPrint("vct2: %5d %25.17f %25.17f", i, vct2[i], vct2[nvct2/2+i]);
int streamID1 = streamOpenRead(cdoStreamName(0));
int streamID1 = pstreamOpenRead(cdoStreamName(0));
if ( operatorArgc() == 2 )
{
......@@ -289,18 +289,18 @@ void *Remapeta(void *argument)
const char *fname = operatorArgv()[1];
argument_t *fileargument = file_argument_new(fname);
int streamID = streamOpenRead(fileargument);
int streamID = pstreamOpenRead(fileargument);
file_argument_free(fileargument);
int vlistID1 = streamInqVlist(streamID);
int vlistID1 = pstreamInqVlist(streamID);
streamInqRecord(streamID, &varID, &levelID);
pstreamInqRecord(streamID, &varID, &levelID);
int gridID = vlistInqVarGrid(vlistID1, varID);
nfis2gp = gridInqSize(gridID);
fis2 = (double*) Malloc(nfis2gp*sizeof(double));
streamReadRecord(streamID, fis2, &nmiss);
pstreamReadRecord(streamID, fis2, &nmiss);
if ( nmiss )
{
......@@ -325,10 +325,10 @@ void *Remapeta(void *argument)
if ( minval < -1.e10 || maxval > 1.e10 )
cdoAbort("%s out of range!", var_stdname(surface_geopotential));
streamClose(streamID);
pstreamClose(streamID);
}
int vlistID1 = streamInqVlist(streamID1);
int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
......@@ -375,9 +375,8 @@ void *Remapeta(void *argument)
cdoPrint("vct1: %5d %25.17f %25.17f", i, vct1[i], vct1[nvct1/2+i]);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2);
int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
pstreamDefVlist(streamID2, vlistID2);
if ( zaxisIDh == -1 )
......@@ -542,18 +541,18 @@ void *Remapeta(void *argument)
if ( cdoVerbose ) cdoPrint("nvars3D = %d ltq = %d", nvars3D, (int)ltq);
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);