Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
a9ba5fcd
Commit
a9ba5fcd
authored
Mar 23, 2016
by
Uwe Schulzweida
Browse files
smooth: added parameter list nsmooth, max_points, search_radius, weight0, weightInf
parent
f72ead7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Smooth.c
View file @
a9ba5fcd
...
...
@@ -27,6 +27,7 @@
#include "cdo_int.h"
#include "pstream.h"
#include "grid.h"
#include "pmlist.h"
#include "grid_search.h"
...
...
@@ -306,11 +307,9 @@ void *Smooth(void *argument)
int
varID
,
levelID
;
int
nmiss
;
int
gridtype
;
int
nsmooth
=
4
;
int
max_points
=
5
;
double
search_radius
=
120
,
weight0
=
0
.
25
,
weightInf
=
0
.
25
;
search_radius
*=
DEG2RAD
;
int
xnsmooth
=
1
;
int
xmax_points
=
5
;
double
xsearch_radius
=
90
,
xweight0
=
0
.
25
,
xweightInf
=
0
.
25
;
cdoInitialize
(
argument
);
...
...
@@ -318,7 +317,47 @@ void *Smooth(void *argument)
int
SMOOTH9
=
cdoOperatorAdd
(
"smooth9"
,
0
,
0
,
NULL
);
int
operatorID
=
cdoOperatorID
();
UNUSED
(
operatorID
);
if
(
operatorID
==
SMOOTH
)
{
int
pargc
=
operatorArgc
();
if
(
pargc
)
{
char
**
pargv
=
operatorArgv
();
pml_t
*
pml
=
pml_create
(
"SMOOTH"
);
PML_ADD_INT
(
pml
,
nsmooth
,
1
,
"Number of smooth iterations"
);
PML_ADD_INT
(
pml
,
max_points
,
1
,
"Maximum number of points"
);
PML_ADD_FLT
(
pml
,
search_radius
,
1
,
"Search radius"
);
PML_ADD_FLT
(
pml
,
weight0
,
1
,
"weight0"
);
PML_ADD_FLT
(
pml
,
weightInf
,
1
,
"weightInf"
);
pml_read
(
pml
,
pargc
,
pargv
);
if
(
cdoVerbose
)
pml_print
(
pml
);
if
(
PML_NOCC
(
pml
,
nsmooth
)
)
xnsmooth
=
par_nsmooth
[
0
];
if
(
PML_NOCC
(
pml
,
max_points
)
)
xmax_points
=
par_max_points
[
0
];
if
(
PML_NOCC
(
pml
,
search_radius
)
)
xsearch_radius
=
par_search_radius
[
0
];
if
(
PML_NOCC
(
pml
,
weight0
)
)
xweight0
=
par_weight0
[
0
];
if
(
PML_NOCC
(
pml
,
weightInf
)
)
xweightInf
=
par_weightInf
[
0
];
UNUSED
(
nsmooth
);
UNUSED
(
max_points
);
UNUSED
(
search_radius
);
UNUSED
(
weight0
);
UNUSED
(
weightInf
);
pml_destroy
(
pml
);
}
if
(
cdoVerbose
)
cdoPrint
(
"nsmooth = %d, max_points = %d, search_radius = %g, weight0 = %g, weightInf = %g"
,
xnsmooth
,
xmax_points
,
xsearch_radius
,
xweight0
,
xweightInf
);
}
xsearch_radius
*=
DEG2RAD
;
int
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
...
...
@@ -373,10 +412,10 @@ void *Smooth(void *argument)
double
missval
=
vlistInqVarMissval
(
vlistID1
,
varID
);
gridID
=
vlistInqVarGrid
(
vlistID1
,
varID
);
for
(
int
i
=
0
;
i
<
nsmooth
;
++
i
)
for
(
int
i
=
0
;
i
<
x
nsmooth
;
++
i
)
{
if
(
operatorID
==
SMOOTH
)
smooth
(
gridID
,
missval
,
array1
,
array2
,
&
nmiss
,
max_points
,
search_radius
,
weight0
,
weightInf
);
smooth
(
gridID
,
missval
,
array1
,
array2
,
&
nmiss
,
x
max_points
,
x
search_radius
,
x
weight0
,
x
weightInf
);
else
if
(
operatorID
==
SMOOTH9
)
smooth9
(
gridID
,
missval
,
array1
,
array2
,
&
nmiss
);
...
...
src/pmlist.c
View file @
a9ba5fcd
...
...
@@ -197,6 +197,8 @@ int pml_read(pml_t *pml, int argc, char **argv)
int
bufsize
=
0
;
int
status
=
0
;
if
(
argc
==
0
)
return
0
;
for
(
i
=
0
;
i
<
argc
;
++
i
)
{
len
=
strlen
(
argv
[
i
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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