Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
276c2604
Commit
276c2604
authored
Sep 15, 2006
by
Uwe Schulzweida
Browse files
New operator: int and nint (Math)
parent
47cc9f6f
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
276c2604
...
...
@@ -4,6 +4,7 @@
* using CDI library version 1.0.2
* set alias gradsdes to gradsdes2
* rename gradsdes to gradsdes1
* New operator: int and nint (Math) [request: Joerg Wegner]
* add option -e exp to test DRMAA
* add option -z szip to compress GRIB records with SZIP
* use DBL_IS_EQUAL to compare floating point
...
...
doc/cdo_refcard.pdf
View file @
276c2604
No preview for this file type
doc/tex/mod/Gradsdes
View file @
276c2604
...
...
@@ -10,8 +10,9 @@
Creates a GrADS data descriptor file. Supported file formats are GRIB,
SERVICE, EXTRA and IEG. For GRIB files the GrADS map file is also
generated. For SERVICE and EXTRA files the grid must be specified with
the CDO option '-g <grid>'. This
operator
takes @file{ifile} in order to create
the CDO option '-g <grid>'. This
module
takes @file{ifile} in order to create
filenames for the descriptor (@file{ifile.ctl}) and the map (@file{ifile.gmp}) file.
"gradsdes" is an alias for @oper{gradsdes2}.
@EndDescription
@EndModule
...
...
doc/tex/mod/Math
View file @
276c2604
...
...
@@ -5,7 +5,7 @@
@Section = Arithmetic
@Class = Arithmetic
@Arguments = ifile ofile
@Operators = abs sqr sqrt exp ln log10 sin cos tan asin acos atan
@Operators = abs
int nint
sqr sqrt exp ln log10 sin cos tan asin acos atan
@BeginDescription
This module contains some standard mathematical functions.
...
...
@@ -31,6 +31,40 @@ o(t,x) = \mbox{abs}(i(t,x))
@EndOperator
@BeginOperator_int
@Title = Integer value
@BeginDescription
@IfMan
o(t,x) = int(i(t,x))
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \mbox{int}(i(t,x))
@EndMath
@EndifDoc
@C Convert to integer value of i(t,x).
@EndDescription
@EndOperator
@BeginOperator_nint
@Title = Nearest integer value
@BeginDescription
@IfMan
o(t,x) = nint(i(t,x))
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \mbox{nint}(i(t,x))
@EndMath
@EndifDoc
@C Evaluate the nearest integer value of i(t,x).
@EndDescription
@EndOperator
@BeginOperator_sqr
@Title = Square
...
...
src/Math.c
View file @
276c2604
...
...
@@ -42,7 +42,7 @@
void
*
Math
(
void
*
argument
)
{
static
char
func
[]
=
"Math"
;
enum
{
ABS
,
SQR
,
SQRT
,
EXP
,
LN
,
LOG10
,
SIN
,
COS
,
TAN
,
ASIN
,
ACOS
,
ATAN
};
enum
{
ABS
,
FINT
,
FNINT
,
SQR
,
SQRT
,
EXP
,
LN
,
LOG10
,
SIN
,
COS
,
TAN
,
ASIN
,
ACOS
,
ATAN
};
int
operatorID
;
int
operfunc
;
int
streamID1
,
streamID2
;
...
...
@@ -60,10 +60,12 @@ void *Math(void *argument)
cdoInitialize
(
argument
);
cdoOperatorAdd
(
"abs"
,
ABS
,
0
,
NULL
);
cdoOperatorAdd
(
"int"
,
FINT
,
0
,
NULL
);
cdoOperatorAdd
(
"nint"
,
FNINT
,
0
,
NULL
);
cdoOperatorAdd
(
"sqr"
,
SQR
,
0
,
NULL
);
cdoOperatorAdd
(
"sqrt"
,
SQRT
,
0
,
NULL
);
cdoOperatorAdd
(
"exp"
,
EXP
,
0
,
NULL
);
cdoOperatorAdd
(
"ln"
,
LN
,
0
,
NULL
);
cdoOperatorAdd
(
"ln"
,
LN
,
0
,
NULL
);
cdoOperatorAdd
(
"log10"
,
LOG10
,
0
,
NULL
);
cdoOperatorAdd
(
"sin"
,
SIN
,
0
,
NULL
);
cdoOperatorAdd
(
"cos"
,
COS
,
0
,
NULL
);
...
...
@@ -119,6 +121,14 @@ void *Math(void *argument)
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array2
[
i
]
=
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
?
missval1
:
fabs
(
array1
[
i
]);
break
;
case
FINT
:
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array2
[
i
]
=
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
?
missval1
:
(
int
)(
array1
[
i
]);
break
;
case
FNINT
:
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array2
[
i
]
=
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
?
missval1
:
NINT
(
array1
[
i
]);
break
;
case
SQR
:
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array2
[
i
]
=
DBL_IS_EQUAL
(
array1
[
i
],
missval1
)
?
missval1
:
MUL
(
array1
[
i
],
array1
[
i
]);
...
...
src/modules.c
View file @
276c2604
...
...
@@ -166,7 +166,7 @@ void *Zonstat(void *argument);
"invertlatdata", "invertlondata"}
#define MaskboxOperators {"masklonlatbox", "maskindexbox"}
#define MastrfuOperators {"mastrfu"}
#define MathOperators {"abs", "sqr", "sqrt", "exp", "ln", "log10", "sin", "cos", "tan", "asin", "acos", "atan"}
#define MathOperators {"abs",
"int", "nint",
"sqr", "sqrt", "exp", "ln", "log10", "sin", "cos", "tan", "asin", "acos", "atan"}
#define MergeOperators {"merge"}
#define MergegridOperators {"mergegrid"}
#define MergetimeOperators {"mergetime"}
...
...
src/operator_help.h
View file @
276c2604
...
...
@@ -685,11 +685,11 @@ static char *SettimeHelp[] = {
" day INTEGER Value of the new day"
,
" month INTEGER Value of the new month"
,
" year INTEGER Value of the new year"
,
" units STRING Base units of the time axis (minutes, hours, days, months, years)."
,
" date STRING Date (format YYYY-MM-DD)"
,
" time STRING Time (format HH:MM)"
,
" inc STRING Optional increment (e.g. 12hour) [default: 0hour]"
,
" calendar STRING Calendar (standard, 360days, 365days, 366days)"
,
" units STRING
Base units of the time axis (minutes, hours, days, months, years)."
,
" date STRING
Date (format YYYY-MM-DD)"
,
" time STRING
Time (format HH:MM)"
,
" inc STRING
Optional increment (e.g. 12hour) [default: 0hour]"
,
" calendar STRING
Calendar (standard, 360days, 365days, 366days)"
,
" sval STRING Shift value (e.g. -3hour)"
,
NULL
};
...
...
@@ -996,7 +996,7 @@ static char *ExprHelp[] = {
static
char
*
MathHelp
[]
=
{
"NAME"
,
" abs, sqr, sqrt, exp, ln, log10, sin, cos, tan, asin, acos, atan - "
,
" abs,
int, nint,
sqr, sqrt, exp, ln, log10, sin, cos, tan, asin, acos, atan - "
,
" Mathematical functions"
,
""
,
"SYNOPSIS"
,
...
...
@@ -1009,6 +1009,10 @@ static char *MathHelp[] = {
"OPERATORS"
,
" abs Absolute value"
,
" o(t,x) = abs(i(t,x))"
,
" int Integer value"
,
" o(t,x) = int(i(t,x))"
,
" nint Nearest integer value"
,
" o(t,x) = nint(i(t,x))"
,
" sqr Square"
,
" o(t,x) = i(t,x)**2"
,
" sqrt Square root"
,
...
...
@@ -2222,7 +2226,7 @@ static char *VardupHelp[] = {
static
char
*
GradsdesHelp
[]
=
{
"NAME"
,
" gradsdes, gradsdes2 - GrADS data descriptor file"
,
" gradsdes
1
, gradsdes2 - GrADS data descriptor file"
,
""
,
"SYNOPSIS"
,
" <operator> ifile"
,
...
...
@@ -2231,14 +2235,15 @@ static char *GradsdesHelp[] = {
" Creates a GrADS data descriptor file. Supported file formats are GRIB,"
,
" SERVICE, EXTRA and IEG. For GRIB files the GrADS map file is also "
,
" generated. For SERVICE and EXTRA files the grid must be specified with"
,
" the CDO option '-g <grid>'. This
operator
takes ifile in order to create "
,
" the CDO option '-g <grid>'. This
module
takes ifile in order to create "
,
" filenames for the descriptor (ifile.ctl) and the map (ifile.gmp) file."
,
"
\"
gradsdes
\"
is an alias for gradsdes2."
,
""
,
"OPERATORS"
,
" gradsdes
GrADS data descriptor file"
,
" gradsdes
1
GrADS data descriptor file
(version 1 GRIB map)
"
,
" Creates a GrADS data descriptor file. Generated a machine"
,
" specific version 1 GrADS map file for GRIB datasets."
,
" gradsdes2 GrADS data descriptor file (version 2 map)"
,
" gradsdes2 GrADS data descriptor file (version 2
GRIB
map)"
,
" Creates a GrADS data descriptor file. Generated a machine "
,
" independent version 2 GrADS map file for GRIB datasets."
,
" This map file can be used only with GrADS version 1.8 or newer. "
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment