Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
47e1cd97
Commit
47e1cd97
authored
5 months ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
remap_distwgt_weights(): replaced knnWgt.m_mask[i] by numWeights
parent
1be1dc51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!281
M214003/develop
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/knn_weights.h
+4
-4
4 additions, 4 deletions
src/knn_weights.h
src/remap_distwgt.cc
+1
-2
1 addition, 2 deletions
src/remap_distwgt.cc
with
5 additions
and
6 deletions
src/knn_weights.h
+
4
−
4
View file @
47e1cd97
...
...
@@ -24,10 +24,10 @@ class knnWeightsType
private:
size_t
m_maxNeighbors
=
0
;
KnnMethod
m_method
{
KnnMethod
::
distanceWeighted
};
std
::
vector
<
int8_t
>
m_mask
;
// mask at nearest neighbors
public
:
size_t
m_numNeighbors
=
0
;
std
::
vector
<
int8_t
>
m_mask
;
// mask at nearest neighbors
std
::
vector
<
size_t
>
m_indices
;
// source indices at nearest neighbors
std
::
vector
<
double
>
m_dist
;
// angular distance four nearest neighbors
std
::
vector
<
size_t
>
m_tmpIndices
;
...
...
@@ -149,7 +149,7 @@ public:
constexpr
double
eps
=
1.e-14
;
// If distance is zero, set to small number
for
(
size_t
i
=
0
;
i
<
m_numNeighbors
;
++
i
)
if
(
m_indices
[
i
]
<
SIZE_MAX
&&
m_dist
[
i
]
<=
0.0
)
m_dist
[
i
]
=
eps
;
if
(
m_dist
[
i
]
<=
0.0
)
m_dist
[
i
]
=
eps
;
}
size_t
...
...
@@ -216,7 +216,7 @@ public:
double
distTotal
=
0.0
;
// sum of neighbor distances (for normalizing)
for
(
size_t
i
=
0
;
i
<
m_
max
Neighbors
;
++
i
)
for
(
size_t
i
=
0
;
i
<
m_
num
Neighbors
;
++
i
)
{
m_mask
[
i
]
=
false
;
if
(
gridMask
[
m_indices
[
i
]])
...
...
@@ -227,7 +227,7 @@ public:
}
}
return
normalize_weights_mask
(
distTotal
,
m_
max
Neighbors
);
return
normalize_weights_mask
(
distTotal
,
m_
num
Neighbors
);
}
size_t
...
...
This diff is collapsed.
Click to expand it.
src/remap_distwgt.cc
+
1
−
2
View file @
47e1cd97
...
...
@@ -70,8 +70,7 @@ remap_distwgt_weights(size_t numNeighbors, RemapSearch &rsearch, RemapVars &rv)
// Compute weights based on inverse distance if mask is false, eliminate those points
auto
numWeights
=
knnWgt
.
compute_weights
(
srcGrid
->
mask
);
for
(
size_t
i
=
0
;
i
<
numWeights
;
++
i
)
if
(
knnWgt
.
m_mask
[
i
])
tgtGrid
->
cellFrac
[
tgtCellIndex
]
=
1.0
;
if
(
numWeights
)
tgtGrid
->
cellFrac
[
tgtCellIndex
]
=
1.0
;
// Store the link
store_weightlinks
(
0
,
numWeights
,
knnWgt
.
m_indices
.
data
(),
knnWgt
.
m_dist
.
data
(),
tgtCellIndex
,
weightLinks
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment