Commit 0244ea24 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed streamXXX() to pstreamXXX().

parent cfd743e4
...@@ -58,9 +58,9 @@ void *FC(void *argument) ...@@ -58,9 +58,9 @@ void *FC(void *argument)
int operatorID = cdoOperatorID(); 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 vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1); int taxisID1 = vlistInqTaxis(vlistID1);
...@@ -232,9 +232,9 @@ void *FC(void *argument) ...@@ -232,9 +232,9 @@ void *FC(void *argument)
if ( gridID1 != -1 ) vlistChangeGrid(vlistID2, gridID1, gridID2); if ( gridID1 != -1 ) vlistChangeGrid(vlistID2, gridID1, gridID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype()); int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2); pstreamDefVlist(streamID2, vlistID2);
int gridsize = vlistGridsizeMax(vlistID1); int gridsize = vlistGridsizeMax(vlistID1);
double *array1 = (double*) Malloc(gridsize*sizeof(double)); double *array1 = (double*) Malloc(gridsize*sizeof(double));
...@@ -246,19 +246,19 @@ void *FC(void *argument) ...@@ -246,19 +246,19 @@ void *FC(void *argument)
} }
int tsID = 0; int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{ {
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID); pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; recID++ ) for ( int recID = 0; recID < nrecs; recID++ )
{ {
streamInqRecord(streamID1, &varID, &levelID); pstreamInqRecord(streamID1, &varID, &levelID);
if ( vars[varID] ) if ( vars[varID] )
{ {
streamReadRecord(streamID1, array1, &nmiss); pstreamReadRecord(streamID1, array1, &nmiss);
if ( nmiss ) cdoAbort("Missing values unsupported for spectral/fourier data!"); if ( nmiss ) cdoAbort("Missing values unsupported for spectral/fourier data!");
gridID1 = vlistInqVarGrid(vlistID1, varID); gridID1 = vlistInqVarGrid(vlistID1, varID);
...@@ -271,28 +271,29 @@ void *FC(void *argument) ...@@ -271,28 +271,29 @@ void *FC(void *argument)
else if ( operatorID == GP2FC ) else if ( operatorID == GP2FC )
grid2four(sptrans, gridID1, array1, gridID2, array2); grid2four(sptrans, gridID1, array1, gridID2, array2);
streamDefRecord(streamID2, varID, levelID); pstreamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, array2, nmiss); pstreamWriteRecord(streamID2, array2, nmiss);
} }
else else
{ {
streamDefRecord(streamID2, varID, levelID); pstreamDefRecord(streamID2, varID, levelID);
if ( lcopy ) if ( lcopy )
{ {
streamCopyRecord(streamID2, streamID1); pstreamCopyRecord(streamID2, streamID1);
} }
else else
{ {
streamReadRecord(streamID1, array1, &nmiss); pstreamReadRecord(streamID1, array1, &nmiss);
streamWriteRecord(streamID2, array1, nmiss); pstreamWriteRecord(streamID2, array1, nmiss);
} }
} }
} }
tsID++; tsID++;
} }
streamClose(streamID2); pstreamClose(streamID2);
streamClose(streamID1); pstreamClose(streamID1);
if ( array2 ) Free(array2); if ( array2 ) Free(array2);
if ( array1 ) Free(array1); if ( array1 ) Free(array1);
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "cdo_int.h" #include "cdo_int.h"
#include "pstream.h" #include "pstream.h"
#include "grid.h" #include "grid.h"
#include "util.h"
void cdo_print_zaxis(int zaxisID); void cdo_print_zaxis(int zaxisID);
...@@ -121,7 +120,7 @@ void printSource(FILE *fp, int vlistID, int varID) ...@@ -121,7 +120,7 @@ void printSource(FILE *fp, int vlistID, int varID)
static static
void partab(FILE *fp, int streamID, int option) void partab(FILE *fp, int streamID, int option)
{ {
int vlistID = streamInqVlist(streamID); int vlistID = pstreamInqVlist(streamID);
int varID, datatype = -1; int varID, datatype = -1;
char pstr[32]; char pstr[32];
char paramstr[32]; char paramstr[32];
...@@ -250,7 +249,7 @@ static ...@@ -250,7 +249,7 @@ static
void filedes(int streamID) void filedes(int streamID)
{ {
printf("\n"); printf("\n");
int filetype = streamInqFiletype(streamID); int filetype = pstreamInqFiletype(streamID);
switch ( filetype ) switch ( filetype )
{ {
case CDI_FILETYPE_GRB: printf(" GRIB data\n"); break; case CDI_FILETYPE_GRB: printf(" GRIB data\n"); break;
...@@ -271,11 +270,12 @@ void filedes(int streamID) ...@@ -271,11 +270,12 @@ void filedes(int streamID)
case CDI_FILETYPE_EXT: case CDI_FILETYPE_EXT:
case CDI_FILETYPE_IEG: case CDI_FILETYPE_IEG:
{ {
switch ( streamInqByteorder(streamID) ) int byteorder = pstreamInqByteorder(streamID);
switch ( byteorder )
{ {
case CDI_BIGENDIAN: printf(" byteorder is BIGENDIAN\n"); break; case CDI_BIGENDIAN: printf(" byteorder is BIGENDIAN\n"); break;
case CDI_LITTLEENDIAN: printf(" byteorder is LITTLEENDIAN\n"); break; case CDI_LITTLEENDIAN: printf(" byteorder is LITTLEENDIAN\n"); break;
default: printf(" byteorder %d undefined\n", streamInqByteorder(streamID)); break; default: printf(" byteorder %d undefined\n", byteorder); break;
} }
} }
} }
...@@ -302,9 +302,9 @@ void *Filedes(void *argument) ...@@ -302,9 +302,9 @@ void *Filedes(void *argument)
int operatorID = cdoOperatorID(); int operatorID = cdoOperatorID();
int streamID = streamOpenRead(cdoStreamName(0)); int streamID = pstreamOpenRead(cdoStreamName(0));
int vlistID = streamInqVlist(streamID); int vlistID = pstreamInqVlist(streamID);
int nvars = vlistNvars(vlistID); int nvars = vlistNvars(vlistID);
int ngrids = vlistNgrids(vlistID); int ngrids = vlistNgrids(vlistID);
...@@ -411,7 +411,7 @@ void *Filedes(void *argument) ...@@ -411,7 +411,7 @@ void *Filedes(void *argument)
filedes(streamID); filedes(streamID);
} }
streamClose(streamID); pstreamClose(streamID);
cdoFinish(); cdoFinish();
......
...@@ -467,18 +467,18 @@ void *Fillmiss(void *argument) ...@@ -467,18 +467,18 @@ void *Fillmiss(void *argument)
cdoAbort("Too many arguments!"); cdoAbort("Too many arguments!");
} }
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1); int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1); int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1); int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1); int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2); vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype()); int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2); pstreamDefVlist(streamID2, vlistID2);
int gridsize = vlistGridsizeMax(vlistID1); int gridsize = vlistGridsizeMax(vlistID1);
...@@ -489,23 +489,23 @@ void *Fillmiss(void *argument) ...@@ -489,23 +489,23 @@ void *Fillmiss(void *argument)
field2.ptr = (double*) Malloc(gridsize*sizeof(double)); field2.ptr = (double*) Malloc(gridsize*sizeof(double));
int tsID = 0; int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{ {
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID); pstreamDefTimestep(streamID2, tsID);
for ( int recID = 0; recID < nrecs; recID++ ) for ( int recID = 0; recID < nrecs; recID++ )
{ {
streamInqRecord(streamID1, &varID, &levelID); pstreamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, field1.ptr, &nmiss); pstreamReadRecord(streamID1, field1.ptr, &nmiss);
field1.nmiss = (size_t) nmiss; field1.nmiss = (size_t) nmiss;
streamDefRecord(streamID2, varID, levelID); pstreamDefRecord(streamID2, varID, levelID);
if ( field1.nmiss == 0 ) if ( field1.nmiss == 0 )
{ {
streamWriteRecord(streamID2, field1.ptr, 0); pstreamWriteRecord(streamID2, field1.ptr, 0);
} }
else else
{ {
...@@ -529,14 +529,14 @@ void *Fillmiss(void *argument) ...@@ -529,14 +529,14 @@ void *Fillmiss(void *argument)
for ( int i = 0; i < gridsize; ++i ) for ( int i = 0; i < gridsize; ++i )
if ( DBL_IS_EQUAL(field2.ptr[i], field2.missval) ) nmiss++; if ( DBL_IS_EQUAL(field2.ptr[i], field2.missval) ) nmiss++;
streamWriteRecord(streamID2, field2.ptr, nmiss); pstreamWriteRecord(streamID2, field2.ptr, nmiss);
} }
} }
tsID++; tsID++;
} }
streamClose(streamID2); pstreamClose(streamID2);
streamClose(streamID1); pstreamClose(streamID1);
if ( field2.ptr ) Free(field2.ptr); if ( field2.ptr ) Free(field2.ptr);
if ( field1.ptr ) Free(field1.ptr); if ( field1.ptr ) Free(field1.ptr);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
*/ */
#if defined(HAVE_CONFIG_H) #if defined(HAVE_CONFIG_H)
# include "config.h" #include "config.h"
#endif #endif
...@@ -166,9 +166,9 @@ void *Filter(void *argument) ...@@ -166,9 +166,9 @@ void *Filter(void *argument)
if ( cdoVerbose && !use_fftw ) cdoPrint("Using intrinsic FFT function!"); if ( cdoVerbose && !use_fftw ) cdoPrint("Using intrinsic FFT function!");
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1); int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1); int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1); int taxisID1 = vlistInqTaxis(vlistID1);
...@@ -180,7 +180,7 @@ void *Filter(void *argument) ...@@ -180,7 +180,7 @@ void *Filter(void *argument)
int nvars = vlistNvars(vlistID1); int nvars = vlistNvars(vlistID1);
int tsID = 0; int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{ {
if ( tsID >= nalloc ) if ( tsID >= nalloc )
{ {
...@@ -194,11 +194,11 @@ void *Filter(void *argument) ...@@ -194,11 +194,11 @@ void *Filter(void *argument)
for ( int recID = 0; recID < nrecs; recID++ ) for ( int recID = 0; recID < nrecs; recID++ )
{ {
streamInqRecord(streamID1, &varID, &levelID); pstreamInqRecord(streamID1, &varID, &levelID);
int gridID = vlistInqVarGrid(vlistID1, varID); int gridID = vlistInqVarGrid(vlistID1, varID);
int gridsize = gridInqSize(gridID); int gridsize = gridInqSize(gridID);
vars[tsID][varID][levelID].ptr = (double*) Malloc(gridsize*sizeof(double)); 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; vars[tsID][varID][levelID].nmiss = nmiss;
if ( nmiss ) cdoAbort("Missing value support for operators in module Filter not added yet!"); if ( nmiss ) cdoAbort("Missing value support for operators in module Filter not added yet!");
} }
...@@ -381,14 +381,14 @@ void *Filter(void *argument) ...@@ -381,14 +381,14 @@ void *Filter(void *argument)
Free(ompmem); Free(ompmem);
} }
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype()); int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2); pstreamDefVlist(streamID2, vlistID2);
for ( int tsID = 0; tsID < nts; tsID++ ) for ( int tsID = 0; tsID < nts; tsID++ )
{ {
dtlist_taxisDefTimestep(dtlist, taxisID2, tsID); dtlist_taxisDefTimestep(dtlist, taxisID2, tsID);
streamDefTimestep(streamID2, tsID); pstreamDefTimestep(streamID2, tsID);
for ( int varID = 0; varID < nvars; varID++ ) for ( int varID = 0; varID < nvars; varID++ )
{ {
...@@ -398,8 +398,8 @@ void *Filter(void *argument) ...@@ -398,8 +398,8 @@ void *Filter(void *argument)
if ( vars[tsID][varID][levelID].ptr ) if ( vars[tsID][varID][levelID].ptr )
{ {
int nmiss = vars[tsID][varID][levelID].nmiss; int nmiss = vars[tsID][varID][levelID].nmiss;
streamDefRecord(streamID2, varID, levelID); pstreamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss); pstreamWriteRecord(streamID2, vars[tsID][varID][levelID].ptr, nmiss);
Free(vars[tsID][varID][levelID].ptr); Free(vars[tsID][varID][levelID].ptr);
vars[tsID][varID][levelID].ptr = NULL; vars[tsID][varID][levelID].ptr = NULL;
...@@ -414,8 +414,8 @@ void *Filter(void *argument) ...@@ -414,8 +414,8 @@ void *Filter(void *argument)
dtlist_delete(dtlist); dtlist_delete(dtlist);
streamClose(streamID2); pstreamClose(streamID2);
streamClose(streamID1); pstreamClose(streamID1);
cdoFinish(); cdoFinish();
......
...@@ -41,11 +41,11 @@ void *Fldrms(void *argument) ...@@ -41,11 +41,11 @@ void *Fldrms(void *argument)
bool needWeights = true; bool needWeights = true;
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = pstreamOpenRead(cdoStreamName(0));
int streamID2 = streamOpenRead(cdoStreamName(1)); int streamID2 = pstreamOpenRead(cdoStreamName(1));
int vlistID1 = streamInqVlist(streamID1); int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = streamInqVlist(streamID2); int vlistID2 = pstreamInqVlist(streamID2);
int vlistID3 = vlistDuplicate(vlistID1); int vlistID3 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1); int taxisID1 = vlistInqTaxis(vlistID1);
...@@ -83,9 +83,8 @@ void *Fldrms(void *argument) ...@@ -83,9 +83,8 @@ void *Fldrms(void *argument)
if ( ndiffgrids > 0 ) cdoAbort("Too many different grids!"); if ( ndiffgrids > 0 ) cdoAbort("Too many different grids!");
int streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype()); int streamID3 = pstreamOpenWrite(cdoStreamName(2), cdoFiletype());
pstreamDefVlist(streamID3, vlistID3);
streamDefVlist(streamID3, vlistID3);
field_type field1, field2, field3; field_type field1, field2, field3;
field_init(&field1); field_init(&field1);
...@@ -105,21 +104,21 @@ void *Fldrms(void *argument) ...@@ -105,21 +104,21 @@ void *Fldrms(void *argument)
field3.grid = gridID3; field3.grid = gridID3;
int tsID = 0; int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{ {
nrecs = streamInqTimestep(streamID2, tsID); nrecs = pstreamInqTimestep(streamID2, tsID);
taxisCopyTimestep(taxisID3, taxisID1); taxisCopyTimestep(taxisID3, taxisID1);
streamDefTimestep(streamID3, tsID); pstreamDefTimestep(streamID3, tsID);
for ( int recID = 0; recID < nrecs; recID++ ) for ( int recID = 0; recID < nrecs; recID++ )
{ {
streamInqRecord(streamID1, &varID, &levelID); pstreamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, field1.ptr, &nmiss); pstreamReadRecord(streamID1, field1.ptr, &nmiss);
field1.nmiss = (size_t) nmiss; field1.nmiss = (size_t) nmiss;
streamInqRecord(streamID2, &varID, &levelID); pstreamInqRecord(streamID2, &varID, &levelID);
streamReadRecord(streamID2, field2.ptr, &nmiss); pstreamReadRecord(streamID2, field2.ptr, &nmiss);
field2.nmiss = (size_t) nmiss; field2.nmiss = (size_t) nmiss;
field1.grid = vlistInqVarGrid(vlistID1, varID); field1.grid = vlistInqVarGrid(vlistID1, varID);
...@@ -147,15 +146,15 @@ void *Fldrms(void *argument) ...@@ -147,15 +146,15 @@ void *Fldrms(void *argument)
fldrms(field1, field2, &field3); fldrms(field1, field2, &field3);
streamDefRecord(streamID3, varID, levelID); pstreamDefRecord(streamID3, varID, levelID);
streamWriteRecord(streamID3, &sglval, (int)field3.nmiss); pstreamWriteRecord(streamID3, &sglval, (int)field3.nmiss);
} }
tsID++; tsID++;
} }
streamClose(streamID3); pstreamClose(streamID3);
streamClose(streamID2); pstreamClose(streamID2);
streamClose(streamID1); pstreamClose(streamID1);
if ( field1.ptr ) Free(field1.ptr); if ( field1.ptr ) Free(field1.ptr);
if ( field1.weight ) Free(field1.weight); if ( field1.weight ) Free(field1.weight);
......
...@@ -61,9 +61,8 @@ void print_location_LL(int operfunc, int vlistID, int varID, int levelID, int gr ...@@ -61,9 +61,8 @@ void print_location_LL(int operfunc, int vlistID, int varID, int levelID, int gr
{ {
if ( DBL_IS_EQUAL(fieldptr[j*nlon+i], sglval) ) if ( DBL_IS_EQUAL(fieldptr[j*nlon+i], sglval) )
{ {
double xval, yval; double xval = gridInqXval(gridID,i);
xval = gridInqXval(gridID,i); double yval = gridInqYval(gridID,j);
yval = gridInqYval(gridID,j);
if ( showHeader ) if ( showHeader )
{ {
if ( operfunc == func_min ) if ( operfunc == func_min )
...@@ -90,7 +89,6 @@ void *Fldstat(void *argument) ...@@ -90,7 +89,6 @@ void *Fldstat(void *argument)
int varID, levelID; int varID, levelID;
int nmiss; int nmiss;
double sglval; double sglval;
field_type field;
cdoInitialize(argument); cdoInitialize(argument);
...@@ -136,9 +134,9 @@ void *Fldstat(void *argument) ...@@ -136,9 +134,9 @@ void *Fldstat(void *argument)
} }
} }
int streamID1 = streamOpenRead(cdoStreamName(0)); int streamID1 = pstreamOpenRead(cdoStreamName(0));
int vlistID1 = streamInqVlist(streamID1); int vlistID1 = pstreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1); int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1); int taxisID1 = vlistInqTaxis(vlistID1);
...@@ -167,10 +165,11 @@ void *Fldstat(void *argument) ...@@ -167,10 +165,11 @@ void *Fldstat(void *argument)
for ( index = 0; index < ngrids; index++ ) for ( index = 0; index < ngrids; index++ )
vlistChangeGridIndex(vlistID2, index, gridID2); vlistChangeGridIndex(vlistID2, index, gridID2);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype()); int streamID2 = pstreamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID2, vlistID2); pstreamDefVlist(streamID2, vlistID2);
field_type field;
field_init(&field); field_init(&field);
int lim = vlistGridsizeMax(vlistID1); int lim = vlistGridsizeMax(vlistID1);
...@@ -187,10 +186,10 @@ void *Fldstat(void *argument) ...@@ -187,10 +186,10 @@ void *Fldstat(void *argument)
} }
int tsID = 0; int tsID = 0;
while ( (nrecs = streamInqTimestep(streamID1, tsID)) ) while ( (nrecs = pstreamInqTimestep(streamID1, tsID)) )
{ {
taxisCopyTimestep(taxisID2, taxisID1); taxisCopyTimestep(taxisID2, taxisID1);
streamDefTimestep(streamID2, tsID); pstreamDefTimestep(streamID2, tsID);
/* Precompute date + time for later representation in verbose mode */ /* Precompute date + time for later representation in verbose mode */
int vdate = 0, vtime = 0; int vdate = 0, vtime = 0;
...@@ -205,8 +204,8 @@ void *Fldstat(void *argument) ...@@ -205,8 +204,8 @@ void *Fldstat(void *argument)
for ( int recID = 0; recID < nrecs; recID++ )