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
0baa31f3
Commit
0baa31f3
authored
Mar 25, 2020
by
Uwe Schulzweida
Browse files
Removed MinMax varrayMinMaxMV(size_t len, const double *array, double missval, size_t &nvals);
parent
b06e818d
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Importcmsaf.cc
View file @
0baa31f3
...
...
@@ -1316,8 +1316,8 @@ Importcmsaf(void *process)
int
varID
,
levelID
,
tsID
;
double
*
array
;
double
missval
;
hid_t
file_id
;
/
*
HDF5 File ID
*/
herr_t
status
;
/
*
Generic return value
*/
hid_t
file_id
;
/
/
HDF5 File ID
herr_t
status
;
/
/
Generic return value
datasets_t
dsets
;
int64_t
vdate
;
int
vtime
;
...
...
@@ -1333,11 +1333,11 @@ Importcmsaf(void *process)
#ifdef HAVE_LIBHDF5
dsets_init
(
&
dsets
);
/
*
Open an existing file.
*/
/
/
Open an existing file.
file_id
=
H5Fopen
(
cdoGetStreamName
(
0
),
H5F_ACC_RDONLY
,
H5P_DEFAULT
);
if
(
file_id
<
0
)
cdoAbort
(
"H5Fopen failed on %s"
,
cdoGetStreamName
(
0
));
/
*
cmsaf_type = get_cmsaf_type(file_id);
*/
/
/
cmsaf_type = get_cmsaf_type(file_id);
H5Giterate
(
file_id
,
"/"
,
nullptr
,
obj_info
,
(
void
*
)
&
dsets
);
...
...
@@ -1472,9 +1472,8 @@ Importcmsaf(void *process)
if
(
nz
==
1
)
offset
=
gridsize
*
tsID
;
array
=
dsets
.
obj
[
ivar
].
array
+
offset
;
size_t
nvals
;
const
auto
mm
=
varrayMinMaxMV
(
gridsize
,
array
,
missval
,
nvals
);
nmiss
=
gridsize
-
nvals
;
const
auto
mm
=
varrayMinMaxMV
(
gridsize
,
array
,
missval
);
nmiss
=
gridsize
-
mm
.
n
;
if
(
Options
::
cdoVerbose
)
cdoPrint
(
" Write var %d, level %d, nmiss %zu, missval %g, minval %g, maxval %g"
,
varID
,
levelID
,
nmiss
,
missval
,
...
...
@@ -1486,7 +1485,7 @@ Importcmsaf(void *process)
}
}
/
*
Close file
*/
/
/
Close file
status
=
H5Fclose
(
file_id
);
(
void
)
(
status
);
// CDO_UNUSED
...
...
src/array.cc
View file @
0baa31f3
...
...
@@ -46,12 +46,12 @@ fpe_errstr(int fpeRaised)
}
MinMax
varrayMinMaxMV
(
const
size_t
len
,
const
double
*
array
,
const
double
missval
,
size_t
&
nvals
)
varrayMinMaxMV
(
const
size_t
len
,
const
double
*
array
,
const
double
missval
)
{
double
vmin
=
DBL_MAX
;
double
vmax
=
-
DBL_MAX
;
nvals
=
0
;
size_t
nvals
=
0
;
for
(
size_t
i
=
0
;
i
<
len
;
++
i
)
{
if
(
!
DBL_IS_EQUAL
(
array
[
i
],
missval
))
...
...
@@ -62,21 +62,13 @@ varrayMinMaxMV(const size_t len, const double *array, const double missval, size
}
}
return
MinMax
(
vmin
,
vmax
);
}
MinMax
varrayMinMaxMV
(
const
size_t
len
,
const
double
*
array
,
const
double
missval
)
{
size_t
nvals
;
return
varrayMinMaxMV
(
len
,
array
,
missval
,
nvals
);
return
MinMax
(
vmin
,
vmax
,
nvals
);
}
MinMax
varrayMinMaxMV
(
const
size_t
len
,
const
Varray
<
double
>
&
array
,
const
double
missval
)
{
size_t
nvals
;
return
varrayMinMaxMV
(
len
,
array
.
data
(),
missval
,
nvals
);
return
varrayMinMaxMV
(
len
,
array
.
data
(),
missval
);
}
template
<
typename
T
>
...
...
src/array.h
View file @
0baa31f3
...
...
@@ -203,7 +203,6 @@ MinMax varrayMinMax(const Varray<T> &v);
MinMax
varrayMinMaxMV
(
size_t
len
,
const
Varray
<
double
>
&
array
,
double
missval
);
MinMax
varrayMinMaxMV
(
size_t
len
,
const
double
*
array
,
double
missval
);
MinMax
varrayMinMaxMV
(
size_t
len
,
const
double
*
array
,
double
missval
,
size_t
&
nvals
);
double
varrayMin
(
size_t
len
,
const
Varray
<
double
>
&
v
);
double
varrayMax
(
size_t
len
,
const
Varray
<
double
>
&
v
);
...
...
src/datarangelist.h
View file @
0baa31f3
...
...
@@ -31,12 +31,13 @@ struct Datarange
double
addoffset
;
double
scalefactor
;
Datarange
()
:
check_datarange
(
false
),
gridsize
(
0
),
datatype
(
0
),
missval
(
0
),
addoffset
(
0
),
scalefactor
(
1
)
{};
void
checkDatarange
(
double
*
array
,
size_t
nmiss
)
{
size_t
ivals
=
0
;
auto
mm
=
nmiss
?
varrayMinMaxMV
(
gridsize
,
array
,
missval
,
ivals
)
:
varrayMinMax
(
gridsize
,
array
);
if
(
nmiss
==
0
)
ivals
=
gridsize
;
auto
mm
=
nmiss
?
varrayMinMaxMV
(
gridsize
,
array
,
missval
)
:
varrayMinMax
(
gridsize
,
array
);
size_t
ivals
=
(
nmiss
==
0
)
?
gridsize
:
mm
.
n
;
if
(
ivals
>
0
)
{
...
...
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