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

Timstat: added support for cell_methods.

parent 00794ecb
......@@ -3,6 +3,10 @@
* Using CDI library version 1.9.8
* Version 1.9.8 release
2019-10-14 Uwe Schulzweida
* Timstat: added support for cell_methods
2019-10-07 Uwe Schulzweida
* Expr: added function rand(x)
......
......@@ -73,6 +73,7 @@
#include <cdi.h>
#include "cdo_options.h"
#include "cdo_vlist.h"
#include "functs.h"
#include "process_int.h"
#include "datetime.h"
......@@ -212,6 +213,8 @@ Timstat(void *argument)
const auto vlistID1 = cdoStreamInqVlist(streamID1);
const auto vlistID2 = vlistDuplicate(vlistID1);
vlistDefineTimestepType(vlistID2, operfunc);
if (cmplen == 0) vlistDefNtsteps(vlistID2, 1);
const auto taxisID1 = vlistInqTaxis(vlistID1);
......
......@@ -68,6 +68,7 @@
#include <cdi.h>
#include "cdo_options.h"
#include "cdo_vlist.h"
#include "functs.h"
#include "process_int.h"
#include "cdo_task.h"
......@@ -259,6 +260,7 @@ XTimstat(void *process)
#endif
const auto vlistID2 = vlistDuplicate(vlistID1);
vlistDefineTimestepType(vlistID2, operfunc);
if (cmplen == 0) vlistDefNtsteps(vlistID2, 1);
......
......@@ -28,6 +28,27 @@
#include "array.h"
void
vlistDefineTimestepType(int vlistID, int operfunc)
{
int stepType = -1;
// clang-format off
if (operfunc==func_mean) stepType = TSTEP_AVG;
else if (operfunc==func_avg) stepType = TSTEP_AVG;
else if (operfunc==func_sum) stepType = TSTEP_SUM;
else if (operfunc==func_range) stepType = TSTEP_RANGE;
else if (operfunc==func_min) stepType = TSTEP_MIN;
else if (operfunc==func_max) stepType = TSTEP_MAX;
// clang-format on
if (stepType != -1)
{
auto nvars = vlistNvars(vlistID);
for (int varID = 0; varID < nvars; ++varID)
vlistDefVarTsteptype(vlistID, varID, stepType);
}
}
double
cdoZaxisInqLevel(int zaxisID, int levelID)
{
......
......@@ -20,6 +20,8 @@
#include <vector>
#include <map>
void vlistDefineTimestepType(int vlistID, int operfunc);
void vlistMap(int vlistID1, int vlistID2, int flag, int mapflag, std::map<int, int> &mapOfVarIDs);
void vlistCompare(int vlistID1, int vlistID2, int flag);
int vlistCompareX(int vlistID1, int vlistID2, int flag);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment