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
ac7f50e9
Commit
ac7f50e9
authored
2 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
subVarLevelValues(): cleanup.
parent
5f5f0b07
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/percentiles_hist.cc
+13
-12
13 additions, 12 deletions
src/percentiles_hist.cc
with
13 additions
and
12 deletions
src/percentiles_hist.cc
+
13
−
12
View file @
ac7f50e9
...
...
@@ -403,18 +403,24 @@ HistogramSet::addVarLevelValues(const int varID, const int levelID, const Field_
}
const
auto
_subVarLevelValues
=
[](
LambdaField_T_
field
,
int
varID
,
int
levelID
,
const
int
nlevels
,
int
nvar
s
,
std
::
vector
<
Histogram
>&
hists
,
const
size_t
nhists
)
->
int
const
auto
_subVarLevelValues
=
[](
LambdaField_T_
field
,
const
size_t
nhist
s
,
std
::
vector
<
Histogram
>&
hists
)
->
int
{
if
(
varID
<
0
||
varID
>=
nvars
)
cdo_abort
(
"Illegal argument: varID %d is undefined (%s)"
,
varID
,
__func__
);
if
(
nhists
!=
gridInqSize
(
field
.
grid
))
cdo_abort
(
"Grids are different (%s)"
,
__func__
);
if
(
levelID
<
0
||
levelID
>=
nlevels
)
cdo_abort
(
"Illegal argument: levelID %d is undefined (%s)"
,
levelID
,
__func__
);
return
histSubVarLevelValues
(
nhists
,
hists
,
field
.
vec
,
field
.
nmiss
,
field
.
getMissValue
());
};
if
(
nhists
!=
gridInqSize
(
field
.
grid
))
cdo_abort
(
"Grids are different (%s)"
,
__func__
);
int
HistogramSet
::
subVarLevelValues
(
const
int
varID
,
const
int
levelID
,
const
Field_t
&
field
)
{
if
(
varID
<
0
||
varID
>=
nvars
)
cdo_abort
(
"Illegal argument: varID %d is undefined (%s)"
,
varID
,
__func__
);
int
nign
=
0
;
const
auto
nlevels
=
this
->
var_nlevels
[
varID
];
if
(
levelID
<
0
||
levelID
>=
nlevels
)
cdo_abort
(
"Illegal argument: levelID %d is undefined (%s)"
,
levelID
,
__func__
);
nign
=
histSubVarLevelValues
(
nhists
,
hists
,
field
.
vec
,
field
.
nmiss
,
field
.
getMissValue
())
;
const
auto
nhists
=
this
->
var_nhists
[
varID
]
;
int
nign
=
field_operation
(
_subVarLevelValues
,
field
,
nhists
,
this
->
histograms
[
varID
][
levelID
]);
if
(
nign
)
{
cdo_warning
(
"%d out of %d grid values are out of bounds and have been ignored (%s)"
,
nign
,
nhists
,
__func__
);
...
...
@@ -422,11 +428,6 @@ const auto _subVarLevelValues = [](LambdaField_T_ field, int varID, int levelID,
}
return
0
;
};
int
HistogramSet
::
subVarLevelValues
(
const
int
varID
,
const
int
levelID
,
const
Field_t
&
field
)
{
return
field_operation
(
_subVarLevelValues
,
field
,
varID
,
levelID
,
this
->
var_nlevels
[
varID
],
this
->
nvars
,
this
->
histograms
[
varID
][
levelID
],
this
->
var_nhists
[
varID
]);
}
/* unused
void
...
...
@@ -485,4 +486,4 @@ const auto _getVarLevelPercentiles = [](LambdaField_T_ field, const int varID, c
void
HistogramSet
::
getVarLevelPercentiles
(
Field_t
&
field
,
const
int
varID
,
const
int
levelID
,
const
double
p
)
{
field_operation
(
_getVarLevelPercentiles
,
field
,
varID
,
levelID
,
p
,
this
->
var_nlevels
[
varID
],
nvars
,
this
->
histograms
[
varID
][
levelID
],
this
->
var_nhists
[
varID
]);
}
\ No newline at end of file
}
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