Commit 52616b38 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added module temp and mask

parent 2ed7e07a
......@@ -181,6 +181,8 @@ cdo_SOURCES += Arith.c \
ecautil.h \
error.h \
etopo.h \
temp.h \
mask.h \
exception.c \
expr.c \
expr.h \
......
......@@ -479,15 +479,15 @@ cdo_SOURCES = cdo.c Arith.c Arithc.c Arithdays.c Arithlat.c CDItest.c \
Ymonstat.c Yseaspctl.c Yseasstat.c Zonstat.c cdo.h cdo_int.h \
cdo_pthread.c cdo_vlist.c color.c color.h commandline.c \
counter.h dmemory.h dtypes.h ecacore.c ecacore.h ecautil.c \
ecautil.h error.h etopo.h exception.c expr.c expr.h expr_lex.c \
expr_yacc.c expr_yacc.h field.c field.h field2.c fieldc.c \
fieldmem.c fieldmer.c fieldzon.c fouriertrans.c functs.h \
gradsdeslib.c gradsdeslib.h grid.c grid.h grid_gme.c \
grid_lcc.c grid_rot.c griddes.c griddes.h griddes_h5.c \
griddes_nc.c hetaeta.c hetaeta.h history.c institution.c \
interpol.c interpol.h job.c juldate.c legendre.c list.c list.h \
merge_sort2.c merge_sort2.h modules.c modules.h namelist.c \
namelist.h normal.c nth_element.c nth_element.h \
ecautil.h error.h etopo.h temp.h mask.h exception.c expr.c \
expr.h expr_lex.c expr_yacc.c expr_yacc.h field.c field.h \
field2.c fieldc.c fieldmem.c fieldmer.c fieldzon.c \
fouriertrans.c functs.h gradsdeslib.c gradsdeslib.h grid.c \
grid.h grid_gme.c grid_lcc.c grid_rot.c griddes.c griddes.h \
griddes_h5.c griddes_nc.c hetaeta.c hetaeta.h history.c \
institution.c interpol.c interpol.h job.c juldate.c legendre.c \
list.c list.h merge_sort2.c merge_sort2.h modules.c modules.h \
namelist.c namelist.h normal.c nth_element.c nth_element.h \
operator_help.h par_io.c par_io.h percentiles.c percentiles.h \
pipe.c pipe.h printinfo.h process.c process.h pstream.c \
pstream.h pstream_int.h pthread_debug.c pthread_debug.h \
......
......@@ -41,6 +41,18 @@
static const unsigned short etopo[] = {
#include "etopo.h"
};
static double temp_scale = 500;
static double temp_offset = -220;
static const unsigned short temp[] = {
#include "temp.h"
};
static double mask_scale = 1;
static double mask_offset = 0;
static const unsigned short mask[] = {
#include "mask.h"
};
#endif
......@@ -65,8 +77,10 @@ void *Vargen(void *argument)
RANDOM = cdoOperatorAdd("random", 0, 0, "grid description file or name, <seed>");
CONST = cdoOperatorAdd("const", 0, 0, "constant value, grid description file or name");
TOPO = cdoOperatorAdd("topo", 0, 0, "");
FOR = cdoOperatorAdd("for", 0, 0, "start, end, <increment>");
TOPO = cdoOperatorAdd("topo", 0, 0, NULL);
TEMP = cdoOperatorAdd("temp", 0, 0, NULL);
MASK = cdoOperatorAdd("mask", 0, 0, NULL);
operatorID = cdoOperatorID();
......@@ -95,7 +109,7 @@ void *Vargen(void *argument)
gridfile = operatorArgv()[1];
gridID = cdoDefineGrid(gridfile);
}
else if ( operatorID == TOPO )
else if ( operatorID == TOPO || operatorID == TEMP || operatorID == MASK )
{
int nlon, nlat, i;
double lon[720], lat[360];
......@@ -144,10 +158,12 @@ void *Vargen(void *argument)
else
varID = vlistDefVar(vlistID, gridID, zaxisID, TIME_CONSTANT);
vlistDefVarName(vlistID, varID, cdoOperatorName(operatorID));
taxisID = taxisCreate(TAXIS_RELATIVE);
vlistDefTaxis(vlistID, taxisID);
if ( operatorID == RANDOM || operatorID == CONST || operatorID == TOPO )
if ( operatorID == RANDOM || operatorID == CONST || operatorID == TOPO || operatorID == TEMP || operatorID == MASK )
vlistDefNtsteps(vlistID, 1);
streamID = streamOpenWrite(cdoStreamName(0), cdoFiletype());
......@@ -194,7 +210,25 @@ void *Vargen(void *argument)
{
#if defined(WITH_DATA)
for ( i = 0; i < gridsize; i++ )
array[i] = (double)etopo[i]/etopo_scale - etopo_offset;
array[i] = etopo[i]/etopo_scale - etopo_offset;
#else
cdoAbort("Operator support disabled!");
#endif
}
else if ( operatorID == TEMP )
{
#if defined(WITH_DATA)
for ( i = 0; i < gridsize; i++ )
array[i] = temp[i]/temp_scale - temp_offset;
#else
cdoAbort("Operator support disabled!");
#endif
}
else if ( operatorID == MASK )
{
#if defined(WITH_DATA)
for ( i = 0; i < gridsize; i++ )
array[i] = mask[i]/mask_scale - mask_offset;
#else
cdoAbort("Operator support disabled!");
#endif
......
......@@ -410,7 +410,7 @@ void *Wct(void *argument);
#define TrmsOperators {"trms"}
#define TstepcountOperators {"tstepcount"}
#define VardupOperators {"pardup", "parmul"}
#define VargenOperators {"random", "const", "topo", "for"}
#define VargenOperators {"random", "const", "for", "topo", "temp", "mask"}
#define VarrmsOperators {"varrms"}
#define VertintOperators {"ml2pl", "ml2hl", "ml2plx", "ml2hlx", \
"ml2pl_lp", "ml2hl_lp", "ml2plx_lp", "ml2hlx_lp"}
......
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