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

Renamed Field.vec to Field.vec_d.

parent e66498bb
......@@ -100,9 +100,9 @@ calc_adisit(size_t gridsize, size_t nlevel, const Varray<double> &pressure, cons
for (size_t levelID = 0; levelID < nlevel; ++levelID)
{
const auto &thovec = tho[levelID].vec;
const auto &saovec = sao[levelID].vec;
auto &tisvec = tis[levelID].vec;
const auto &thovec = tho[levelID].vec_d;
const auto &saovec = sao[levelID].vec_d;
auto &tisvec = tis[levelID].vec_d;
const auto tho_missval = tho[levelID].missval;
const auto sao_missval = sao[levelID].missval;
const auto tis_missval = tis[levelID].missval;
......@@ -130,9 +130,9 @@ calc_adipot(size_t gridsize, size_t nlevel, const Varray<double> &pressure, cons
for (size_t levelID = 0; levelID < nlevel; ++levelID)
{
const auto &tvec = t[levelID].vec;
const auto &svec = s[levelID].vec;
auto &tpotvec = tpot[levelID].vec;
const auto &tvec = t[levelID].vec_d;
const auto &svec = s[levelID].vec_d;
auto &tpotvec = tpot[levelID].vec_d;
const auto t_missval = t[levelID].missval;
const auto s_missval = s[levelID].missval;
const auto tpot_missval = tpot[levelID].missval;
......@@ -292,8 +292,8 @@ Adisit(void *process)
for (int recID = 0; recID < nrecs; ++recID)
{
cdoInqRecord(streamID1, &varID, &levelID);
if (varID == thoID) cdoReadRecord(streamID1, tho[levelID].vec.data(), &tho[levelID].nmiss);
if (varID == saoID) cdoReadRecord(streamID1, sao[levelID].vec.data(), &sao[levelID].nmiss);
if (varID == thoID) cdoReadRecord(streamID1, tho[levelID].vec_d.data(), &tho[levelID].nmiss);
if (varID == saoID) cdoReadRecord(streamID1, sao[levelID].vec_d.data(), &sao[levelID].nmiss);
}
if (operatorID == ADISIT)
......@@ -304,10 +304,10 @@ Adisit(void *process)
for (levelID = 0; levelID < nlevel; ++levelID)
{
cdoDefRecord(streamID2, tisID2, levelID);
cdoWriteRecord(streamID2, tis[levelID].vec.data(), fieldNumMiss(tis[levelID]));
cdoWriteRecord(streamID2, tis[levelID].vec_d.data(), fieldNumMiss(tis[levelID]));
cdoDefRecord(streamID2, saoID2, levelID);
cdoWriteRecord(streamID2, sao[levelID].vec.data(), fieldNumMiss(sao[levelID]));
cdoWriteRecord(streamID2, sao[levelID].vec_d.data(), fieldNumMiss(sao[levelID]));
}
tsID++;
......
......@@ -287,12 +287,12 @@ Arith(void *process)
if (lread1)
{
cdoInqRecord(streamID1, &varID, &levelID);
cdoReadRecord(streamID1, fieldx1->vec.data(), &fieldx1->nmiss);
cdoReadRecord(streamID1, fieldx1->vec_d.data(), &fieldx1->nmiss);
if (lfill1x)
{
const auto gridsize = nwpv * varList1[varID].gridsize;
arrayCopy(gridsize, fieldx1->vec.data(), &vardata2[0]);
arrayCopy(gridsize, fieldx1->vec_d.data(), &vardata2[0]);
varnmiss2[0] = fieldx1->nmiss;
}
}
......@@ -307,7 +307,7 @@ Arith(void *process)
if (lstatus || (filltype != FILL_VAR && filltype != FILL_VARTS))
{
cdoInqRecord(streamID2, &varID2, &levelID2);
cdoReadRecord(streamID2, fieldx2->vec.data(), &fieldx2->nmiss);
cdoReadRecord(streamID2, fieldx2->vec_d.data(), &fieldx2->nmiss);
if (varID != varID2) cdoAbort("Internal error, varIDs of input streams differ!");
if (lfill1x == false && levelID != levelID2) cdoAbort("Internal error, levelIDs of input streams differ!");
}
......@@ -316,14 +316,14 @@ Arith(void *process)
{
const auto gridsize = nwpv * varList2[varID].gridsize;
const auto offset = gridsize * levelID;
arrayCopy(gridsize, fieldx2->vec.data(), &vardata[varID][offset]);
arrayCopy(gridsize, fieldx2->vec_d.data(), &vardata[varID][offset]);
varnmiss[varID][levelID] = fieldx2->nmiss;
}
else if (lstatus && (filltype == FILL_VAR || filltype == FILL_VARTS))
{
const auto gridsize = nwpv * varList2[0].gridsize;
const auto offset = gridsize * levelID2;
arrayCopy(gridsize, fieldx2->vec.data(), &vardata2[offset]);
arrayCopy(gridsize, fieldx2->vec_d.data(), &vardata2[offset]);
varnmiss2[levelID2] = fieldx2->nmiss;
}
}
......@@ -331,14 +331,14 @@ Arith(void *process)
{
const auto gridsize = nwpv * varList2[varID2].gridsize;
const auto offset = gridsize * levelID;
arrayCopy(gridsize, &vardata[varID][offset], fieldx2->vec.data());
arrayCopy(gridsize, &vardata[varID][offset], fieldx2->vec_d.data());
fieldx2->nmiss = varnmiss[varID][levelID];
}
if (lfill1x)
{
const auto gridsize = nwpv * varList1[0].gridsize;
arrayCopy(gridsize, &vardata2[0], fieldx1->vec.data());
arrayCopy(gridsize, &vardata2[0], fieldx1->vec_d.data());
fieldx1->nmiss = varnmiss2[0];
}
......@@ -350,7 +350,7 @@ Arith(void *process)
levelID2 = (nlevels2 > 1) ? levelID : 0;
const auto gridsize = nwpv * varList2[0].gridsize;
const auto offset = gridsize * levelID2;
arrayCopy(gridsize, &vardata2[offset], fieldx2->vec.data());
arrayCopy(gridsize, &vardata2[offset], fieldx2->vec_d.data());
fieldx2->nmiss = varnmiss2[levelID2];
fieldx2->grid = varList2[0].gridID;
fieldx2->missval = varList2[0].missval;
......@@ -367,7 +367,7 @@ Arith(void *process)
vfarfun(field1, field2, operfunc);
cdoDefRecord(streamID3, varID, levelID);
cdoWriteRecord(streamID3, field1.vec.data(), field1.nmiss);
cdoWriteRecord(streamID3, field1.vec_d.data(), field1.nmiss);
}
tsID++;
......
......@@ -130,7 +130,7 @@ Arithc(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
cdoInqRecord(streamID1, &varID, &levelID);
cdoReadRecord(streamID1, field.vec.data(), &field.nmiss);
cdoReadRecord(streamID1, field.vec_d.data(), &field.nmiss);
if (vars[varID])
{
......@@ -150,7 +150,7 @@ Arithc(void *process)
}
cdoDefRecord(streamID2, varID, levelID);
cdoWriteRecord(streamID2, field.vec.data(), field.nmiss);
cdoWriteRecord(streamID2, field.vec_d.data(), field.nmiss);
}
tsID++;
......
......@@ -125,7 +125,7 @@ Arithdays(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
cdoInqRecord(streamID1, &varID, &levelID);
cdoReadRecord(streamID1, field.vec.data(), &field.nmiss);
cdoReadRecord(streamID1, field.vec_d.data(), &field.nmiss);
field.grid = vlistInqVarGrid(vlistID1, varID);
field.missval = vlistInqVarMissval(vlistID1, varID);
......@@ -133,7 +133,7 @@ Arithdays(void *process)
vfarcfun(field, rconst, operfunc);
cdoDefRecord(streamID2, varID, levelID);
cdoWriteRecord(streamID2, field.vec.data(), field.nmiss);
cdoWriteRecord(streamID2, field.vec_d.data(), field.nmiss);
}
tsID++;
......
......@@ -47,11 +47,11 @@ static void
selEndOfPeriod(Field &periods, const Field &history, const Field &current, int isLastTimestep)
{
double pmissval = periods.missval;
auto &parray = periods.vec;
auto &parray = periods.vec_d;
double hmissval = history.missval;
const auto &harray = history.vec;
const auto &harray = history.vec_d;
double cmissval = current.missval;
const auto &carray = current.vec;
const auto &carray = current.vec_d;
auto len = gridInqSize(periods.grid);
if (len != gridInqSize(current.grid) || (gridInqSize(current.grid) != gridInqSize(history.grid)))
......@@ -196,7 +196,7 @@ Consecstat(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
cdoInqRecord(istreamID, &varID, &levelID);
cdoReadRecord(istreamID, field.vec.data(), &field.nmiss);
cdoReadRecord(istreamID, field.vec_d.data(), &field.nmiss);
field.grid = varList[varID].gridID;
field.size = varList[varID].gridsize;
field.missval = varList[varID].missval;
......@@ -207,20 +207,20 @@ Consecstat(void *process)
{
case CONSECSUM:
cdoDefRecord(ostreamID, varID, levelID);
cdoWriteRecord(ostreamID, vars[varID][levelID].vec.data(), vars[varID][levelID].nmiss);
cdoWriteRecord(ostreamID, vars[varID][levelID].vec_d.data(), vars[varID][levelID].nmiss);
break;
case CONSECTS:
if (itsID != 0)
{
selEndOfPeriod(periods[varID][levelID], hist[varID][levelID], vars[varID][levelID], false);
cdoDefRecord(ostreamID, varID, levelID);
cdoWriteRecord(ostreamID, periods[varID][levelID].vec.data(), periods[varID][levelID].nmiss);
cdoWriteRecord(ostreamID, periods[varID][levelID].vec_d.data(), periods[varID][levelID].nmiss);
}
#ifdef _OPENMP
#pragma omp parallel for default(shared) schedule(static)
for (size_t i = 0; i < vars[varID][levelID].size; i++) hist[varID][levelID].vec[i] = vars[varID][levelID].vec[i];
for (size_t i = 0; i < vars[varID][levelID].size; i++) hist[varID][levelID].vec_d[i] = vars[varID][levelID].vec_d[i];
#else
hist[varID][levelID].vec = vars[varID][levelID].vec;
hist[varID][levelID].vec_d = vars[varID][levelID].vec_d;
#endif
break;
default: printf(SWITCHWARN, __func__); break;
......@@ -246,7 +246,7 @@ Consecstat(void *process)
{
selEndOfPeriod(periods[varID][levelID], hist[varID][levelID], vars[varID][levelID], true);
cdoDefRecord(ostreamID, varID, levelID);
cdoWriteRecord(ostreamID, periods[varID][levelID].vec.data(), periods[varID][levelID].nmiss);
cdoWriteRecord(ostreamID, periods[varID][levelID].vec_d.data(), periods[varID][levelID].nmiss);
}
}
}
......
......@@ -72,7 +72,7 @@ Deltat(void *process)
for (int recID = 0; recID < nrecs; ++recID)
{
cdoInqRecord(streamID1, &varID, &levelID);
cdoReadRecord(streamID1, vars[varID][levelID].vec.data(), &nmiss);
cdoReadRecord(streamID1, vars[varID][levelID].vec_d.data(), &nmiss);
vars[varID][levelID].nmiss = nmiss;
}
......@@ -94,7 +94,7 @@ Deltat(void *process)
const auto missval = vars[varID][levelID].missval;
const auto fieldsize = vars[varID][levelID].size;
auto &array0 = vars[varID][levelID].vec;
auto &array0 = vars[varID][levelID].vec_d;
if (nmiss || vars[varID][levelID].nmiss)
{
for (size_t i = 0; i < fieldsize; ++i)
......
......@@ -146,7 +146,7 @@ Detrend(void *process)
{
cdoInqRecord(streamID1, &varID, &levelID);
vars[tsID][varID][levelID].resize(varList[varID].gridsize);
cdoReadRecord(streamID1, vars[tsID][varID][levelID].vec.data(), &nmiss);
cdoReadRecord(streamID1, vars[tsID][varID][levelID].vec_d.data(), &nmiss);
vars[tsID][varID][levelID].nmiss = nmiss;
}
......@@ -176,11 +176,11 @@ Detrend(void *process)
{
const auto ompthID = cdo_omp_get_thread_num();
for (int tsID = 0; tsID < nsteps; ++tsID) array1[ompthID][tsID] = vars[tsID][varID][levelID].vec[i];
for (int tsID = 0; tsID < nsteps; ++tsID) array1[ompthID][tsID] = vars[tsID][varID][levelID].vec_d[i];
detrend(nsteps, deltaTS0, missval, array1[ompthID], array2[ompthID]);
for (int tsID = 0; tsID < nsteps; ++tsID) vars[tsID][varID][levelID].vec[i] = array2[ompthID][tsID];
for (int tsID = 0; tsID < nsteps; ++tsID) vars[tsID][varID][levelID].vec_d[i] = array2[ompthID][tsID];
}
}
}
......@@ -198,7 +198,7 @@ Detrend(void *process)
{
nmiss = vars[tsID][varID][levelID].nmiss;
cdoDefRecord(streamID2, varID, levelID);
cdoWriteRecord(streamID2, vars[tsID][varID][levelID].vec.data(), nmiss);
cdoWriteRecord(streamID2, vars[tsID][varID][levelID].vec_d.data(), nmiss);
}
}
}
......
......@@ -90,7 +90,7 @@ Duplicate(void *process)
cdoInqRecord(streamID1, &varID, &levelID);
const auto gridsize = varList[varID].gridsize;
vars[tsID][varID][levelID].resize(gridsize);
cdoReadRecord(streamID1, vars[tsID][varID][levelID].vec.data(), &nmiss);
cdoReadRecord(streamID1, vars[tsID][varID][levelID].vec_d.data(), &nmiss);
vars[tsID][varID][levelID].nmiss = nmiss;
}
......@@ -112,11 +112,11 @@ Duplicate(void *process)
const auto nlevel = varList[varID].nlevels;
for (levelID = 0; levelID < nlevel; levelID++)
{
if (!vars[tsID][varID][levelID].vec.empty())
if (!vars[tsID][varID][levelID].vec_d.empty())
{
nmiss = vars[tsID][varID][levelID].nmiss;
cdoDefRecord(streamID2, varID, levelID);
cdoWriteRecord(streamID2, vars[tsID][varID][levelID].vec.data(), nmiss);
cdoWriteRecord(streamID2, vars[tsID][varID][levelID].vec_d.data(), nmiss);
}
}
}
......
......@@ -120,7 +120,7 @@ static void writeTimesteps(int MaxMonths, int recentYear, FieldVector3D &cei, in
vfarcdiv(cei[loopmonth-2][0][levelIDo], (double) (tempdpm[loopmonth-2]/100.0));
cdoDefRecord(streamID4, varIDo, levelIDo);
cdoWriteRecord(streamID4, cei[loopmonth-2][0][levelIDo].vec.data(), cei[loopmonth-2][0][levelIDo].nmiss);
cdoWriteRecord(streamID4, cei[loopmonth-2][0][levelIDo].vec_d.data(), cei[loopmonth-2][0][levelIDo].nmiss);
}
(*otsID)++;
}
......@@ -137,7 +137,7 @@ static void writeTimesteps(int MaxMonths, int recentYear, FieldVector3D &cei, in
if (func2 == func_avg)
vfarcdiv(cei[0][0][levelIDo], (double) (tempdpy/100.0));
cdoDefRecord(streamID4, varIDo, levelIDo);
cdoWriteRecord(streamID4, cei[0][0][levelIDo].vec.data(), cei[0][0][levelIDo].nmiss);
cdoWriteRecord(streamID4, cei[0][0][levelIDo].vec_d.data(), cei[0][0][levelIDo].nmiss);
}
(*otsID)++;
}
......@@ -193,7 +193,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
for (int recID = 0; recID < nrecs; recID++)
{
streamInqRecord(cdiStream, &varID, &levelID);
streamReadRecord(cdiStream, field.vec.data(), &field.nmiss);
streamReadRecord(cdiStream, field.vec_d.data(), &field.nmiss);
Field &pctls = varsPtemp[dayoy][0][levelID];
if ( selection == func_selle )
......@@ -201,7 +201,7 @@ static void calculateOuterPeriod(Field &field, int MaxMonths, int recentYear, in
else if ( selection == func_selge )
vfarselge(field, pctls);
auto &array = field.vec;
auto &array = field.vec_d;
if (func2 == func_avg)
for (size_t i = 0; i < field.size; i++) array[i] = (DBL_IS_EQUAL(array[i], field.missval)) ? 0.0 : 1.0;
else
......@@ -384,7 +384,7 @@ etccdi_op(ETCCDI_REQUEST *request)
if ( FIELD_MEMTYPE == FIELD_FLT )
cdoReadRecordF(streamID2, vars2[dayoy][varID][levelID].vec_f.data(), &nmiss);
else
cdoReadRecord(streamID2, vars2[dayoy][varID][levelID].vec.data(), &nmiss);
cdoReadRecord(streamID2, vars2[dayoy][varID][levelID].vec_d.data(), &nmiss);
vars2[dayoy][varID][levelID].nmiss = nmiss;
varsPtemp[dayoy][varID][levelID].nmiss = nmiss;
}
......@@ -394,7 +394,7 @@ etccdi_op(ETCCDI_REQUEST *request)
if ( FIELD_MEMTYPE == FIELD_FLT )
cdoReadRecordF(streamID3, field.vec_f.data(), &nmiss);
else
cdoReadRecord(streamID3, field.vec.data(), &nmiss);
cdoReadRecord(streamID3, field.vec_d.data(), &nmiss);
field.nmiss = nmiss;
field.grid = vars2[dayoy][varID][levelID].grid;
field.missval = vars2[dayoy][varID][levelID].missval;
......@@ -444,7 +444,7 @@ etccdi_op(ETCCDI_REQUEST *request)
if ( FIELD_MEMTYPE == FIELD_FLT )
cdoReadRecordF(streamID1, vars1[dayoy+(year-request->startboot)*(MaxDays-1)][varID][levelID].vec_f.data(), &nmiss);
else
cdoReadRecord(streamID1, vars1[dayoy+(year-request->startboot)*(MaxDays-1)][varID][levelID].vec.data(), &nmiss);
cdoReadRecord(streamID1, vars1[dayoy+(year-request->startboot)*(MaxDays-1)][varID][levelID].vec_d.data(), &nmiss);
vars1[dayoy+(year-request->startboot)*(MaxDays-1)][varID][levelID].nmiss = nmiss;
if ( tsID == 0 )
{
......@@ -655,12 +655,12 @@ etccdi_op(ETCCDI_REQUEST *request)
vfarselge(toCompare, pctls);
if ( request->func2 == func_avg )
{
auto &array = toCompare.vec;
auto &array = toCompare.vec_d;
for (size_t i = 0; i < toCompare.size; i++) array[i] = (DBL_IS_EQUAL(array[i], toCompare.missval)) ? 0.0 : 1.0;
}
else
{
auto &array = toCompare.vec;
auto &array = toCompare.vec_d;
for (size_t i = 0; i < toCompare.size; i++) array[i] = (DBL_IS_EQUAL(array[i], toCompare.missval)) ? 0.0 : array[i];
}
/* printf("Haben ein Percentil berechnet.\n");*/
......@@ -699,13 +699,13 @@ etccdi_op(ETCCDI_REQUEST *request)
if ( frequency == 8 )
{
for ( month = 0; month < MaxMonths; month++ )
if (cei[(bootsyear-request->startboot)*MaxMonths+month][varID][levelID].vec.data())
if (cei[(bootsyear-request->startboot)*MaxMonths+month][varID][levelID].vec_d.data())
{
/* Divide vars2 to receive average */
vfarcdiv(cei[(bootsyear-request->startboot)*MaxMonths+month][varID][levelID], (double) ((sumboot-1)*dpm[(bootsyear-request->startboot)*MaxMonths+month]/100.0));
}
}
else if (cei[(bootsyear-request->startboot)*MaxMonths][varID][levelID].vec.data())
else if (cei[(bootsyear-request->startboot)*MaxMonths][varID][levelID].vec_d.data())
{
vfarcdiv(cei[(bootsyear-request->startboot)*MaxMonths][varID][levelID], (double) ((sumboot-1)*dpy[bootsyear-request->startboot]/100.0));
}
......@@ -724,7 +724,7 @@ etccdi_op(ETCCDI_REQUEST *request)
int varIDo = recinfo[recID].varID;
int levelIDo = recinfo[recID].levelID;
cdoDefRecord(streamID4, varIDo, levelIDo);
cdoWriteRecord(streamID4, cei[(bootsyear-request->startboot)*MaxMonths+(month-2)][varIDo][levelIDo].vec.data(), cei[(bootsyear-request->startboot)*MaxMonths+(month-2)][varIDo][levelIDo].nmiss);
cdoWriteRecord(streamID4, cei[(bootsyear-request->startboot)*MaxMonths+(month-2)][varIDo][levelIDo].vec_d.data(), cei[(bootsyear-request->startboot)*MaxMonths+(month-2)][varIDo][levelIDo].nmiss);
}
otsID++;
}
......@@ -740,7 +740,7 @@ etccdi_op(ETCCDI_REQUEST *request)
int varIDo = recinfo[recID].varID;
int levelIDo = recinfo[recID].levelID;
cdoDefRecord(streamID4, varIDo, levelIDo);
cdoWriteRecord(streamID4, cei[(bootsyear-request->startboot)*MaxMonths][varIDo][levelIDo].vec.data(), cei[(bootsyear-request->startboot)*MaxMonths][varIDo][levelIDo].nmiss);
cdoWriteRecord(streamID4, cei[(bootsyear-request->startboot)*MaxMonths][varIDo][levelIDo].vec_d.data(), cei[(bootsyear-request->startboot)*MaxMonths][varIDo][levelIDo].nmiss);
}
otsID++;
}
......
......@@ -105,10 +105,10 @@ ensstat_func(void *ensarg)
fields[ompthID].nmiss = 0;
for (int fileID = 0; fileID < nfiles; fileID++)
{
fields[ompthID].vec[fileID] = ef[fileID].array[t][i];
if (lmiss && DBL_IS_EQUAL(fields[ompthID].vec[fileID], ef[fileID].missval[t]))
fields[ompthID].vec_d[fileID] = ef[fileID].array[t][i];
if (lmiss && DBL_IS_EQUAL(fields[ompthID].vec_d[fileID], ef[fileID].missval[t]))
{
fields[ompthID].vec[fileID] = missval;
fields[ompthID].vec_d[fileID] = missval;
fields[ompthID].nmiss++;
}
}
......
......@@ -311,8 +311,8 @@ Ensstat3(void *process)
have_miss = 0;
for (int fileID = 0; fileID < nfiles; fileID++)
{
field[ompthID].vec[fileID] = ef[fileID].array[i];
if (DBL_IS_EQUAL(field[ompthID].vec[fileID], missval))
field[ompthID].vec_d[fileID] = ef[fileID].array[i];
if (DBL_IS_EQUAL(field[ompthID].vec_d[fileID], missval))
{
have_miss = 1;
break;
......@@ -330,7 +330,7 @@ Ensstat3(void *process)
/* RANK HISTOGRAM */
/* ************** */
// for ( j=0; j<nfiles; j++ )
// fprintf(stderr,"%5.2g ",field[ompthID].vec[j]);
// fprintf(stderr,"%5.2g ",field[ompthID].vec_d[j]);
#ifdef _OPENMP
#pragma omp critical
#endif
......@@ -347,8 +347,8 @@ Ensstat3(void *process)
/* ********************************** */
/* RECEIVER OPERATING CHARACTERISTICS */
/* ********************************** */
dat = &field[ompthID].vec[1];
ival = field[ompthID].vec[0] > 0.5 ? 1 : 0;
dat = &field[ompthID].vec_d[1];
ival = field[ompthID].vec_d[0] > 0.5 ? 1 : 0;
for (binID = 0; binID < nbins; binID++) hist[binID] = 0;
......
......@@ -97,12 +97,12 @@ Eofcoeff(void *process)
eof[varID][levelID][eofID].grid = gridID1;
eof[varID][levelID][eofID].missval = missval1;
eof[varID][levelID][eofID].resize(gridsize);
varrayFill(gridsize, eof[varID][levelID][eofID].vec, missval1);
varrayFill(gridsize, eof[varID][levelID][eofID].vec_d, missval1);
if (varID >= nvars) cdoAbort("Internal error - varID >= nvars");
if (levelID >= nlevs) cdoAbort("Internal error - levelID >= nlevs");
cdoReadRecord(streamID1, eof[varID][levelID][eofID].vec.data(), &nmiss);
cdoReadRecord(streamID1, eof[varID][levelID][eofID].vec_d.data(), &nmiss);
eof[varID][levelID][eofID].nmiss = nmiss;
}
eofID++;
......@@ -169,34 +169,34 @@ Eofcoeff(void *process)
{
cdoInqRecord(streamID2, &varID, &levelID);
missval2 = vlistInqVarMissval(vlistID2, varID);
cdoReadRecord(streamID2, in.vec.data(), &in.nmiss);
cdoReadRecord(streamID2, in.vec_d.data(), &in.nmiss);
for (eofID = 0; eofID < neof; eofID++)
{
if (recID == 0) cdoDefTimestep(streamIDs[eofID], tsID);
// if ( recID == 0 ) fprintf(stderr, "ts%i rec%i eof%i\n", tsID, recID, eofID);
out.vec[0] = 0;
out.vec_d[0] = 0;
out.grid = gridID3;
out.missval = missval2;
for (size_t i = 0; i < gridsize; i++)
{
if (!DBL_IS_EQUAL(in.vec[i], missval2) && !DBL_IS_EQUAL(eof[varID][levelID][eofID].vec[i], missval1))
if (!DBL_IS_EQUAL(in.vec_d[i], missval2) && !DBL_IS_EQUAL(eof[varID][levelID][eofID].vec_d[i], missval1))
{
// out.vec[0] += w[i]*in.vec[i]*eof[varID][levelID][eofID].vec[i];
out.vec[0] += in.vec[i] * eof[varID][levelID][eofID].vec[i];
// out.vec_d[0] += w[i]*in.vec_d[i]*eof[varID][levelID][eofID].vec_d[i];
out.vec_d[0] += in.vec_d[i] * eof[varID][levelID][eofID].vec_d[i];
}
}
if (!DBL_IS_EQUAL(out.vec[0], 0.))
if (!DBL_IS_EQUAL(out.vec_d[0], 0.))
nmiss = 0;
else
{
nmiss = 1;
out.vec[0] = missval2;
out.vec_d[0] = missval2;
}
cdoDefRecord(streamIDs[eofID], varID, levelID);
// fprintf(stderr, "%d %d %d %d %d %g\n", streamIDs[eofID],tsID, recID, varID, levelID,*out.vec.data());
cdoWriteRecord(streamIDs[eofID], out.vec.data(), nmiss);
// fprintf(stderr, "%d %d %d %d %d %g\n", streamIDs[eofID],tsID, recID, varID, levelID,*out.vec_d.data());
cdoWriteRecord(streamIDs[eofID], out.vec_d.data(), nmiss);
}
if (varID >= nvars) cdoAbort("Internal error - varID >= nvars");
if (levelID >= nlevs) cdoAbort("Internal error - levelID >= nlevs");
......
......@@ -92,12 +92,12 @@ Eofcoeff3d(void *process)
eof[varID][levelID][eofID].grid = gridID1;
eof[varID][levelID][eofID].missval = missval1;
eof[varID][levelID][eofID].resize(gridsize);
varrayFill(gridsize, eof[varID][levelID][eofID].vec, missval1);
varrayFill(gridsize, eof[varID][levelID][eofID].vec_d, missval1);
if (varID >= nvars) cdoAbort("Internal error - varID >= nvars");
if (levelID >= nlevs) cdoAbort("Internal error - levelID >= nlevs");
cdoReadRecord(streamID1, eof[varID][levelID][eofID].vec.data(), &nmiss);
cdoReadRecord(streamID1, eof[varID][levelID][eofID].vec_d.data(), &nmiss);
eof[varID][levelID][eofID].nmiss = nmiss;
}
eofID++;
......@@ -175,7 +175,7 @@ Eofcoeff3d(void *process)
for (varID = 0; varID < nvars; varID++)
for (eofID = 0; eofID < neof; eofID++)
{
out[varID][eofID].vec[0] = 0;
out[varID][eofID].vec_d[0] = 0;
out[varID][eofID].grid = gridID3;
out[varID][eofID].missval = missval2;
}
......@@ -185,7 +185,7 @@ Eofcoeff3d(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
cdoInqRecord(streamID2, &varID, &levelID);
cdoReadRecord(streamID2, in.vec.data(), &in.nmiss);
cdoReadRecord(streamID2, in.vec_d.data(), &in.nmiss);
missval2 = vlistInqVarMissval(vlistID2, varID);
for (eofID = 0; eofID < neof; eofID++)
......@@ -195,10 +195,10 @@ Eofcoeff3d(void *process)
nmiss = 0;
for (size_t i = 0; i < gridsize; i++)
{
if (!DBL_IS_EQUAL(in.vec[i], missval2) && !DBL_IS_EQUAL(eof[varID][levelID][eofID].vec[i], missval1))
if (!DBL_IS_EQUAL(in.vec_d[i], missval2) && !DBL_IS_EQUAL(eof[varID][levelID][eofID].vec_d[i], missval1))
{
// out[varID][eofID].vec[0] += w[i]*in.vec[i]*eof[varID][levelID][eofID].vec[i];
out[varID][eofID].vec[0] += in.vec[i] * eof[varID][levelID][eofID].vec[i];
// out[varID][eofID].vec_d[0] += w[i]*in.vec_d[i]*eof[varID][levelID][eofID].vec_d[i];
out[varID][eofID].vec_d[0] += in.vec_d[i] * eof[varID][levelID][eofID].vec_d[i];
;
}
else
......@@ -207,7 +207,7 @@ Eofcoeff3d(void *process)
/*
if ( nmiss ) {
out[varID][eofID].nmiss=1;
out[varID][eofID].vec[0] = missval2;
out[varID][eofID].vec_d[0] = missval2;
}
*/
}
......@@ -221,7 +221,7 @@ Eofcoeff3d(void *process)
for (varID = 0; varID < nvars; varID++)
{
cdoDefRecord(streamIDs[eofID], varID, 0);
cdoWriteRecord(streamIDs[eofID], out[varID][eofID].vec.data(), out[varID][eofID].nmiss);
cdoWriteRecord(streamIDs[eofID], out[varID][eofID].vec_d.data(), out[varID][eofID].nmiss);
}
}
......
......@@ -46,8 +46,8 @@ fillmiss(Field &field1, Field &field2, int nfill)
const int gridID = field1.grid;
const size_t nmiss1 = field1.nmiss;
const double missval = field1.missval;
double *array1 = field1.vec.data();
double *array2 = field2.vec.data();
double *array1 = field1.vec_d.data();
double *array2 = field2.vec_d.data();
const int nx = gridInqXsize(gridID);
const int ny = gridInqYsize(gridID);
......@@ -185,8 +185,8 @@ fillmiss_one_step(Field &field1, Field &field2, int maxfill)
gridID = field1.grid;
missval = field1.missval;
array1 = field1.vec.data();
array2 = field2.vec.data();
array1 = field1.vec_d.data();
array2 = field2.vec_d.data();