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

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

parents 3293d919 6238b20c
This diff is collapsed.
......@@ -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);
......
......@@ -71,20 +71,20 @@ Intgridtraj(void *process)
juldate_t 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,8 +117,8 @@ 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;
......@@ -129,8 +129,8 @@ Intgridtraj(void *process)
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!");
......@@ -151,8 +151,8 @@ 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!");
......@@ -174,9 +174,9 @@ Intgridtraj(void *process)
taxisDefVtime(taxisID2, vtime);
pstreamDefTimestep(streamID2, tsIDo++);
double fac1
const double fac1
= juldate_to_seconds(juldate_sub(juldate2, juldate)) / juldate_to_seconds(juldate_sub(juldate2, juldate1));
double fac2
const double fac2
= juldate_to_seconds(juldate_sub(juldate, juldate1)) / juldate_to_seconds(juldate_sub(juldate2, juldate1));
/*
printf(" %f %f %f %f %f\n", juldate_to_seconds(juldate),
......@@ -188,10 +188,10 @@ Intgridtraj(void *process)
{
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;
......
......@@ -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);
operatorInputArg("icoordinate");
int streamID1 = cdoStreamOpenRead(cdoStreamName(0)); /* input data */
int streamID2 = cdoStreamOpenRead(cdoStreamName(1)); /* 3d target vertical coordinate */
int streamID3 = cdoStreamOpenWrite(cdoStreamName(2)); /* output stream */
const int streamID1 = cdoStreamOpenRead(cdoStreamName(0)); /* input data */
const int streamID2 = cdoStreamOpenRead(cdoStreamName(1)); /* 3d target vertical coordinate */
const int streamID3 = cdoStreamOpenWrite(cdoStreamName(2)); /* output stream */
/* Read filename from Parameter */
operatorInputArg("filename for vertical source coordinates variable");
operatorCheckArgc(1);
int vlistID1 = cdoStreamInqVlist(streamID1);
int taxisID1 = vlistInqTaxis(vlistID1);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
int vlistID2 = cdoStreamInqVlist(streamID2);
int vlistID3 = vlistDuplicate(vlistID1);
int taxisID3 = taxisDuplicate(taxisID1);
const int vlistID2 = cdoStreamInqVlist(streamID2);
const int vlistID3 = vlistDuplicate(vlistID1);
const int taxisID3 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID3, taxisID1);
/*
......@@ -127,14 +127,14 @@ Intlevel3d(void *process)
size_t zlevels_in_miss = 0;
{
int streamID0 = streamOpenReadLocked(operatorArgv()[0]); /* 3d vertical input coordinate */
int vlistID0 = streamInqVlist(streamID0);
const int streamID0 = streamOpenReadLocked(operatorArgv()[0]); /* 3d vertical input coordinate */
const int vlistID0 = streamInqVlist(streamID0);
int nvars = vlistNvars(vlistID0);
const int nvars = vlistNvars(vlistID0);
if (nvars != 1) cdoAbort("Only one single variable is allowed!");
int gridID = vlistInqVarGrid(vlistID0, 0);
int zaxisID = vlistInqVarZaxis(vlistID0, 0);
const int gridID = vlistInqVarGrid(vlistID0, 0);
const int zaxisID = vlistInqVarZaxis(vlistID0, 0);
gridsizei = gridInqSize(gridID); // horizontal gridsize of input z coordinate
nlevi = zaxisInqSize(zaxisID); // number of input levels for later use
......@@ -144,7 +144,7 @@ Intlevel3d(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
size_t offset = gridsizei + gridsizei * levelID;
const size_t offset = gridsizei + gridsizei * levelID;
double *single1 = zlevels_in + offset;
streamInqRecord(streamID0, &varID, &levelID);
streamReadRecord(streamID0, single1, &zlevels_in_miss);
......@@ -157,14 +157,14 @@ Intlevel3d(void *process)
* Read 3d output coordinate (streamID2)
*/
{
int nvars = vlistNvars(vlistID2);
const int nvars = vlistNvars(vlistID2);
if (nvars != 1) cdoAbort("Only one single variable is allowed!");
int gridID = vlistInqVarGrid(vlistID2, varID);
const int gridID = vlistInqVarGrid(vlistID2, varID);
gridID3 = gridID;
int zaxisID = vlistInqVarZaxis(vlistID2, varID);
size_t gridsize = gridInqSize(gridID);
int nlevel = zaxisInqSize(zaxisID);
const int zaxisID = vlistInqVarZaxis(vlistID2, varID);
const size_t gridsize = gridInqSize(gridID);
const int nlevel = zaxisInqSize(zaxisID);
zlevels_out = (double *) Malloc(gridsize * nlevel * sizeof(double));
nlevo = nlevel; /* number of output levels for later use */
......@@ -175,7 +175,7 @@ Intlevel3d(void *process)
for (int recID = 0; recID < nrecs; recID++)
{
pstreamInqRecord(streamID2, &varID, &levelID);
size_t offset = gridsize * levelID;
const size_t offset = gridsize * levelID;
double *single1 = zlevels_out + offset;
pstreamReadRecord(streamID2, single1, &zlevels_out_miss);
}
......@@ -214,11 +214,11 @@ Intlevel3d(void *process)
* (streamID0). Variables with a different z-axis should be copied into
* output.
*/
int nzaxis = vlistNzaxis(vlistID1);
const int nzaxis = vlistNzaxis(vlistID1);
for (i = 0; i < nzaxis; ++i)
{
int zaxisID = vlistZaxis(vlistID1, i);
int nlevel = zaxisInqSize(zaxisID);
const int zaxisID = vlistZaxis(vlistID1, i);
const int nlevel = zaxisInqSize(zaxisID);
if (nlevel == nlevi)
{
zaxisID1 = zaxisID;
......@@ -227,10 +227,10 @@ Intlevel3d(void *process)
}
if (i == nzaxis) cdoAbort("No processable variable found (vertical coordinate differ)!");
int ngrids = vlistNgrids(vlistID1);
const int ngrids = vlistNgrids(vlistID1);
for (i = 0; i < ngrids; ++i)
{
size_t gridsize = gridInqSize(vlistGrid(vlistID1, i));
const size_t gridsize = gridInqSize(vlistGrid(vlistID1, i));
if (gridsize == gridSize) break;
}
if (i == nzaxis) cdoAbort("No processable variable found (grid coordinate differ)!");
......@@ -293,10 +293,10 @@ Intlevel3d(void *process)
for (varID = 0; varID < nvars; varID++)
{
int gridID = vlistInqVarGrid(vlistID1, varID);
int zaxisID = vlistInqVarZaxis(vlistID1, varID);
size_t gridsize = gridInqSize(gridID);
int nlevel = zaxisInqSize(zaxisID);
const int gridID = vlistInqVarGrid(vlistID1, varID);
const int zaxisID = vlistInqVarZaxis(vlistID1, varID);
const size_t gridsize = gridInqSize(gridID);
const int nlevel = zaxisInqSize(zaxisID);
vlistInqVarName(vlistID1, varID, varname);
......@@ -354,8 +354,8 @@ Intlevel3d(void *process)
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, &varnmiss[varID][levelID]);
vars[varID] = true;
......@@ -366,15 +366,15 @@ Intlevel3d(void *process)
{
if (vars[varID] && varinterp[varID])
{
int gridID = vlistInqVarGrid(vlistID1, varID);
size_t gridsize = gridInqSize(gridID);
double missval = vlistInqVarMissval(vlistID1, varID);
const int gridID = vlistInqVarGrid(vlistID1, varID);
const size_t gridsize = gridInqSize(gridID);
const double missval = vlistInqVarMissval(vlistID1, varID);
vert_interp_lev3d(gridsize, missval, vardata1[varID], vardata2[varID], nlevo, lev_idx1, lev_idx2, lev_wgt1, lev_wgt2);
for (levelID = 0; levelID < nlevo; levelID++)
{
size_t offset = gridsize * levelID;
const size_t offset = gridsize * levelID;
double *single2 = vardata2[varID] + offset;
varnmiss[varID][levelID] = arrayNumMV(gridsize, single2, missval);
}
......@@ -391,8 +391,8 @@ Intlevel3d(void *process)
{
if (vars[varID])
{
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID3, varID));
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID3, varID));
const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID3, varID));
const int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID3, varID));
for (levelID = 0; levelID < nlevel; levelID++)
{
size_t offset = gridsize * levelID;
......@@ -404,11 +404,11 @@ Intlevel3d(void *process)
}
/* copy output z coordinate to output stream */
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID3, oz3dvarID));
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID3, oz3dvarID));
const size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID3, oz3dvarID));
const int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID3, oz3dvarID));
for (levelID = 0; levelID < nlevel; levelID++)
{
size_t offset = gridsize * levelID;
const size_t offset = gridsize * levelID;
double *single2 = zlevels_out + offset;
pstreamDefRecord(streamID3, oz3dvarID, levelID);
pstreamWriteRecord(streamID3, single2, 0);
......
......@@ -46,20 +46,20 @@ Intntime(void *process)
operatorInputArg("number of timesteps between 2 timesteps");
if (operatorArgc() < 1) cdoAbort("Too few arguments!");
int numts = parameter2int(operatorArgv()[0]);
const int numts = parameter2int(operatorArgv()[0]);
if (numts < 2) cdoAbort("parameter must be greater than 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 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);
std::vector<std::vector<size_t>> nmiss1(nvars);
......@@ -77,12 +77,12 @@ Intntime(void *process)
vardata2[varID] = (double *) Malloc(gridsize * nlevel * sizeof(double));
}
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
if (taxisHasBounds(taxisID2)) taxisDeleteBounds(taxisID2);
vlistDefTaxis(vlistID2, taxisID2);
int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
const int streamID2 = cdoStreamOpenWrite(cdoStreamName(1));
pstreamDefVlist(streamID2, vlistID2);
......@@ -91,8 +91,8 @@ Intntime(void *process)
int tsID = 0;
int tsIDo = 0;
int nrecs = cdoStreamInqTimestep(streamID1, tsID++);
int64_t vdate1 = taxisInqVdate(taxisID1);
int vtime1 = taxisInqVtime(taxisID1);
const int64_t vdate1 = taxisInqVdate(taxisID1);
const int vtime1 = taxisInqVtime(taxisID1);
juldate_t juldate1 = juldate_encode(calendar, vdate1, vtime1);
taxisCopyTimestep(taxisID2, taxisID1);
......@@ -130,7 +130,7 @@ Intntime(void *process)
for (int it = 1; it < numts; it++)
{