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

No commit message

No commit message
parent 302b63a1
......@@ -220,6 +220,7 @@ src/Copy.c -text
src/Del29feb.c -text
src/Detrend.c -text
src/Diff.c -text
src/EOF.c -text
src/EcaIndices.c -text
src/Echam5ini.c -text
src/Enlarge.c -text
......
......@@ -127,17 +127,25 @@ void *Copy(void *argument)
if ( cdoParIO )
{
parIO.recID = recID; parIO.nrecs = nrecs;
/* fprintf(stderr, "in1 streamID %d varID %d levelID %d\n", streamID1, varID, levelID);*/
parReadRecord(streamID1, &varID, &levelID, array, &nmiss, &parIO);
fprintf(stderr, "2 streamID %d varID %d levelID %d\n", streamID1, varID, levelID);
/* fprintf(stderr, "in2 streamID %d varID %d levelID %d\n", streamID1, varID, levelID);*/
}
else
{
streamInqRecord(streamID1, &varID, &levelID);
streamReadRecord(streamID1, array, &nmiss);
}
/*
if ( cdoParIO )
fprintf(stderr, "out1 %d %d %d\n", streamID2, varID, levelID);
*/
streamDefRecord(streamID2, varID, levelID);
streamWriteRecord(streamID2, array, nmiss);
/*
if ( cdoParIO )
fprintf(stderr, "out2 %d %d %d\n", streamID2, varID, levelID);
*/
}
}
tsID1++;
......
/*
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
/*
This module contains the following operators:
*/
#include <string.h>
#include "cdi.h"
#include "cdo.h"
#include "cdo_int.h"
#include "pstream.h"
#include "statistic.h"
#define NIN 2
#define NOUT 1
#define NFWORK 4
#define NIWORK 2
void *Timeof(void *argument)
{
static char func[] = "Timeof";
int VARQUOT2TEST, MEANDIFF2TEST;
int operatorID;
int *streamID, streamID3;
int gridsize;
int vdate = 0, vtime = 0;
int nrecs, nrecs3, nvars, nlevs ;
int i, iw, is;
int tsID;
int varID, recID, levelID, gridID;
int nmiss3;
int *recVarID, *recLevelID;
int *vlistID, vlistID2 = -1, vlistID3 = -1;
int taxisID1, taxisID3;
double rconst, risk;
double fnvals0, fnvals1;
double missval, missval1, missval2;
double fractil_1, fractil_2, statistic;
FIELD **fwork[NFWORK];
double temp0, temp1, temp2, temp3;
int ***iwork[NIWORK];
FIELD *in, *out;
int *reached_eof;
int n_in = NIN;
cdoInitialize(argument);
VARQUOT2TEST = cdoOperatorAdd("varquot2test", 0, 0, NULL);
MEANDIFF2TEST = cdoOperatorAdd("meandiff2test", 0, 0, NULL);
operatorID = cdoOperatorID();
operatorInputArg("constant and risk (e.g. 0.05)");
operatorCheckArgc(2);
rconst = atof(operatorArgv()[0]);
risk = atof(operatorArgv()[1]);
if ( operatorID == VARQUOT2TEST )
{
if ( rconst <= 0 )
cdoAbort("Constant must be positive!");
if ( risk <= 0 || risk >= 1 )
cdoAbort("Risk must be greater than 0 and lower than 1!");
}
streamID = (int *) malloc(NIN*sizeof(int));
vlistID = (int *) malloc(NIN*sizeof(int));
for ( is = 0; is < NIN; ++is )
{
streamID[is] = streamOpenRead(cdoStreamName(is));
if ( streamID[is] < 0 ) cdiError(streamID[is], "Open failed on %s", cdoStreamName(is));
vlistID[is] = streamInqVlist(streamID[is]);
if ( is > 0 )
{
vlistID2 = streamInqVlist(streamID[is]);
vlistCompare(vlistID[0], vlistID2, func_sft);
}
}
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);
vlistDefTaxis(vlistID3, taxisID3);
streamID3 = streamOpenWrite(cdoStreamName(2), cdoFiletype());
if ( streamID3 < 0 ) cdiError(streamID3, "Open failed on %s", cdoStreamName(2));
streamDefVlist(streamID3, vlistID3);
reached_eof = (int *) malloc(NIN*sizeof(int));
memset(reached_eof, 0, NIN*sizeof(int));
in = (FIELD *) malloc(NIN*sizeof(FIELD));
for ( i = 0; i < NIN; ++i )
in[i].ptr = (double *) malloc(gridsize*sizeof(double));
out = (FIELD *) malloc(NOUT*sizeof(FIELD));
for ( i = 0; i < NOUT; ++i )
out[i].ptr = (double *) malloc(gridsize*sizeof(double));
for ( iw = 0; iw < NFWORK; ++iw )
fwork[iw] = (FIELD **) malloc(nvars*sizeof(FIELD *));
for ( iw = 0; iw < NIWORK; ++iw )
iwork[iw] = (int ***) malloc(nvars*sizeof(int **));
for ( varID = 0; varID < nvars; ++varID )
{
gridID = vlistInqVarGrid(vlistID[0], varID);
gridsize = vlistGridsizeMax(vlistID[0]);
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID[0], varID));
missval = missval1 = vlistInqVarMissval(vlistID[0], varID);
missval2 = vlistInqVarMissval(vlistID[1], varID);
for ( iw = 0; iw < NFWORK; ++iw )
fwork[iw][varID] = (FIELD *) malloc(nlevs*sizeof(FIELD));
for ( iw = 0; iw < NIWORK; ++iw )
iwork[iw][varID] = (int **) malloc(nlevs*sizeof(int *));
for ( levelID = 0; levelID < nlevs; ++levelID )
{
for ( iw = 0; iw < NFWORK; ++iw )
{
fwork[iw][varID][levelID].grid = gridID;
fwork[iw][varID][levelID].nmiss = 0;
fwork[iw][varID][levelID].missval = missval;
fwork[iw][varID][levelID].ptr = (double *) malloc(gridsize*sizeof(double));
memset(fwork[iw][varID][levelID].ptr, 0, gridsize*sizeof(double));
}
for ( iw = 0; iw < NIWORK; ++iw )
{
iwork[iw][varID][levelID] = (int *) malloc(gridsize*sizeof(int));
memset(iwork[iw][varID][levelID], 0, gridsize*sizeof(int));
}
}
}
tsID=0;
while ( TRUE )
{
for ( is = 0; is < NIN; ++is )
{
if ( reached_eof[is] ) continue;
nrecs = streamInqTimestep(streamID[is], tsID);
if ( nrecs == 0 )
{
reached_eof[is] = 1;
continue;
}
vdate = taxisInqVdate(taxisID1);
vtime = taxisInqVtime(taxisID1);
for ( recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID[is], &varID, &levelID);
gridsize = gridInqSize(vlistInqVarGrid(vlistID[is], varID));
in[is].missval = vlistInqVarMissval(vlistID[is], varID);
if ( tsID == 0 && is == 0 )
{
recVarID[recID] = varID;
recLevelID[recID] = levelID;
}
streamReadRecord(streamID[is], in[is].ptr, &in[is].nmiss);
for ( i = 0; i < gridsize; ++i )
{
/*
if ( ( ! DBL_IS_EQUAL(array1[i], missval1) ) &&
( ! DBL_IS_EQUAL(array2[i], missval2) ) )
*/
{
fwork[NIN*is + 0][varID][levelID].ptr[i] += in[is].ptr[i];
fwork[NIN*is + 1][varID][levelID].ptr[i] += in[is].ptr[i] * in[is].ptr[i];
iwork[is][varID][levelID][i]++;
}
}
}
}
for ( is = 0; is < NIN; ++is )
if ( ! reached_eof[is] ) break;
if ( is == NIN ) break;
tsID++;
}
tsID = 0;
taxisDefVdate(taxisID3, vdate);
taxisDefVtime(taxisID3, vtime);
streamDefTimestep(streamID3, tsID);
for ( recID = 0; recID < nrecs3; recID++ )
{
varID = recVarID[recID];
levelID = recLevelID[recID];
missval1 = fwork[0][varID][levelID].missval;
missval2 = missval1;
if ( operatorID == VARQUOT2TEST )
{
for ( i = 0; i < gridsize; ++i )
{
fnvals0 = iwork[0][varID][levelID][i];
fnvals1 = iwork[1][varID][levelID][i];
temp0 = DIV(MUL(fwork[0][varID][levelID].ptr[i], fwork[0][varID][levelID].ptr[i]), fnvals0);
temp1 = DIV(MUL(fwork[2][varID][levelID].ptr[i], fwork[2][varID][levelID].ptr[i]), fnvals1);
temp2 = SUB(fwork[1][varID][levelID].ptr[i], temp0);
temp3 = SUB(fwork[3][varID][levelID].ptr[i], temp1);
statistic = DIV(temp2, ADD(temp2, MUL(rconst, temp3)));
if ( fnvals0 <= 1 || fnvals1 <= 1 )
fractil_1 = fractil_2 = missval1;
else
beta_distr_constants((fnvals0 - 1) / 2,
(fnvals1 - 1) / 2, 1 - risk,
&fractil_1, &fractil_2, func);
out[0].ptr[i] = DBL_IS_EQUAL(statistic, missval1) ? missval1 :
statistic <= fractil_1 || statistic >= fractil_2 ? 1 : 0;
}
}
else if ( operatorID == MEANDIFF2TEST )
{
int j;
double fnvals;
double fractil;
double mean_factor[NIN], var_factor[NIN];
double stddev_estimator, mean_estimator, norm, deg_of_freedom;
double tmp;
mean_factor[0] = 1;
mean_factor[1] = -1;
var_factor[0] = var_factor[1] = 1;
for ( i = 0; i < gridsize; ++i )
{
temp0 = 0;
deg_of_freedom = -n_in;
for ( j = 0; j < n_in; j++ )
{
fnvals = iwork[j][varID][levelID][i];
tmp = DIV(MUL(fwork[2*j][varID][levelID].ptr[i], fwork[2*j][varID][levelID].ptr[i]), fnvals);
temp0 = ADD(temp0, DIV(SUB(fwork[2*j+1][varID][levelID].ptr[i], tmp), var_factor[j]));
deg_of_freedom = ADD(deg_of_freedom, fnvals);
}
if ( !DBL_IS_EQUAL(temp0, missval1) && temp0 < 0 ) /* This is possible because */
temp0 = 0; /* of rounding errors */
stddev_estimator = ROOT(DIV(temp0, deg_of_freedom));
mean_estimator = -rconst;
for ( j = 0; j < n_in; j++ )
{
fnvals = iwork[j][varID][levelID][i];
mean_estimator = ADD(mean_estimator,
MUL(mean_factor[j],
DIV(fwork[2*j][varID][levelID].ptr[i], fnvals)));
}
temp1 = 0;
for ( j = 0; j < n_in; j++ )
{
fnvals = iwork[j][varID][levelID][i];
temp1 = ADD(temp1, DIV(MUL(MUL(mean_factor[j], mean_factor[j]),
var_factor[j]), fnvals));
}
norm = ROOT(temp1);
temp2 = DIV(DIV(mean_estimator, norm), stddev_estimator);
fractil = deg_of_freedom < 1 ? missval1 :
student_t_inv (deg_of_freedom, 1 - risk/2, func);
out[0].ptr[i] = DBL_IS_EQUAL(temp2, missval1)|| DBL_IS_EQUAL(fractil, missval1) ?
missval1 : fabs(temp2) >= fractil;
}
}
nmiss3 = 0;
for ( i = 0; i < gridsize; i++ )
if ( DBL_IS_EQUAL(out[0].ptr[i], missval1) ) nmiss3++;
streamDefRecord(streamID3, varID, levelID);
streamWriteRecord(streamID3, out[0].ptr, nmiss3);
}
for ( varID = 0; varID < nvars; varID++ )
{
nlevs = zaxisInqSize(vlistInqVarZaxis(vlistID[0], varID));
for ( levelID = 0; levelID < nlevs; levelID++ )
{
for ( iw = 0; iw < NFWORK; ++iw )
free(fwork[iw][varID][levelID].ptr);
for ( iw = 0; iw < NIWORK; ++iw )
free(iwork[iw][varID][levelID]);
}
for ( iw = 0; iw < NFWORK; ++iw ) free(fwork[iw][varID]);
for ( iw = 0; iw < NIWORK; ++iw ) free(iwork[iw][varID]);
}
for ( iw = 0; iw < NFWORK; iw++ ) free(fwork[iw]);
for ( iw = 0; iw < NIWORK; iw++ ) free(iwork[iw]);
streamClose(streamID3);
for ( is = 0; is < NIN; ++is )
streamClose(streamID[is]);
free(streamID);
free(vlistID);
free(reached_eof);
for ( i = 0; i < NIN; ++i ) free(in[i].ptr);
free(in);
for ( i = 0; i < NOUT; ++i ) free(out[i].ptr);
free(out);
free(recVarID);
free(recLevelID);
cdoFinish();
return (0);
}
......@@ -108,6 +108,7 @@ cdo_SOURCES = Arith.c \
Test.c \
Tests.c \
Timcount.c \
Timeof.c \
Timpctl.c \
Timsort.c \
Timselpctl.c \
......
......@@ -54,64 +54,64 @@ am_cdo_OBJECTS = Arith.$(OBJEXT) Arithc.$(OBJEXT) Arithdays.$(OBJEXT) \
Cond2.$(OBJEXT) Condc.$(OBJEXT) Copy.$(OBJEXT) \
Del29feb.$(OBJEXT) Detrend.$(OBJEXT) Diff.$(OBJEXT) \
Echam5ini.$(OBJEXT) Enlarge.$(OBJEXT) Enlargegrid.$(OBJEXT) \
Ensstat.$(OBJEXT) Exprf.$(OBJEXT) Filedes.$(OBJEXT) \
Fillmiss.$(OBJEXT) Filter.$(OBJEXT) Fldrms.$(OBJEXT) \
Fldstat.$(OBJEXT) Gengrid.$(OBJEXT) Gradsdes.$(OBJEXT) \
Gridboxstat.$(OBJEXT) Gridcell.$(OBJEXT) Harmonic.$(OBJEXT) \
Histogram.$(OBJEXT) Importamsr.$(OBJEXT) Importcmsaf.$(OBJEXT) \
Info.$(OBJEXT) Input.$(OBJEXT) Intgrid.$(OBJEXT) \
Intgridtraj.$(OBJEXT) Intlevel.$(OBJEXT) Inttime.$(OBJEXT) \
Intntime.$(OBJEXT) Intyear.$(OBJEXT) Invert.$(OBJEXT) \
Invertlev.$(OBJEXT) Log.$(OBJEXT) Maskbox.$(OBJEXT) \
Mastrfu.$(OBJEXT) Math.$(OBJEXT) Merge.$(OBJEXT) \
Mergegrid.$(OBJEXT) Mergetime.$(OBJEXT) Merstat.$(OBJEXT) \
Monarith.$(OBJEXT) Mrotuv.$(OBJEXT) Mrotuvb.$(OBJEXT) \
Ninfo.$(OBJEXT) Nmltest.$(OBJEXT) Output.$(OBJEXT) \
Outputgmt.$(OBJEXT) Pinfo.$(OBJEXT) Pressure.$(OBJEXT) \
Regres.$(OBJEXT) Remap.$(OBJEXT) Remapeta.$(OBJEXT) \
Replace.$(OBJEXT) Rotuv.$(OBJEXT) Runpctl.$(OBJEXT) \
Runstat.$(OBJEXT) Seascount.$(OBJEXT) Seaspctl.$(OBJEXT) \
Seasstat.$(OBJEXT) Selbox.$(OBJEXT) Select.$(OBJEXT) \
Select2.$(OBJEXT) Seloperator.$(OBJEXT) Selrec.$(OBJEXT) \
Seltime.$(OBJEXT) Set.$(OBJEXT) Setbox.$(OBJEXT) \
Setgatt.$(OBJEXT) Setgrid.$(OBJEXT) Sethalo.$(OBJEXT) \
Setmiss.$(OBJEXT) Setrange.$(OBJEXT) Setrcaname.$(OBJEXT) \
Settime.$(OBJEXT) Setzaxis.$(OBJEXT) Showinfo.$(OBJEXT) \
Sinfo.$(OBJEXT) Smooth9.$(OBJEXT) Sort.$(OBJEXT) \
Specinfo.$(OBJEXT) Spectral.$(OBJEXT) Spectrum.$(OBJEXT) \
Split.$(OBJEXT) Splitrec.$(OBJEXT) Splitsel.$(OBJEXT) \
Splittime.$(OBJEXT) Splityear.$(OBJEXT) Subtrend.$(OBJEXT) \
Templates.$(OBJEXT) Test.$(OBJEXT) Tests.$(OBJEXT) \
Timcount.$(OBJEXT) Timpctl.$(OBJEXT) Timsort.$(OBJEXT) \
Timselpctl.$(OBJEXT) Timselstat.$(OBJEXT) Timstat.$(OBJEXT) \
Timstat2.$(OBJEXT) Timstat3.$(OBJEXT) Tinfo.$(OBJEXT) \
Trend.$(OBJEXT) Trms.$(OBJEXT) Vardup.$(OBJEXT) \
Vargen.$(OBJEXT) Varrms.$(OBJEXT) Vertint.$(OBJEXT) \
Vertstat.$(OBJEXT) Vertwind.$(OBJEXT) Wind.$(OBJEXT) \
Writegrid.$(OBJEXT) Writerandom.$(OBJEXT) Yhourstat.$(OBJEXT) \
Ydaypctl.$(OBJEXT) Ydaystat.$(OBJEXT) Ydrunpctl.$(OBJEXT) \
Ydrunstat.$(OBJEXT) Ymonarith.$(OBJEXT) Ymonpctl.$(OBJEXT) \
Ymonstat.$(OBJEXT) Yseaspctl.$(OBJEXT) Yseasstat.$(OBJEXT) \
Zonstat.$(OBJEXT) cdilib.$(OBJEXT) commandline.$(OBJEXT) \
exception.$(OBJEXT) expr_yacc.$(OBJEXT) expr_lex.$(OBJEXT) \
expr.$(OBJEXT) cdo.$(OBJEXT) cdo_pthread.$(OBJEXT) \
cdo_vlist.$(OBJEXT) field.$(OBJEXT) fieldc.$(OBJEXT) \
field2.$(OBJEXT) fieldmer.$(OBJEXT) fieldzon.$(OBJEXT) \
grid.$(OBJEXT) grid_gme.$(OBJEXT) grid_lcc.$(OBJEXT) \
grid_rot.$(OBJEXT) griddes.$(OBJEXT) griddes_nc.$(OBJEXT) \
griddes_h5.$(OBJEXT) hetaeta.$(OBJEXT) history.$(OBJEXT) \
institution.$(OBJEXT) interpol.$(OBJEXT) job.$(OBJEXT) \
modules.$(OBJEXT) namelist.$(OBJEXT) normal.$(OBJEXT) \
pipe.$(OBJEXT) process.$(OBJEXT) remaplib.$(OBJEXT) \
timer.$(OBJEXT) realtime.$(OBJEXT) pstream.$(OBJEXT) \
table.$(OBJEXT) userlog.$(OBJEXT) util.$(OBJEXT) \
legendre.$(OBJEXT) fourier.$(OBJEXT) specspace.$(OBJEXT) \
readline.$(OBJEXT) julian.$(OBJEXT) vinterp.$(OBJEXT) \
zaxis.$(OBJEXT) par_io.$(OBJEXT) pthread_debug.$(OBJEXT) \
color.$(OBJEXT) list.$(OBJEXT) percentiles.$(OBJEXT) \
nth_element.$(OBJEXT) ecacore.$(OBJEXT) ecautil.$(OBJEXT) \
EcaIndices.$(OBJEXT) Hi.$(OBJEXT) Wct.$(OBJEXT) \
statistic.$(OBJEXT)
Ensstat.$(OBJEXT) EOF.$(OBJEXT) Exprf.$(OBJEXT) \
Filedes.$(OBJEXT) Fillmiss.$(OBJEXT) Filter.$(OBJEXT) \
Fldrms.$(OBJEXT) Fldstat.$(OBJEXT) Gengrid.$(OBJEXT) \
Gradsdes.$(OBJEXT) Gridboxstat.$(OBJEXT) Gridcell.$(OBJEXT) \
Harmonic.$(OBJEXT) Histogram.$(OBJEXT) Importamsr.$(OBJEXT) \
Importcmsaf.$(OBJEXT) Info.$(OBJEXT) Input.$(OBJEXT) \
Intgrid.$(OBJEXT) Intgridtraj.$(OBJEXT) Intlevel.$(OBJEXT) \
Inttime.$(OBJEXT) Intntime.$(OBJEXT) Intyear.$(OBJEXT) \
Invert.$(OBJEXT) Invertlev.$(OBJEXT) Log.$(OBJEXT) \
Maskbox.$(OBJEXT) Mastrfu.$(OBJEXT) Math.$(OBJEXT) \
Merge.$(OBJEXT) Mergegrid.$(OBJEXT) Mergetime.$(OBJEXT) \
Merstat.$(OBJEXT) Monarith.$(OBJEXT) Mrotuv.$(OBJEXT) \
Mrotuvb.$(OBJEXT) Ninfo.$(OBJEXT) Nmltest.$(OBJEXT) \
Output.$(OBJEXT) Outputgmt.$(OBJEXT) Pinfo.$(OBJEXT) \
Pressure.$(OBJEXT) Regres.$(OBJEXT) Remap.$(OBJEXT) \
Remapeta.$(OBJEXT) Replace.$(OBJEXT) Rotuv.$(OBJEXT) \
Runpctl.$(OBJEXT) Runstat.$(OBJEXT) Seascount.$(OBJEXT) \
Seaspctl.$(OBJEXT) Seasstat.$(OBJEXT) Selbox.$(OBJEXT) \
Select.$(OBJEXT) Select2.$(OBJEXT) Seloperator.$(OBJEXT) \
Selrec.$(OBJEXT) Seltime.$(OBJEXT) Set.$(OBJEXT) \
Setbox.$(OBJEXT) Setgatt.$(OBJEXT) Setgrid.$(OBJEXT) \
Sethalo.$(OBJEXT) Setmiss.$(OBJEXT) Setrange.$(OBJEXT) \
Setrcaname.$(OBJEXT) Settime.$(OBJEXT) Setzaxis.$(OBJEXT) \
Showinfo.$(OBJEXT) Sinfo.$(OBJEXT) Smooth9.$(OBJEXT) \
Sort.$(OBJEXT) Specinfo.$(OBJEXT) Spectral.$(OBJEXT) \
Spectrum.$(OBJEXT) Split.$(OBJEXT) Splitrec.$(OBJEXT) \
Splitsel.$(OBJEXT) Splittime.$(OBJEXT) Splityear.$(OBJEXT) \
Subtrend.$(OBJEXT) Templates.$(OBJEXT) Test.$(OBJEXT) \
Tests.$(OBJEXT) Timcount.$(OBJEXT) Timpctl.$(OBJEXT) \
Timsort.$(OBJEXT) Timselpctl.$(OBJEXT) Timselstat.$(OBJEXT) \
Timstat.$(OBJEXT) Timstat2.$(OBJEXT) Timstat3.$(OBJEXT) \
Tinfo.$(OBJEXT) Trend.$(OBJEXT) Trms.$(OBJEXT) \
Vardup.$(OBJEXT) Vargen.$(OBJEXT) Varrms.$(OBJEXT) \
Vertint.$(OBJEXT) Vertstat.$(OBJEXT) Vertwind.$(OBJEXT) \
Wind.$(OBJEXT) Writegrid.$(OBJEXT) Writerandom.$(OBJEXT) \
Yhourstat.$(OBJEXT) Ydaypctl.$(OBJEXT) Ydaystat.$(OBJEXT) \
Ydrunpctl.$(OBJEXT) Ydrunstat.$(OBJEXT) Ymonarith.$(OBJEXT) \
Ymonpctl.$(OBJEXT) Ymonstat.$(OBJEXT) Yseaspctl.$(OBJEXT) \
Yseasstat.$(OBJEXT) Zonstat.$(OBJEXT) cdilib.$(OBJEXT) \
commandline.$(OBJEXT) exception.$(OBJEXT) expr_yacc.$(OBJEXT) \
expr_lex.$(OBJEXT) expr.$(OBJEXT) cdo.$(OBJEXT) \
cdo_pthread.$(OBJEXT) cdo_vlist.$(OBJEXT) field.$(OBJEXT) \
fieldc.$(OBJEXT) field2.$(OBJEXT) fieldmer.$(OBJEXT) \
fieldzon.$(OBJEXT) grid.$(OBJEXT) grid_gme.$(OBJEXT) \
grid_lcc.$(OBJEXT) grid_rot.$(OBJEXT) griddes.$(OBJEXT) \
griddes_nc.$(OBJEXT) griddes_h5.$(OBJEXT) hetaeta.$(OBJEXT) \
history.$(OBJEXT) institution.$(OBJEXT) interpol.$(OBJEXT) \
job.$(OBJEXT) modules.$(OBJEXT) namelist.$(OBJEXT) \
normal.$(OBJEXT) pipe.$(OBJEXT) process.$(OBJEXT) \
remaplib.$(OBJEXT) timer.$(OBJEXT) realtime.$(OBJEXT) \
pstream.$(OBJEXT) table.$(OBJEXT) userlog.$(OBJEXT) \
util.$(OBJEXT) legendre.$(OBJEXT) fourier.$(OBJEXT) \
specspace.$(OBJEXT) readline.$(OBJEXT) julian.$(OBJEXT) \
vinterp.$(OBJEXT) zaxis.$(OBJEXT) par_io.$(OBJEXT) \
pthread_debug.$(OBJEXT) color.$(OBJEXT) list.$(OBJEXT) \
percentiles.$(OBJEXT) nth_element.$(OBJEXT) ecacore.$(OBJEXT) \
ecautil.$(OBJEXT) EcaIndices.$(OBJEXT) Hi.$(OBJEXT) \
Wct.$(OBJEXT) statistic.$(OBJEXT)
cdo_OBJECTS = $(am_cdo_OBJECTS)
cdo_LDADD = $(LDADD)
am_cdotest_OBJECTS = cdilib.$(OBJEXT) cdotest.$(OBJEXT)
......@@ -249,6 +249,7 @@ cdo_SOURCES = Arith.c \
Enlarge.c \
Enlargegrid.c \
Ensstat.c \
EOF.c \
Exprf.c \
Filedes.c \
Fillmiss.c \
......@@ -574,6 +575,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Del29feb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Detrend.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Diff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EOF.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/EcaIndices.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Echam5ini.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Enlarge.Po@am__quote@
......
......@@ -56,6 +56,7 @@ void *Echam5ini(void *argument);
void *Enlarge(void *argument);
void *Enlargegrid(void *argument);
void *Ensstat(void *argument);
void *Timeof(void *argument);
void *Expr(void *argument);
void *Filedes(void *argument);
void *Fillmiss(void *argument);
......@@ -257,6 +258,7 @@ void *Wct(void *argument);
#define EnlargeOperators {"enlarge"}
#define EnlargegridOperators {"enlargegrid"}
#define EnsstatOperators {"ensmin", "ensmax", "enssum", "ensmean", "ensavg", "ensvar", "ensstd", "enspctl"}
#define TimeofOperators {"timeof"}
#define ExprOperators {"expr", "exprf", "aexpr", "aexprf"}
#define FiledesOperators {"filedes", "griddes", "griddes2", "zaxisdes", "vct", "pardes", "taxisdes", "vlist", "partab", "partab2"}
#define FillmissOperators {"fillmiss"}
......@@ -491,6 +493,7 @@ static MODULES Modules[] =
{ Enlarge, EnlargeHelp, EnlargeOperators, 1, 1 },
{ Enlargegrid, NULL, EnlargegridOperators, 1, 1 },
{ Ensstat, EnsstatHelp, EnsstatOperators, -1, 1 },
{ Timeof, NULL, TimeofOperators, 1, 1 },
{ Expr, ExprHelp, ExprOperators, 1, 1 },
{ Filedes, FiledesHelp, FiledesOperators, 1, 0 },
{ Fillmiss, NULL, FillmissOperators, 1, 1 },
......
......@@ -12,20 +12,13 @@
#include "par_io.h"
#include "pstream.h"
typedef struct {
int streamID;
int *varID, *levelID, *nmiss;
double *array;
}
READ_ARG;
void *readRecord(void *arg)
{
int streamID;
int *varID, *levelID, *nmiss;
double *array;
READ_ARG *read_arg = (READ_ARG *) arg;
read_arg_t *read_arg = (read_arg_t *) arg;
streamID = read_arg->streamID;
varID = read_arg->varID;
......@@ -33,9 +26,10 @@ void *readRecord(void *arg)
nmiss = read_arg->nmiss;
array = read_arg->array;
/* fprintf(stderr, "streamInqRecord: streamID = %d\n", streamID); */
streamInqRecord(streamID, varID, levelID);
streamReadRecord(streamID, array, nmiss);
fprintf(stderr, "1 varID %d levelID %d\n", *varID, *levelID);
/* fprintf(stderr, "readRecord: varID %d levelID %d\n", *varID, *levelID); */
return (NULL);
}
......@@ -44,8 +38,6 @@ void *readRecord(void *arg)
void parReadRecord(int streamID, int *varID, int *levelID, double *array, int *nmiss, par_io_t *parIO)
{
int lpario = FALSE;
READ_ARG read_arg;
void *statusp;
int recID = 0, nrecs = 0;
#if defined (HAVE_LIBPTHREAD)