Commit 3fb5393a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Set type of initialized variables to auto.

parent 84e8798d
......@@ -26,9 +26,8 @@
*/
#include <cdi.h>
#include "util_date.h"
#include "util_date.h"
#include "functs.h"
#include "process_int.h"
#include "cdo_vlist.h"
......@@ -37,6 +36,7 @@
#include "percentiles.h"
#include "datetime.h"
static void
timpctl(int operatorID)
{
......
......@@ -317,19 +317,19 @@ Vargen(void *process)
cdoInitialize(process);
// clang-format off
const auto RANDOM = cdoOperatorAdd("random", 0, 0, "grid description file or name, <seed>");
const auto SINCOS = cdoOperatorAdd("sincos", 0, 0, "grid description file or name");
const auto COSHILL = cdoOperatorAdd("coshill", 0, 0, "grid description file or name");
const auto RANDOM = cdoOperatorAdd("random", 0, 0, "grid description file or name, <seed>");
const auto SINCOS = cdoOperatorAdd("sincos", 0, 0, "grid description file or name");
const auto COSHILL = cdoOperatorAdd("coshill", 0, 0, "grid description file or name");
const auto TESTFIELD = cdoOperatorAdd("testfield", 0, 0, "grid description file or name");
const auto CONST = cdoOperatorAdd("const", 0, 0, "constant value, grid description file or name");
const auto SEQ = cdoOperatorAdd("seq", 0, 0, "start, end, <increment>");
const auto TOPO = cdoOperatorAdd("topo", 0, 0, nullptr);
const auto TEMP = cdoOperatorAdd("temp", 0, 0, nullptr);
const auto MASK = cdoOperatorAdd("mask", 0, 0, nullptr);
const auto STDATM = cdoOperatorAdd("stdatm", 0, 0, "height levels [m]");
const auto CONST = cdoOperatorAdd("const", 0, 0, "constant value, grid description file or name");
const auto SEQ = cdoOperatorAdd("seq", 0, 0, "start, end, <increment>");
const auto TOPO = cdoOperatorAdd("topo", 0, 0, nullptr);
const auto TEMP = cdoOperatorAdd("temp", 0, 0, nullptr);
const auto MASK = cdoOperatorAdd("mask", 0, 0, nullptr);
const auto STDATM = cdoOperatorAdd("stdatm", 0, 0, "height levels [m]");
// clang-format on
const int operatorID = cdoOperatorID();
const auto operatorID = cdoOperatorID();
if (operatorID == RANDOM)
{
......
......@@ -22,11 +22,11 @@
#include <cdi.h>
#include "process_int.h"
#include <mpim_grid.h>
#include "cdi_lockedIO.h"
static void
varrms(const Varray<double> w, const FieldVector &field1, const FieldVector &field2, Field &field3)
{
......
......@@ -17,16 +17,16 @@
#include <cdi.h>
#include "functs.h"
#include "process_int.h"
static void
checkUniqueZaxis(int vlistID)
{
const int nzaxis = vlistNzaxis(vlistID);
const int zaxisID = vlistZaxis(vlistID, 0);
const int nlevels = zaxisInqSize(zaxisID);
const auto nzaxis = vlistNzaxis(vlistID);
const auto zaxisID = vlistZaxis(vlistID, 0);
const auto nlevels = zaxisInqSize(zaxisID);
for (int index = 1; index < nzaxis; ++index)
{
if (nlevels != zaxisInqSize(vlistZaxis(vlistID, index))) cdoAbort("Number of level differ!");
......@@ -36,8 +36,8 @@ checkUniqueZaxis(int vlistID)
static void
checkUniqueGridsize(int vlistID)
{
const int ngrids = vlistNgrids(vlistID);
const int gridID = vlistGrid(vlistID, 0);
const auto ngrids = vlistNgrids(vlistID);
const auto gridID = vlistGrid(vlistID, 0);
const auto gridsize = gridInqSize(gridID);
for (int index = 0; index < ngrids; index++)
{
......@@ -52,7 +52,7 @@ setAttributes(int vlistID1, int vlistID2, int varID2, int operatorID)
char name[CDI_MAX_NAME], zname[CDI_MAX_NAME];
const int param = vlistInqVarParam(vlistID1, 0);
vlistInqVarName(vlistID1, 0, name);
int nvars = vlistNvars(vlistID1);
const auto nvars = vlistNvars(vlistID1);
for (int varID = 1; varID < nvars; ++varID)
{
const int zparam = vlistInqVarParam(vlistID1, varID);
......@@ -105,41 +105,39 @@ Varsstat(void *process)
addOperators();
// clang-format off
const int operatorID = cdoOperatorID();
const int operfunc = cdoOperatorF1(operatorID);
const auto operatorID = cdoOperatorID();
const auto operfunc= cdoOperatorF1(operatorID);
const bool lrange = operfunc == func_range;
const bool lmean = operfunc == func_mean || operfunc == func_avg;
const bool lstd = operfunc == func_std || operfunc == func_std1;
const bool lvarstd = operfunc == func_std || operfunc == func_var || operfunc == func_std1 || operfunc == func_var1;
const int divisor = operfunc == func_std1 || operfunc == func_var1;
// clang-format on
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
checkUniqueZaxis(vlistID1);
const int zaxisID = vlistZaxis(vlistID1, 0);
const int nlevels = zaxisInqSize(zaxisID);
const auto zaxisID = vlistZaxis(vlistID1, 0);
const auto nlevels = zaxisInqSize(zaxisID);
checkUniqueGridsize(vlistID1);
const int gridID = vlistGrid(vlistID1, 0);
const auto gridID = vlistGrid(vlistID1, 0);
const auto gridsize = gridInqSize(gridID);
const int timetype = vlistInqVarTimetype(vlistID1, 0);
const int nvars = vlistNvars(vlistID1);
const auto timetype = vlistInqVarTimetype(vlistID1, 0);
const auto nvars = vlistNvars(vlistID1);
for (varID = 1; varID < nvars; ++varID)
{
if (timetype != vlistInqVarTimetype(vlistID1, varID)) cdoAbort("Number of timesteps differ!");
}
const int vlistID2 = vlistCreate();
const int varID2 = vlistDefVar(vlistID2, gridID, zaxisID, timetype);
const auto vlistID2 = vlistCreate();
const auto varID2 = vlistDefVar(vlistID2, gridID, zaxisID, timetype);
setAttributes(vlistID1, vlistID2, varID2, operatorID);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const auto streamID2 = cdoOpenWrite(1);
......@@ -155,7 +153,7 @@ Varsstat(void *process)
for (levelID = 0; levelID < nlevels; levelID++)
{
const double missval = vlistInqVarMissval(vlistID1, 0);
const auto missval = vlistInqVarMissval(vlistID1, 0);
vars1[levelID].grid = gridID;
vars1[levelID].missval = missval;
......
......@@ -639,15 +639,15 @@ Verifygrid(void *argument)
cdoInitialize(argument);
int VERIFYGRID = cdoOperatorAdd("verifygrid", 0, 0, nullptr);
const auto VERIFYGRID = cdoOperatorAdd("verifygrid", 0, 0, nullptr);
int operatorID = cdoOperatorID();
const auto operatorID = cdoOperatorID();
const auto streamID = cdoOpenRead(0);
int vlistID = cdoStreamInqVlist(streamID);
const auto vlistID = cdoStreamInqVlist(streamID);
int ngrids = vlistNgrids(vlistID);
const auto ngrids = vlistNgrids(vlistID);
for (int gridno = 0; gridno < ngrids; ++gridno)
{
bool lgeo = true;
......
......@@ -80,13 +80,13 @@ Vertcum(void *process)
if (operatorID == VERTCUMHL)
{
double *vct = nullptr;
std::vector<double> vct;
bool lhybrid = false;
const int nzaxis = vlistNzaxis(vlistID1);
const auto nzaxis = vlistNzaxis(vlistID1);
for (int i = 0; i < nzaxis; ++i)
{
const int zaxisID = vlistZaxis(vlistID1, i);
const int nlevs = zaxisInqSize(zaxisID);
const auto zaxisID = vlistZaxis(vlistID1, i);
const auto nlevs = zaxisInqSize(zaxisID);
if (zaxisInqType(zaxisID) == ZAXIS_HYBRID && nlevs > 1)
{
......@@ -98,26 +98,24 @@ Vertcum(void *process)
lhybrid = true;
nlevshl = nlevs + 1;
double *vct = (double *) Malloc(nvct * sizeof(double));
zaxisInqVct(zaxisID, vct);
vct.resize(nvct);
zaxisInqVct(zaxisID, vct.data());
zaxisIDhl = zaxisCreate(ZAXIS_HYBRID_HALF, nlevshl);
double *levels = (double *) Malloc(nlevshl * sizeof(double));
std::vector<double> levels(nlevshl);
for (levelID = 0; levelID < nlevshl; ++levelID) levels[levelID] = levelID + 1;
zaxisDefLevels(zaxisIDhl, levels);
Free(levels);
zaxisDefVct(zaxisIDhl, nvct, vct);
zaxisDefLevels(zaxisIDhl, levels.data());
zaxisDefVct(zaxisIDhl, nvct, vct.data());
vlistChangeZaxisIndex(vlistID2, i, zaxisIDhl);
}
else if (vct)
else if (vct.size())
{
if (memcmp(vct, zaxisInqVctPtr(zaxisID), nvct * sizeof(double)) == 0)
if (memcmp(vct.data(), zaxisInqVctPtr(zaxisID), nvct * sizeof(double)) == 0)
vlistChangeZaxisIndex(vlistID2, i, zaxisIDhl);
}
}
}
}
if (vct) Free(vct);
}
VarList varList1, varList2;
......@@ -142,8 +140,8 @@ Vertcum(void *process)
for (levelID = 0; levelID < nlevs2; ++levelID) vardata2[varID][levelID].resize(gridsize);
}
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const auto streamID2 = cdoOpenWrite(1);
......@@ -206,7 +204,7 @@ Vertcum(void *process)
{
const auto missval = varList2[varID].missval;
const auto gridsize = varList2[varID].gridsize;
const int nlevs2 = varList2[varID].nlevels;
const auto nlevs2 = varList2[varID].nlevels;
for (levelID = 0; levelID < nlevs2; ++levelID)
{
auto &single = vardata2[varID][levelID];
......
......@@ -55,11 +55,11 @@ is_height_axis(int zaxisID, int nlevel)
static void
change_height_zaxis(int vlistID1, int vlistID2, int zaxisID2)
{
const int nzaxis = vlistNzaxis(vlistID1);
const auto nzaxis = vlistNzaxis(vlistID1);
for (int iz = 0; iz < nzaxis; ++iz)
{
const int zaxisID = vlistZaxis(vlistID1, iz);
const int nlevel = zaxisInqSize(zaxisID);
const auto zaxisID = vlistZaxis(vlistID1, iz);
const auto nlevel = zaxisInqSize(zaxisID);
if (is_height_axis(zaxisID, nlevel) && nlevel > 1)
{
......@@ -94,15 +94,15 @@ Vertintap(void *process)
cdoInitialize(process);
// clang-format off
const int AP2PL = cdoOperatorAdd("ap2pl", func_pl, type_lin, "pressure levels in pascal");
const int AP2PLX = cdoOperatorAdd("ap2plx", func_pl, type_lin, "pressure levels in pascal");
const int AP2HL = cdoOperatorAdd("ap2hl", func_hl, type_lin, "height levels in meter");
const int AP2HLX = cdoOperatorAdd("ap2hlx", func_hl, type_lin, "height levels in meter");
const int AP2PL_LP = cdoOperatorAdd("ap2pl_lp", func_pl, type_log, "pressure levels in pascal");
const int AP2PLX_LP = cdoOperatorAdd("ap2plx_lp", func_pl, type_log, "pressure levels in pascal");
const auto AP2PL = cdoOperatorAdd("ap2pl", func_pl, type_lin, "pressure levels in pascal");
const auto AP2PLX = cdoOperatorAdd("ap2plx", func_pl, type_lin, "pressure levels in pascal");
const auto AP2HL = cdoOperatorAdd("ap2hl", func_hl, type_lin, "height levels in meter");
const auto AP2HLX = cdoOperatorAdd("ap2hlx", func_hl, type_lin, "height levels in meter");
const auto AP2PL_LP = cdoOperatorAdd("ap2pl_lp", func_pl, type_log, "pressure levels in pascal");
const auto AP2PLX_LP = cdoOperatorAdd("ap2plx_lp", func_pl, type_log, "pressure levels in pascal");
// clang-format on
const int operatorID = cdoOperatorID();
const auto operatorID = cdoOperatorID();
const bool useHightLevel = cdoOperatorF1(operatorID) == func_hl;
const bool useLogType = cdoOperatorF2(operatorID) == type_log;
......@@ -152,23 +152,23 @@ Vertintap(void *process)
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const size_t gridsize = vlist_check_gridsize(vlistID1);
const auto gridsize = vlist_check_gridsize(vlistID1);
const int zaxistype = useHightLevel ? ZAXIS_HEIGHT : ZAXIS_PRESSURE;
const int zaxisIDp = zaxisCreate(zaxistype, nplev);
const auto zaxisIDp = zaxisCreate(zaxistype, nplev);
zaxisDefLevels(zaxisIDp, plev.data());
VarList varList1, varList2;
varListInit(varList1, vlistID1);
const int nvars = vlistNvars(vlistID1);
const auto nvars = vlistNvars(vlistID1);
for (varID = 0; varID < nvars; varID++)
{
......@@ -195,10 +195,10 @@ Vertintap(void *process)
if (apressID == -1) cdoAbort("%s not found!", var_stdname(air_pressure));
int zaxisIDh = -1;
const int nzaxis = vlistNzaxis(vlistID1);
const auto nzaxis = vlistNzaxis(vlistID1);
for (int i = 0; i < nzaxis; i++)
{
const int zaxisID = vlistZaxis(vlistID1, i);
const auto zaxisID = vlistZaxis(vlistID1, i);
if (zaxisID == varList1[apressID].zaxisID)
{
bool mono_level = true;
......@@ -288,9 +288,9 @@ Vertintap(void *process)
for (varID = 0; varID < nvars; varID++)
{
const int gridID = varList1[varID].gridID;
const int zaxisID = varList1[varID].zaxisID;
const int nlevel = varList1[varID].nlevels;
const auto gridID = varList1[varID].gridID;
const auto zaxisID = varList1[varID].zaxisID;
const auto nlevel = varList1[varID].nlevels;
if (gridInqType(gridID) == GRID_SPECTRAL) cdoAbort("Spectral data unsupported!");
......@@ -414,8 +414,8 @@ Vertintap(void *process)
{
if (vars[varID])
{
const int nlevel = varList1[varID].nlevels;
const double missval = varList1[varID].missval;
const auto nlevel = varList1[varID].nlevels;
const auto missval = varList1[varID].missval;
if (varinterp[varID])
{
double *hyb_press = (nlevel == nhlevf) ? &full_press[0] : (nlevel == nhlevh) ? &half_press[0] : nullptr;
......
......@@ -49,13 +49,13 @@ change_hybrid_zaxis(int vlistID1, int vlistID2, int nvct, double *vct, int zaxis
const int nzaxis = vlistNzaxis(vlistID1);
for (int iz = 0; iz < nzaxis; ++iz)
{
const int zaxisID = vlistZaxis(vlistID1, iz);
const int nlevel = zaxisInqSize(zaxisID);
const int zaxistype = zaxisInqType(zaxisID);
const auto zaxisID = vlistZaxis(vlistID1, iz);
const auto nlevel = zaxisInqSize(zaxisID);
const auto zaxistype = zaxisInqType(zaxisID);
if (zaxis_is_hybrid(zaxistype) && (nlevel == nhlevh || nlevel == nhlevf))
{
const int nvct2 = zaxisInqVctSize(zaxisID);
const auto nvct2 = zaxisInqVctSize(zaxisID);
if (nvct2 == nvct && memcmp(vct, zaxisInqVctPtr(zaxisID), nvct * sizeof(double)) == 0)
vlistChangeZaxisIndex(vlistID2, iz, zaxisID2);
}
......@@ -91,17 +91,17 @@ Vertintml(void *process)
cdoInitialize(process);
// clang-format off
const int ML2PL = cdoOperatorAdd("ml2pl", func_pl, type_lin, "pressure levels in pascal");
const int ML2PLX = cdoOperatorAdd("ml2plx", func_pl, type_lin, "pressure levels in pascal");
const int ML2HL = cdoOperatorAdd("ml2hl", func_hl, type_lin, "height levels in meter");
const int ML2HLX = cdoOperatorAdd("ml2hlx", func_hl, type_lin, "height levels in meter");
const int ML2PL_LP = cdoOperatorAdd("ml2pl_lp", func_pl, type_log, "pressure levels in pascal");
const int ML2PLX_LP = cdoOperatorAdd("ml2plx_lp", func_pl, type_log, "pressure levels in pascal");
const int ML2HL_LP = cdoOperatorAdd("ml2hl_lp", func_hl, type_log, "height levels in meter");
const int ML2HLX_LP = cdoOperatorAdd("ml2hlx_lp", func_hl, type_log, "height levels in meter");
const auto ML2PL = cdoOperatorAdd("ml2pl", func_pl, type_lin, "pressure levels in pascal");
const auto ML2PLX = cdoOperatorAdd("ml2plx", func_pl, type_lin, "pressure levels in pascal");
const auto ML2HL = cdoOperatorAdd("ml2hl", func_hl, type_lin, "height levels in meter");
const auto ML2HLX = cdoOperatorAdd("ml2hlx", func_hl, type_lin, "height levels in meter");
const auto ML2PL_LP = cdoOperatorAdd("ml2pl_lp", func_pl, type_log, "pressure levels in pascal");
const auto ML2PLX_LP = cdoOperatorAdd("ml2plx_lp", func_pl, type_log, "pressure levels in pascal");
const auto ML2HL_LP = cdoOperatorAdd("ml2hl_lp", func_hl, type_log, "height levels in meter");
const auto ML2HLX_LP = cdoOperatorAdd("ml2hlx_lp", func_hl, type_log, "height levels in meter");
// clang-format on
const int operatorID = cdoOperatorID();
const auto operatorID = cdoOperatorID();
const bool useHightLevel = cdoOperatorF1(operatorID) == func_hl;
const bool useLogType = cdoOperatorF2(operatorID) == type_log;
......@@ -144,17 +144,17 @@ Vertintml(void *process)
const auto streamID1 = cdoOpenRead(0);
const int vlistID1 = cdoStreamInqVlist(streamID1);
const int vlistID2 = vlistDuplicate(vlistID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
const int taxisID1 = vlistInqTaxis(vlistID1);
const int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const size_t gridsize = vlist_check_gridsize(vlistID1);
const auto gridsize = vlist_check_gridsize(vlistID1);
const int zaxistype = useHightLevel ? ZAXIS_HEIGHT : ZAXIS_PRESSURE;
const int zaxisIDp = zaxisCreate(zaxistype, nplev);
const auto zaxisIDp = zaxisCreate(zaxistype, nplev);
zaxisDefLevels(zaxisIDp, plev.data());
int nvct = 0;
......@@ -209,7 +209,7 @@ Vertintml(void *process)
// check levels
if (zaxisIDh != -1)
{
const int nlev = zaxisInqSize(zaxisIDh);
const auto nlev = zaxisInqSize(zaxisIDh);
if (nlev != nhlev) cdoAbort("Internal error, wrong number of hybrid level!");
Varray<double> levels(nlev);
cdoZaxisInqLevels(zaxisIDh, &levels[0]);
......@@ -265,17 +265,17 @@ Vertintml(void *process)
for (varID = 0; varID < nvars; varID++)
{
const int gridID = varList1[varID].gridID;
const int zaxisID = varList1[varID].zaxisID;
const int zaxistype = zaxisInqType(zaxisID);
const auto gridID = varList1[varID].gridID;
const auto zaxisID = varList1[varID].zaxisID;
const auto zaxistype = zaxisInqType(zaxisID);
// gridsize = gridInqSize(gridID);
const int nlevel = zaxisInqSize(zaxisID);
const int instNum = institutInqCenter(vlistInqVarInstitut(vlistID1, varID));
const int tableNum = tableInqNum(vlistInqVarTable(vlistID1, varID));
const auto nlevel = zaxisInqSize(zaxisID);
const auto instNum = institutInqCenter(vlistInqVarInstitut(vlistID1, varID));
const auto tableNum = tableInqNum(vlistInqVarTable(vlistID1, varID));
int code = vlistInqVarCode(vlistID1, varID);
auto code = vlistInqVarCode(vlistID1, varID);
const int param = vlistInqVarParam(vlistID1, varID);
const auto param = vlistInqVarParam(vlistID1, varID);
cdiParamToString(param, paramstr, sizeof(paramstr));
int pnum, pcat, pdis;
cdiDecodeParam(param, &pnum, &pcat, &pdis);
......@@ -468,8 +468,8 @@ Vertintml(void *process)
{
cdoInqRecord(streamID1, &varID, &levelID);
// gridsize = varList1[varID].gridsize;
const int zaxisID = varList1[varID].zaxisID;
const int nlevel = varList1[varID].nlevels;
const auto zaxisID = varList1[varID].zaxisID;
const auto nlevel = varList1[varID].nlevels;
/*
if ( sortlevels && zaxisIDh != -1 && zaxisID == zaxisIDh && nlevel == nhlev )
{
......@@ -534,8 +534,8 @@ Vertintml(void *process)
{
if (vars[varID])
{
const int nlevel = varList1[varID].nlevels;
const double missval = varList1[varID].missval;
const auto nlevel = varList1[varID].nlevels;
const auto missval = varList1[varID].missval;
if (varinterp[varID])
{
/*
......@@ -595,8 +595,8 @@ Vertintml(void *process)
{
if (vars[varID])
{
const size_t gridsize = varList2[varID].gridsize;
const int nlevel = varList2[varID].nlevels;
const auto gridsize = varList2[varID].gridsize;
const auto nlevel = varList2[varID].nlevels;
for (levelID = 0; levelID < nlevel; levelID++)
{
const size_t offset = gridsize * levelID;
......
......@@ -33,7 +33,6 @@
#include <cdi.h>
#include "cdo_options.h"
#include "functs.h"
#include "process_int.h"
......@@ -205,8 +204,8 @@ Vertstat(void *process)
cdoOperatorAdd("vertstd", func_std, 1, nullptr);
cdoOperatorAdd("vertstd1", func_std1, 1, nullptr);
const auto operatorID = cdoOperatorID();
const auto operfunc = cdoOperatorF1(operatorID);
const auto operatorID = cdoOperatorID();
const auto operfunc = cdoOperatorF1(operatorID);
const bool needWeights = cdoOperatorF2(operatorID);
const bool lrange = operfunc == func_range;
......
......@@ -23,11 +23,9 @@
#include <cdi.h>
#include "process_int.h"
#include "cdo_vlist.h"
#include "cdi_lockedIO.h"
#include "after_vertint.h"
#include "util_string.h"
#include "cdo_zaxis.h"
......@@ -51,7 +49,7 @@ Vertwind(void *process)
const auto streamID1 = cdoOpenRead(0);
int vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID1 = cdoStreamInqVlist(streamID1);
vlist_check_gridsize(vlistID1);
......@@ -95,18 +93,18 @@ Vertwind(void *process)
}
/* Get missing values */
double missval_t = vlistInqVarMissval(vlistID1, tempID);
double missval_sq = vlistInqVarMissval(vlistID1, sqID);
double missval_wap = vlistInqVarMissval(vlistID1, omegaID);
double missval_out = missval_wap;
const auto missval_t = vlistInqVarMissval(vlistID1, tempID);
const auto missval_sq = vlistInqVarMissval(vlistID1, sqID);
const auto missval_wap = vlistInqVarMissval(vlistID1, omegaID);
const auto missval_out = missval_wap;
int gridID = vlistInqVarGrid(vlistID1, omegaID);
int zaxisID = vlistInqVarZaxis(vlistID1, omegaID);
const auto gridID = vlistInqVarGrid(vlistID1, omegaID);
const auto zaxisID = vlistInqVarZaxis(vlistID1, omegaID);
if (psID == -1 && zaxisInqType(zaxisID) == ZAXIS_HYBRID) cdoAbort("Surface pressure (code 134) not found!");
auto gridsize = gridInqSize(gridID);
int nlevel = zaxisInqSize(zaxisID);
const auto gridsize = gridInqSize(gridID);
const auto nlevel = zaxisInqSize(zaxisID);
Varray<double> level(nlevel);
cdoZaxisInqLevels(zaxisID, level.data());
......@@ -144,7 +142,7 @@ Vertwind(void *process)
vlistClearFlag(vlistID1);
for (levelID = 0; levelID < nlevel; ++levelID) vlistDefFlag(vlistID1, omegaID, levelID, true);
int vlistID2 = vlistCreate();
const auto vlistID2 = vlistCreate();
cdoVlistCopyFlag(vlistID2, vlistID1);
vlistDefVarCode(vlistID2, 0, 40);
vlistDefVarName(vlistID2, 0, "W");
......@@ -152,8 +150,8 @@ Vertwind(void *process)
vlistDefVarUnits(vlistID2, 0, "m/s");
vlistDefVarMissval(vlistID2, 0, missval_out);
int taxisID1 = vlistInqTaxis(vlistID1);
int taxisID2 = taxisDuplicate(taxisID1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
const auto taxisID2 = taxisDuplicate(taxisID1);
vlistDefTaxis(vlistID2, taxisID2);
const auto streamID2 = cdoOpenWrite(1);
......@@ -198,10 +196,10 @@ Vertwind(void *process)
else
{
// Virtuelle Temperatur bringt die Feuchteabhaengigkeit hinein
double tv = temp[offset + i] * (1. + 0.608 * sq[offset + i]);
const auto tv = temp[offset + i] * (1. + 0.608 * sq[offset + i]);
// Die Dichte erhaelt man nun mit der Gasgleichung rho=p/(R*tv) Level in Pa!
double rho = fpress[offset + i] / (R * tv);
const auto rho = fpress[offset + i] / (R * tv);
/*
Nun daraus die Vertikalgeschwindigkeit im m/s, indem man die Vertikalgeschwindigkeit