Commit 812c887b authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

Merge branch 'develop' of git.mpimet.mpg.de:cdo into develop

parents 76eb2cf2 14a5c10c
This diff is collapsed.
......@@ -25,6 +25,8 @@
#include "cdo_int.h"
#include "pstream_int.h"
#include "datetime.h"
void *
Deltat(void *process)
......@@ -34,27 +36,39 @@ Deltat(void *process)
cdoInitialize(process);
int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
// clang-format off
cdoOperatorAdd("deltat", 0, 0, nullptr);
cdoOperatorAdd("dTdivdt", 0, 1, nullptr);
// clang-format on
const int operatorID = cdoOperatorID();
const bool ldivdt = cdoOperatorF2(operatorID);
int vlistID1 = cdoStreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
const int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
const int calendar = taxisInqCalendar(taxisID1);
const int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
pstreamDefVlist(streamID2, vlistID2);
FieldVector2D vars;
fieldsFromVlist(vlistID1, vars, FIELD_PTR);
size_t gridsizemax = vlistGridsizeMax(vlistID1);
std::vector<double> array1(gridsizemax);
std::vector<double> array2(gridsizemax);
const size_t gridsizemax = vlistGridsizeMax(vlistID1);
std::vector<double> array1(gridsizemax), array2(gridsizemax);
int tsID = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID);
JulianDate juldate0 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; ++recID)
{
pstreamInqRecord(streamID1, &varID, &levelID);
......@@ -66,6 +80,10 @@ Deltat(void *process)
int tsID2 = 0;
while ((nrecs = cdoStreamInqTimestep(streamID1, tsID)))
{
const JulianDate juldate1 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
const double idt_in_sec = ldivdt ? 1./julianDateToSeconds(julianDateSub(juldate1, juldate0)) : 1;
juldate0 = juldate1;
taxisCopyTimestep(taxisID2, taxisID1);
pstreamDefTimestep(streamID2, tsID2);
......@@ -74,9 +92,9 @@ Deltat(void *process)
pstreamInqRecord(streamID1, &varID, &levelID);
pstreamReadRecord(streamID1, array1.data(), &nmiss);
double missval = vars[varID][levelID].missval;
const double missval = vars[varID][levelID].missval;
const size_t gridsize = vars[varID][levelID].size;
double *array0 = vars[varID][levelID].ptr;
size_t gridsize = vars[varID][levelID].size;
if (nmiss || vars[varID][levelID].nmiss)
{
for (size_t i = 0; i < gridsize; ++i)
......@@ -84,14 +102,14 @@ Deltat(void *process)
if (DBL_IS_EQUAL(array0[i], missval) || DBL_IS_EQUAL(array1[i], missval))
array2[i] = missval;
else
array2[i] = array1[i] - array0[i];
array2[i] = (array1[i] - array0[i]) * idt_in_sec;
}
nmiss = arrayNumMV(gridsize, array2.data(), missval);
}
else
{
for (size_t i = 0; i < gridsize; ++i) array2[i] = array1[i] - array0[i];
for (size_t i = 0; i < gridsize; ++i) array2[i] = (array1[i] - array0[i]) * idt_in_sec;
}
arrayCopy(gridsize, array1.data(), array0);
......
......@@ -461,7 +461,7 @@ EOFs(void *process)
int64_t vdate = 10101;
int vtime = 0;
juldate_t juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
double *out = in;
double *eig_val = nullptr;
......@@ -471,8 +471,8 @@ EOFs(void *process)
for (tsID = 0; tsID < nts_out; tsID++)
{
juldate = juldate_add_seconds(60, juldate);
juldate_decode(calendar, juldate, &vdate, &vtime);
juldate = julianDateAddSeconds(60, juldate);
julianDateDecode(calendar, juldate, &vdate, &vtime);
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
......
......@@ -431,11 +431,11 @@ EOF3d(void *process)
int64_t vdate = 10101;
int vtime = 0;
juldate_t juldate = juldate_encode(calendar, vdate, vtime);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
for (tsID = 0; tsID < n; tsID++)
{
juldate = juldate_add_seconds(60, juldate);
juldate_decode(calendar, juldate, &vdate, &vtime);
juldate = julianDateAddSeconds(60, juldate);
julianDateDecode(calendar, juldate, &vdate, &vtime);
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
......
......@@ -664,9 +664,9 @@ Expr(void *process)
if (tsID)
{
juldate_t juldate0 = juldate_encode(calendar, vdate0, vtime0);
juldate_t juldate = juldate_encode(calendar, vdate, vtime);
jdelta = juldate_to_seconds(juldate_sub(juldate, juldate0));
JulianDate juldate0 = julianDateEncode(calendar, vdate0, vtime0);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
}
vdate0 = vdate;
......
......@@ -214,9 +214,9 @@ Filter(void *process)
cdiDecodeDate(vdate0, &year0, &month0, &day0);
cdiDecodeDate(vdate, &year, &month, &day);
juldate_t juldate0 = juldate_encode(calendar, vdate0, vtime0);
juldate_t juldate = juldate_encode(calendar, vdate, vtime);
double jdelta = juldate_to_seconds(juldate_sub(juldate, juldate0));
JulianDate juldate0 = julianDateEncode(calendar, vdate0, vtime0);
JulianDate juldate = julianDateEncode(calendar, vdate, vtime);
double jdelta = julianDateToSeconds(julianDateSub(juldate, juldate0));
if (tsID == 1)
{
......
......@@ -37,7 +37,7 @@ input_iarray(size_t nval, int *array)
for (size_t i = 0; i < nval; i++)
{
size_t n = scanf("%d", &array[i]);
const size_t n = scanf("%d", &array[i]);
if (n != 1) break;
ival++;
......@@ -66,12 +66,12 @@ Input(void *process)
cdoInitialize(process);
// clang-format off
int INPUT = cdoOperatorAdd("input", 0, 0, nullptr);
int INPUTSRV = cdoOperatorAdd("inputsrv", 0, 0, nullptr);
int INPUTEXT = cdoOperatorAdd("inputext", 0, 0, nullptr);
const int INPUT = cdoOperatorAdd("input", 0, 0, nullptr);
const int INPUTSRV = cdoOperatorAdd("inputsrv", 0, 0, nullptr);
const int INPUTEXT = cdoOperatorAdd("inputext", 0, 0, nullptr);
// clang-format on
int operatorID = cdoOperatorID();
const int operatorID = cdoOperatorID();
int gridID = -1;
int zaxisID = -1;
......@@ -110,7 +110,7 @@ Input(void *process)
cdoPrint("Enter all %zu elements of timestep %d!", gridsize * nlevs, nrecs + 1);
size_t rval = input_darray(stdin, gridsize * nlevs, array.data());
const size_t rval = input_darray(stdin, gridsize * nlevs, array.data());
if (nrecs > 0 && rval == 0) break;
......@@ -224,8 +224,8 @@ Input(void *process)
for (int levelID = 0; levelID < nlevs; levelID++)
{
size_t offset = gridsize * levelID;
size_t nmiss = arrayNumMV(gridsize, &array[offset], missval);
const size_t offset = gridsize * levelID;
const size_t nmiss = arrayNumMV(gridsize, &array[offset], missval);
pstreamDefRecord(streamID, varID, levelID);
pstreamWriteRecord(streamID, &array[offset], nmiss);
}
......
......@@ -33,16 +33,16 @@
int
genThinoutGrid(int gridID1, size_t xinc, size_t yinc)
{
size_t nlon1 = gridInqXsize(gridID1);
size_t nlat1 = gridInqYsize(gridID1);
const size_t nlon1 = gridInqXsize(gridID1);
const size_t nlat1 = gridInqYsize(gridID1);
size_t nlon2 = nlon1 / xinc;
size_t nlat2 = nlat1 / yinc;
if (nlon1 % xinc) nlon2++;
if (nlat1 % yinc) nlat2++;
size_t gridsize2 = nlon2 * nlat2;
const size_t gridsize2 = nlon2 * nlat2;
int gridID2 = gridCreate(GRID_LONLAT, gridsize2);
const int gridID2 = gridCreate(GRID_LONLAT, gridsize2);
gridDefXsize(gridID2, nlon2);
gridDefYsize(gridID2, nlat2);
......@@ -78,20 +78,20 @@ genBoxavgGrid(int gridID1, size_t xinc, size_t yinc)
{
size_t i, j, i1;
size_t nlon1 = gridInqXsize(gridID1);
size_t nlat1 = gridInqYsize(gridID1);
const size_t nlon1 = gridInqXsize(gridID1);
const size_t nlat1 = gridInqYsize(gridID1);
size_t nlon2 = nlon1 / xinc;
size_t nlat2 = nlat1 / yinc;
if (nlon1 % xinc) nlon2++;
if (nlat1 % yinc) nlat2++;
size_t gridsize2 = nlon2 * nlat2;
const size_t gridsize2 = nlon2 * nlat2;
int gridID2 = gridCreate(GRID_LONLAT, gridsize2);
const int gridID2 = gridCreate(GRID_LONLAT, gridsize2);
gridDefXsize(gridID2, nlon2);
gridDefYsize(gridID2, nlat2);
int gridtype = gridInqType(gridID1);
const int gridtype = gridInqType(gridID1);
if (gridtype == GRID_GAUSSIAN || gridtype == GRID_LONLAT)
{
std::vector<double> xvals1(nlon1);
......@@ -161,17 +161,17 @@ genBoxavgGrid(int gridID1, size_t xinc, size_t yinc)
static void
boxavg(Field *field1, Field *field2, size_t xinc, size_t yinc)
{
int gridID1 = field1->grid;
int gridID2 = field2->grid;
const int gridID1 = field1->grid;
const int gridID2 = field2->grid;
double *array1 = field1->ptr;
double *array2 = field2->ptr;
double missval = field1->missval;
const double missval = field1->missval;
size_t nlon1 = gridInqXsize(gridID1);
size_t nlat1 = gridInqYsize(gridID1);
const size_t nlon1 = gridInqXsize(gridID1);
const size_t nlat1 = gridInqYsize(gridID1);
size_t nlon2 = gridInqXsize(gridID2);
size_t nlat2 = gridInqYsize(gridID2);
const size_t nlon2 = gridInqXsize(gridID2);
const size_t nlat2 = gridInqYsize(gridID2);
std::vector<double *> xfield1(nlat1);
for (size_t ilat = 0; ilat < nlat1; ilat++) xfield1[ilat] = array1 + ilat * nlon1;
......@@ -187,11 +187,11 @@ boxavg(Field *field1, Field *field2, size_t xinc, size_t yinc)
size_t in = 0;
for (size_t j = 0; j < yinc; ++j)
{
size_t jj = ilat * yinc + j;
const size_t jj = ilat * yinc + j;
if (jj >= nlat1) break;
for (size_t i = 0; i < xinc; ++i)
{
size_t ii = ilon * xinc + i;
const size_t ii = ilon * xinc + i;
if (ii >= nlon1) break;
in++;
xfield2[ilat][ilon] += xfield1[jj][ii];
......@@ -206,17 +206,17 @@ boxavg(Field *field1, Field *field2, size_t xinc, size_t yinc)
static void
thinout(Field *field1, Field *field2, int xinc, int yinc)
{
int gridID1 = field1->grid;
int gridID2 = field2->grid;
const int gridID1 = field1->grid;
const int gridID2 = field2->grid;
double *array1 = field1->ptr;
double *array2 = field2->ptr;
double missval = field1->missval;
const double missval = field1->missval;
size_t nlon1 = gridInqXsize(gridID1);
size_t nlat1 = gridInqYsize(gridID1);
const size_t nlon1 = gridInqXsize(gridID1);
const size_t nlat1 = gridInqYsize(gridID1);
size_t nlon2 = gridInqXsize(gridID2);
size_t nlat2 = gridInqYsize(gridID2);
const size_t nlon2 = gridInqXsize(gridID2);
const size_t nlat2 = gridInqYsize(gridID2);
std::vector<double *> xfield1(nlat1);
for (size_t ilat = 0; ilat < nlat1; ilat++) xfield1[ilat] = array1 + ilat * nlon1;
......@@ -252,15 +252,15 @@ Intgrid(void *process)
cdoInitialize(process);
// clang-format off
int INTGRIDBIL = cdoOperatorAdd("intgridbil", 0, 0, nullptr);
int INTGRIDDIS = cdoOperatorAdd("intgriddis", 0, 0, nullptr);
int INTGRIDNN = cdoOperatorAdd("intgridnn", 0, 0, nullptr);
int INTERPOLATE = cdoOperatorAdd("interpolate", 0, 0, nullptr);
int BOXAVG = cdoOperatorAdd("boxavg", 0, 0, nullptr);
int THINOUT = cdoOperatorAdd("thinout", 0, 0, nullptr);
const int INTGRIDBIL = cdoOperatorAdd("intgridbil", 0, 0, nullptr);
const int INTGRIDDIS = cdoOperatorAdd("intgriddis", 0, 0, nullptr);
const int INTGRIDNN = cdoOperatorAdd("intgridnn", 0, 0, nullptr);
const int INTERPOLATE = cdoOperatorAdd("interpolate", 0, 0, nullptr);
const int BOXAVG = cdoOperatorAdd("boxavg", 0, 0, nullptr);
const int THINOUT = cdoOperatorAdd("thinout", 0, 0, nullptr);
// clang-format on
int operatorID = cdoOperatorID();
const int operatorID = cdoOperatorID();
if (operatorID == INTGRIDBIL || operatorID == INTERPOLATE || operatorID == INTGRIDDIS || operatorID == INTGRIDNN)
{
......@@ -275,20 +275,20 @@ Intgrid(void *process)
yinc = parameter2int(operatorArgv()[1]);
}
int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
const int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
int vlistID1 = cdoStreamInqVlist(streamID1);
int vlistID2 = vlistDuplicate(vlistID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int ngrids = vlistNgrids(vlistID1);
const int ngrids = vlistNgrids(vlistID1);
for (int index = 0; index < ngrids; index++)
{
gridID1 = vlistGrid(vlistID1, index);
int gridtype = gridInqType(gridID1);
const int gridtype = gridInqType(gridID1);
if (operatorID == BOXAVG || operatorID == THINOUT)
{
......@@ -305,14 +305,14 @@ Intgrid(void *process)
}
else if (operatorID == INTGRIDBIL || operatorID == INTERPOLATE)
{
bool ldistgen = (grid_is_distance_generic(gridID1) && grid_is_distance_generic(gridID2));
const bool ldistgen = (grid_is_distance_generic(gridID1) && grid_is_distance_generic(gridID2));
if (!ldistgen && gridtype != GRID_LONLAT && gridtype != GRID_GAUSSIAN)
cdoAbort("Interpolation of %s data unsupported!", gridNamePtr(gridtype));
}
else if (operatorID == INTGRIDNN || operatorID == INTGRIDDIS)
{
int projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID1) : -1;
bool lproj4param = (gridtype == GRID_PROJECTION) && grid_has_proj4param(gridID1);
const int projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID1) : -1;
const bool lproj4param = (gridtype == GRID_PROJECTION) && grid_has_proj4param(gridID1);
if (gridtype != GRID_LONLAT && !lproj4param && projtype != CDI_PROJ_RLL && projtype != CDI_PROJ_LAEA
&& projtype != CDI_PROJ_SINU && projtype != CDI_PROJ_LCC && projtype != CDI_PROJ_STERE && gridtype != GRID_GAUSSIAN
&& gridtype != GRID_GME && gridtype != GRID_CURVILINEAR && gridtype != GRID_UNSTRUCTURED)
......@@ -322,7 +322,7 @@ Intgrid(void *process)
vlistChangeGridIndex(vlistID2, index, gridID2);
}
int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
const int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
pstreamDefVlist(streamID2, vlistID2);
size_t gridsize = vlistGridsizeMax(vlistID1);
......
......@@ -29,7 +29,7 @@
#include "printinfo.h"
static int
readnextpos(FILE *fp, int calendar, juldate_t *juldate, double *xpos, double *ypos)
readnextpos(FILE *fp, int calendar, JulianDate *juldate, double *xpos, double *ypos)
{
int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
......@@ -42,7 +42,7 @@ readnextpos(FILE *fp, int calendar, juldate_t *juldate, double *xpos, double *yp
{
int date = cdiEncodeDate(year, month, day);
int time = cdiEncodeTime(hour, minute, second);
*juldate = juldate_encode(calendar, date, time);
*juldate = julianDateEncode(calendar, date, time);
}
return stat;
......@@ -68,23 +68,23 @@ Intgridtraj(void *process)
FILE *fp = fopen(posfile, "r");
if (fp == nullptr) cdoAbort("Open failed on %s!", posfile);
juldate_t juldate;
JulianDate juldate;
readnextpos(fp, calendar, &juldate, &xpos, &ypos);
int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
const int streamID1 = cdoStreamOpenRead(cdoStreamName(0));
int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
Field field1, field2;
fieldInit(field1);
fieldInit(field2);
int nvars = vlistNvars(vlistID1);
const int nvars = vlistNvars(vlistID1);
int maxrecs = vlistNrecs(vlistID1);
const int maxrecs = vlistNrecs(vlistID1);
std::vector<RecordInfo> recinfo(maxrecs);
size_t gridsizemax = vlistGridsizeMax(vlistID1);
const size_t gridsizemax = vlistGridsizeMax(vlistID1);
std::vector<double> array(gridsizemax);
double **vardata1 = (double **) Malloc(nvars * sizeof(double *));
......@@ -92,24 +92,24 @@ Intgridtraj(void *process)
for (varID = 0; varID < nvars; varID++)
{
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
size_t nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
const size_t nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
vardata1[varID] = (double *) Malloc(gridsize * nlevel * sizeof(double));
vardata2[varID] = (double *) Malloc(gridsize * nlevel * sizeof(double));
}
int gridID2 = gridCreate(GRID_TRAJECTORY, 1);
const int gridID2 = gridCreate(GRID_TRAJECTORY, 1);
gridDefXsize(gridID2, 1);
gridDefYsize(gridID2, 1);
gridDefXvals(gridID2, &xpos);
gridDefYvals(gridID2, &ypos);
int vlistID2 = vlistDuplicate(vlistID1);
const int vlistID2 = vlistDuplicate(vlistID1);
int ngrids = vlistNgrids(vlistID1);
const int ngrids = vlistNgrids(vlistID1);
for (int index = 0; index < ngrids; index++)
{
int gridID1 = vlistGrid(vlistID1, index);
const int gridID1 = vlistGrid(vlistID1, index);
if (gridInqType(gridID1) != GRID_LONLAT && gridInqType(gridID1) != GRID_GAUSSIAN)
cdoAbort("Unsupported grid type: %s", gridNamePtr(gridInqType(gridID1)));
......@@ -117,31 +117,31 @@ Intgridtraj(void *process)
vlistChangeGridIndex(vlistID2, index, gridID2);
}
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = CDI_UNDEFID;
int tsID = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID++);
juldate_t juldate1 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate1 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; recID++)
{
pstreamInqRecord(streamID1, &varID, &levelID);
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
size_t offset = gridsize * levelID;
const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
const size_t offset = gridsize * levelID;
double *single1 = vardata1[varID] + offset;
pstreamReadRecord(streamID1, single1, &nmiss);
if (nmiss) cdoAbort("Missing values unsupported for this operator!");
}
int tsIDo = 0;
while (juldate_to_seconds(juldate1) <= juldate_to_seconds(juldate))
while (julianDateToSeconds(juldate1) <= julianDateToSeconds(juldate))
{
nrecs = cdoStreamInqTimestep(streamID1, tsID++);
if (nrecs == 0) break;
juldate_t juldate2 = juldate_encode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
JulianDate juldate2 = julianDateEncode(calendar, taxisInqVdate(taxisID1), taxisInqVtime(taxisID1));
for (int recID = 0; recID < nrecs; recID++)
{
......@@ -151,17 +151,17 @@ Intgridtraj(void *process)
recinfo[recID].levelID = levelID;
recinfo[recID].lconst = vlistInqVarTimetype(vlistID1, varID) == TIME_CONSTANT;
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
size_t offset = gridsize * levelID;
const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
const size_t offset = gridsize * levelID;
double *single2 = vardata2[varID] + offset;
pstreamReadRecord(streamID1, single2, &nmiss);
if (nmiss) cdoAbort("Missing values unsupported for this operator!");
}
while (juldate_to_seconds(juldate) < juldate_to_seconds(juldate2))
while (julianDateToSeconds(juldate) < julianDateToSeconds(juldate2))
{
if (juldate_to_seconds(juldate) >= juldate_to_seconds(juldate1)
&& juldate_to_seconds(juldate) < juldate_to_seconds(juldate2))
if (julianDateToSeconds(juldate) >= julianDateToSeconds(juldate1)
&& julianDateToSeconds(juldate) < julianDateToSeconds(juldate2))
{
if (streamID2 == CDI_UNDEFID)
{
......@@ -169,29 +169,29 @@ Intgridtraj(void *process)
pstreamDefVlist(streamID2, vlistID2);
}
juldate_decode(calendar, juldate, &vdate, &vtime);
julianDateDecode(calendar, juldate, &vdate, &vtime);
taxisDefVdate(taxisID2, vdate);
taxisDefVtime(taxisID2, vtime);
pstreamDefTimestep(streamID2, tsIDo++);
double fac1
= juldate_to_seconds(juldate_sub(juldate2, juldate)) / juldate_to_seconds(juldate_sub(juldate2, juldate1));
double fac2
= juldate_to_seconds(juldate_sub(juldate, juldate1)) / juldate_to_seconds(juldate_sub(juldate2, juldate1));
const double fac1
= julianDateToSeconds(julianDateSub(juldate2, juldate)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
const double fac2
= julianDateToSeconds(julianDateSub(juldate, juldate1)) / julianDateToSeconds(julianDateSub(juldate2, juldate1));
/*
printf(" %f %f %f %f %f\n", juldate_to_seconds(juldate),
juldate_to_seconds(juldate1),
juldate_to_seconds(juldate2),
printf(" %f %f %f %f %f\n", julianDateToSeconds(juldate),
julianDateToSeconds(juldate1),
julianDateToSeconds(juldate2),
fac1, fac2);
*/
for (int recID = 0; recID < nrecs; recID++)
{
varID = recinfo[recID].varID;
levelID = recinfo[recID].levelID;
double missval = vlistInqVarMissval(vlistID1, varID);
int gridID1 = vlistInqVarGrid(vlistID1, varID);
size_t gridsize = gridInqSize(gridID1);
size_t offset = gridsize * levelID;
const double missval = vlistInqVarMissval(vlistID1, varID);
const int gridID1 = vlistInqVarGrid(vlistID1, varID);
const size_t gridsize = gridInqSize(gridID1);
const size_t offset = gridsize * levelID;
double *single1 = vardata1[varID] + offset;
double *single2 = vardata2[varID] + offset;
......@@ -227,7 +227,7 @@ Intgridtraj(void *process)
if (tsIDo == 0)
{
juldate_decode(calendar, juldate, &vdate, &vtime);
julianDateDecode(calendar, juldate, &vdate, &vtime);
char vdatestr[32], vtimestr[32];
date2str(vdate, vdatestr, sizeof(vdatestr));
time2str(vtime, vtimestr, sizeof(vtimestr));
......
......@@ -88,32 +88,32 @@ Intlevel3d(void *process)
cdoInitialize(process);
// clang-format off
int INTLEVEL3D = cdoOperatorAdd("intlevel3d", 0, 0, nullptr);
int INTLEVELX3D = cdoOperatorAdd("intlevelx3d", 0, 0, nullptr);
const int INTLEVEL3D = cdoOperatorAdd("intlevel3d", 0, 0, nullptr);
const int INTLEVELX3D = cdoOperatorAdd("intlevelx3d", 0, 0, nullptr);
// clang-format on
UNUSED(INTLEVEL3D);
int operatorID = cdoOperatorID();
const int operatorID = cdoOperatorID();
bool expol = (operatorID == INTLEVELX3D);
const bool expol = (operatorID == INTLEVELX3D);