Commit 939c2091 by Uwe Schulzweida

New operator not: logical NOT (1, if x equal 0; else 0).

parent 8b908e44
 2017-11-30 Uwe Schulzweida * New operator not: logical NOT (1, if x equal 0; else 0) 2017-11-23 Uwe Schulzweida * Fix read error on grid description file [Bug #8099] ... ...
 ... ... @@ -205,6 +205,7 @@ Operator catalog: Math acos Arc cosine Math atan Arc tangent Math reci Reciprocal value Math not Logical NOT Arithc addc Add a constant Arithc subc Subtract a constant Arithc mulc Multiply with a constant ... ...
 ... ... @@ -198,7 +198,7 @@ keepaspectratio]{cdo_libdep.pdf}}% \end{picture} \begin{flushright} \large \textbf{Climate Data Operators \\ Version 1.9.2 \\ November 2017} \large \textbf{Climate Data Operators \\ Version 1.9.3 \\ February 2018} \end{flushright} \vfill ... ...
 ... ... @@ -14,7 +14,7 @@ \put(0,0.0){\line(1,0){3.95}} \end{picture} \begin{flushright} {\small{Climate Data Operators \\ Version 1.9.2 \\ November 2017}} {\small{Climate Data Operators \\ Version 1.9.3 \\ February 2018}} \end{flushright} \vspace*{0mm} ... ...
 ... ... @@ -41,7 +41,7 @@ The following operators are supported: <=> & less equal greater & x <=> y & -1, if x less y; 1, if x greater y; else 0 \and & logical AND & x \and y & 1, if x and y not equal 0; else 0 \or & logical OR & x \or y & 1, if x or y not equal 0; else 0 ! & logical NOT & !x & 1, if x equal 0; else 1 ! & logical NOT & !x & 1, if x equal 0; else 0 ?: & ternary conditional & x ? y : z & y, if x not equal 0, else z @EndTable ... ...
 ... ... @@ -5,7 +5,7 @@ @Section = Arithmetic @Class = Arithmetic @Arguments = infile outfile @Operators = abs int nint pow sqr sqrt exp ln log10 sin cos tan asin acos atan reci @Operators = abs int nint pow sqr sqrt exp ln log10 sin cos tan asin acos atan reci not @BeginDescription This module contains some standard mathematical functions. ... ... @@ -286,6 +286,22 @@ o(t,x) = 1 / i(t,x) @EndOperator @BeginOperator_not @Title = Logical NOT @BeginDescription @IfMan o(t,x) = 1, if x equal 0; else 0 @EndifMan @IfDoc @BeginMath o(t,x) = 1, if x equal 0; else 0 @EndMath @EndifDoc @EndDescription @EndOperator @BeginExample To calculate the square root for all field elements use: @BeginVerbatim ... ...
 ... ... @@ -43,7 +43,7 @@ void *Math(void *argument) { enum {ABS, FINT, FNINT, SQR, SQRT, EXP, LN, LOG10, SIN, COS, TAN, ASIN, ACOS, ATAN, POW, RECI}; enum {ABS, FINT, FNINT, SQR, SQRT, EXP, LN, LOG10, SIN, COS, TAN, ASIN, ACOS, ATAN, POW, RECI, NOT}; int nrecs; int varID, levelID; size_t nmiss, nmiss2; ... ... @@ -68,6 +68,7 @@ void *Math(void *argument) cdoOperatorAdd("atan", ATAN, 0, NULL); cdoOperatorAdd("pow", POW, 0, NULL); cdoOperatorAdd("reci", RECI, 0, NULL); cdoOperatorAdd("not", NOT, 0, NULL); // clang-format on int operatorID = cdoOperatorID(); ... ... @@ -185,6 +186,10 @@ void *Math(void *argument) for ( i = 0; i < gridsize; i++ ) array2[i] = DBL_IS_EQUAL(array1[i], missval1) || DBL_IS_EQUAL(array1[i], 0.) ? missval1 : 1/array1[i]; break; case NOT: for ( i = 0; i < gridsize; i++ ) array2[i] = DBL_IS_EQUAL(array1[i], missval1) ? missval1 : IS_EQUAL(array1[i], 0); break; default: cdoAbort("operator not implemented!"); break; ... ...
 ... ... @@ -48,7 +48,7 @@ enum {FT_STD, FT_CONST, FT_FLD, FT_VERT, FT_COORD, FT_1C}; #define COMPLEG(x,y) ((x) < (y) ? -1. : ((x) > (y))) #define COMPAND(x,y) (IS_NOT_EQUAL(x,0) && IS_NOT_EQUAL(y,0)) #define COMPOR(x,y) (IS_NOT_EQUAL(x,0) || IS_NOT_EQUAL(y,0)) #define COMPNOT(x) (!IS_NOT_EQUAL(x,0)) #define COMPNOT(x) (IS_EQUAL(x,0)) #define MVCOMPLT(x,y) (DBL_IS_EQUAL((x),missval1) ? missval1 : COMPLT(x,y)) #define MVCOMPGT(x,y) (DBL_IS_EQUAL((x),missval1) ? missval1 : COMPGT(x,y)) #define MVCOMPLE(x,y) (DBL_IS_EQUAL((x),missval1) ? missval1 : COMPLE(x,y)) ... ...
 ... ... @@ -86,7 +86,7 @@ #define MaskregionOperators {"maskregion"} #define MastrfuOperators {"mastrfu"} #define MathOperators {"abs", "int", "nint", "sqr", "sqrt", "exp", "ln", "log10", "sin", \ "cos", "tan", "asin", "acos", "atan", "pow", "reci"} "cos", "tan", "asin", "acos", "atan", "pow", "reci", "not"} #define MergeOperators {"merge"} #define MergegridOperators {"mergegrid"} #define MergetimeOperators {"mergetime"} ... ...
 ... ... @@ -1493,7 +1493,7 @@ std::vector ExprHelp = { " <=> & less equal greater & x <=> y & -1, if x less y; 1, if x greater y; else 0 ", " && & logical AND & x && y & 1, if x and y not equal 0; else 0", " || & logical OR & x || y & 1, if x or y not equal 0; else 0", " ! & logical NOT & !x & 1, if x equal 0; else 1", " ! & logical NOT & !x & 1, if x equal 0; else 0", " ?: & ternary conditional & x ? y : z & y, if x not equal 0, else z ", " ", " The following functions are supported:", ... ... @@ -1571,7 +1571,7 @@ std::vector ExprHelp = { std::vector MathHelp = { "NAME", " abs, int, nint, pow, sqr, sqrt, exp, ln, log10, sin, cos, tan, asin, acos, ", " atan, reci - Mathematical functions", " atan, reci, not - Mathematical functions", "", "SYNOPSIS", " infile outfile", ... ... @@ -1613,6 +1613,8 @@ std::vector MathHelp = { " o(t,x) = atan(i(t,x))", " reci Reciprocal value", " o(t,x) = 1 / i(t,x)", " not Logical NOT", " o(t,x) = 1, if x equal 0; else 0", }; std::vector ArithcHelp = { ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!