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
011065d6
Commit
011065d6
authored
Apr 06, 2020
by
Uwe Schulzweida
Browse files
Fix g++ warnings.
parent
8bbce5d9
Pipeline
#2494
passed with stages
in 15 minutes and 22 seconds
Changes
80
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Afterburner.cc
View file @
011065d6
...
...
@@ -582,23 +582,6 @@ after_check_content(struct Variable *vars, int timestep)
}
}
}
/*
if ( NumLevelRequest > 0 )
{
vars[HALF_PRESS].needed = 1;
vars[FULL_PRESS].needed = 1;
}
code = HALF_PRESS;
if ( vars[code].needed && !vars[code].comp &&
vars[code].spectral == nullptr && vars[code].hybrid == nullptr )
afterAbort( "Hybrid model level not found!");
code = FULL_PRESS;
if ( vars[code].needed && !vars[code].comp &&
vars[code].spectral == nullptr && vars[code].hybrid == nullptr )
afterAbort( "Hybrid model level not found!");
*/
}
static
void
...
...
@@ -1323,7 +1306,6 @@ static void
after_precntl
(
struct
Control
*
globs
,
struct
Variable
*
vars
)
{
int
l
;
int
code
=
0
;
int
varID
;
int
i
,
index
;
int
vertfound
=
0
;
...
...
@@ -1538,7 +1520,7 @@ after_precntl(struct Control *globs, struct Variable *vars)
globs
->
Field
=
(
double
*
)
Malloc
(
FieldDim
*
sizeof
(
double
));
if
(
globs
->
Debug
)
for
(
code
=
0
;
code
<
MaxCodes
;
code
++
)
for
(
int
code
=
0
;
code
<
MaxCodes
;
code
++
)
{
if
(
vars
[
code
].
detected
)
fprintf
(
stderr
,
" Detected Code %3d with %3d level
\n
"
,
code
,
zaxisInqSize
(
vars
[
code
].
izaxisID
));
}
...
...
@@ -1711,10 +1693,8 @@ after_readVct(struct Control *globs, const char *vctfile)
static
void
after_control_init
(
struct
Control
*
globs
)
{
memset
(
globs
,
0
,
sizeof
(
struct
Control
));
globs
->
AnalysisData
=
0
;
/* 0 = ECHAM Data, 1 = ECMWF Spectral Analyses */
globs
->
DayIn
=
0
;
/* day increment of infiles if Multi = true */
globs
->
AnalysisData
=
0
;
// 0 = ECHAM Data, 1 = ECMWF Spectral Analyses
globs
->
DayIn
=
0
;
// day increment of infiles if Multi = true
globs
->
Debug
=
false
;
globs
->
Extrapolate
=
true
;
globs
->
Szip
=
false
;
...
...
@@ -1747,11 +1727,8 @@ after_variable_init(struct Variable *vars)
static
void
after_processing
(
struct
Control
*
globs
,
struct
Variable
*
vars
)
{
//#if defined(PSTREAM_H)
// globs->istreamID = streamOpenReadLocked(0);
//#else
globs
->
istreamID
=
streamOpenReadLocked
(
ifile
);
//#endif
if
(
ofiletype
==
-
1
)
ofiletype
=
streamInqFiletype
(
globs
->
istreamID
);
globs
->
ivlistID
=
streamInqVlist
(
globs
->
istreamID
);
...
...
@@ -1775,7 +1752,6 @@ after_processing(struct Control *globs, struct Variable *vars)
/* ----------------- */
/* initializations */
/* ----------------- */
after_setCodes
(
globs
,
vars
,
MaxCodes
,
globs
->
NumCodesRequest
);
if
(
globs
->
unitsel
==
2
)
...
...
@@ -1833,9 +1809,6 @@ after_processing(struct Control *globs, struct Variable *vars)
&&
(
vars
[
DIVERGENCE
].
selected
||
vars
[
VELOPOT
].
selected
||
vars
[
VORTICITY
].
selected
||
vars
[
STREAM
].
selected
||
globs
->
AnalysisData
))
{
/*
int newtype = 0;
*/
if
(
globs
->
Type
==
30
)
globs
->
Type
=
70
;
if
(
globs
->
Type
==
40
)
globs
->
Type
=
60
;
if
(
globs
->
Type
==
41
)
globs
->
Type
=
61
;
...
...
@@ -1845,17 +1818,6 @@ after_processing(struct Control *globs, struct Variable *vars)
else
fprintf
(
stderr
,
"
\n
TYPE changed to %d (with code %d, %d, %d or %d)
\n
"
,
globs
->
Type
,
DIVERGENCE
,
VELOPOT
,
VORTICITY
,
STREAM
);
/*
if ( globs->Type == 30 ) newtype = 70;
if ( globs->Type == 40 ) newtype = 60;
if ( globs->Type == 41 ) newtype = 61;
if ( globs->AnalysisData )
fprintf(stderr,"\n Attention: TYPE isn't changed to %d anymore (for
analysis data)!!!\n", globs->Type); else fprintf(stderr,"\n Attention:
TYPE isn't changed to %d anymore (with code %d, %d, %d or %d)!!!\n",
newtype, DIVERGENCE, VELOPOT, VORTICITY, STREAM);
*/
}
if
(
globs
->
AnalysisData
)
...
...
@@ -1917,21 +1879,17 @@ Afterburner(void *process)
lstdout
=
!
Options
::
silentMode
;
struct
Control
*
globs
=
(
struct
Control
*
)
Malloc
(
sizeof
(
struct
Control
))
;
after_control_init
(
globs
);
struct
Control
globs
=
{}
;
after_control_init
(
&
globs
);
globs
->
Verbose
=
Options
::
cdoVerbose
;
globs
.
Verbose
=
Options
::
cdoVerbose
;
if
(
operatorArgc
()
==
1
)
{
const
char
*
vctfile
=
cdoOperatorArgv
(
0
).
c_str
();
after_readVct
(
globs
,
vctfile
);
}
if
(
operatorArgc
()
==
1
)
after_readVct
(
&
globs
,
cdoOperatorArgv
(
0
).
c_str
());
struct
Variable
vars
[
MaxCodes
+
5
];
for
(
int
code
=
0
;
code
<
MaxCodes
+
5
;
code
++
)
after_variable_init
(
&
vars
[
code
]);
after_parini
(
globs
,
vars
);
/* read namelist parameter */
after_parini
(
&
globs
,
vars
);
/* read namelist parameter */
if
(
CdoDefault
::
FileType
!=
CDI_UNDEFID
)
ofiletype
=
CdoDefault
::
FileType
;
...
...
@@ -1943,21 +1901,20 @@ Afterburner(void *process)
ifile
=
strdup
(
cdoGetStreamName
(
0
));
ofile
=
cdoGetStreamName
(
nfiles
);
globs
->
Nfiles
=
nfiles
-
1
;
if
(
globs
->
Nfiles
>
0
)
globs
.
Nfiles
=
nfiles
-
1
;
if
(
globs
.
Nfiles
>
0
)
{
if
(
globs
->
Multi
>
0
)
afterAbort
(
"Namelist parameter MULTI works only with one inputfile"
);
if
(
globs
.
Multi
>
0
)
afterAbort
(
"Namelist parameter MULTI works only with one inputfile"
);
ifiles
=
(
const
char
**
)
Malloc
(
globs
->
Nfiles
*
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
globs
->
Nfiles
;
++
i
)
ifiles
[
i
]
=
cdoGetStreamName
(
--
nfiles
);
for
(
int
i
=
0
;
i
<
globs
->
Nfiles
;
++
i
)
printf
(
"files %d %s
\n
"
,
i
+
1
,
ifiles
[
i
]);
ifiles
=
(
const
char
**
)
Malloc
(
globs
.
Nfiles
*
sizeof
(
char
*
));
for
(
int
i
=
0
;
i
<
globs
.
Nfiles
;
++
i
)
ifiles
[
i
]
=
cdoGetStreamName
(
--
nfiles
);
for
(
int
i
=
0
;
i
<
globs
.
Nfiles
;
++
i
)
printf
(
"files %d %s
\n
"
,
i
+
1
,
ifiles
[
i
]);
}
after_processing
(
globs
,
vars
);
after_processing
(
&
globs
,
vars
);
FreeMean
(
vars
);
Free
(
globs
);
Free
(
ifile
);
cdoFinish
();
...
...
src/Arithc.cc
View file @
011065d6
...
...
@@ -114,7 +114,7 @@ Arithc(void *process)
const
auto
streamID2
=
cdoOpenWrite
(
1
);
cdoDefVlist
(
streamID2
,
vlistID2
);
const
size_t
nwpv
=
(
vlistNumber
(
vlistID1
)
==
CDI_COMP
)
?
2
:
1
;
size_t
nwpv
=
(
vlistNumber
(
vlistID1
)
==
CDI_COMP
)
?
2
:
1
;
if
(
nwpv
==
2
&&
!
opercplx
)
cdoAbort
(
"Fields with complex numbers are not supported by this operator!"
);
const
auto
gridsizemax
=
nwpv
*
vlistGridsizeMax
(
vlistID1
);
...
...
@@ -134,7 +134,7 @@ Arithc(void *process)
if
(
vars
[
varID
])
{
const
auto
nwpv
=
vlistInqNWPV
(
vlistID1
,
varID
);
nwpv
=
vlistInqNWPV
(
vlistID1
,
varID
);
const
auto
gridID
=
vlistInqVarGrid
(
vlistID1
,
varID
);
field
.
grid
=
gridID
;
field
.
size
=
nwpv
*
gridInqSize
(
gridID
);
...
...
src/CDIread.cc
View file @
011065d6
...
...
@@ -80,8 +80,8 @@ CDIread(void *process)
VarList
varList
;
varListInit
(
varList
,
vlistID
);
const
auto
filetype
=
cdoInqFiletype
(
streamID
);
const
auto
datatype
=
vlistInqVarDatatype
(
vlistID
,
0
);
filetype
=
cdoInqFiletype
(
streamID
);
datatype
=
vlistInqVarDatatype
(
vlistID
,
0
);
const
auto
gridsizemax
=
vlistGridsizeMax
(
vlistID
);
...
...
src/CMOR_lite.cc
View file @
011065d6
...
...
@@ -258,7 +258,7 @@ applyCmorList(PMList &pmlist, int nvars, int vlistID2, std::vector<CmorVar> &var
}
else
if
(
key
==
"missval"
||
key
==
"missing_value"
)
{
auto
missval
=
parameter2double
(
value
);
missval
=
parameter2double
(
value
);
auto
missval_old
=
vlistInqVarMissval
(
vlistID2
,
varID
);
if
(
!
DBL_IS_EQUAL
(
missval
,
missval_old
))
{
...
...
@@ -313,7 +313,6 @@ void *
CMOR_lite
(
void
*
process
)
{
int
nrecs
;
int
varID
,
levelID
;
size_t
nmiss
;
bool
delvars
=
false
;
...
...
@@ -345,14 +344,13 @@ CMOR_lite(void *process)
const
auto
vlistID1
=
cdoStreamInqVlist
(
streamID1
);
auto
vlistID2
=
vlistDuplicate
(
vlistID1
);
/* vlistPrint(vlistID2);*/
const
auto
nvars
=
vlistNvars
(
vlistID2
);
std
::
vector
<
CmorVar
>
vars
(
nvars
);
memset
(
vars
.
data
(),
0
,
nvars
*
sizeof
(
CmorVar
));
if
(
convert_data
)
for
(
varID
=
0
;
varID
<
nvars
;
++
varID
)
vars
[
varID
].
convert
=
true
;
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
vars
[
varID
].
convert
=
true
;
const
auto
filename
=
cdoOperatorArgv
(
0
).
c_str
();
auto
fp
=
fopen
(
filename
,
"r"
);
...
...
@@ -364,6 +362,9 @@ CMOR_lite(void *process)
applyCmorList
(
pmlist
,
nvars
,
vlistID2
,
vars
);
VarList
varList2
;
varListInit
(
varList2
,
vlistID2
);
for
(
int
varID
=
0
;
varID
<
nvars
;
++
varID
)
if
(
vars
[
varID
].
remove
)
{
...
...
@@ -378,9 +379,7 @@ CMOR_lite(void *process)
for
(
int
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
const
auto
zaxisID
=
vlistInqVarZaxis
(
vlistID2
,
varID
);
const
auto
nlevs
=
zaxisInqSize
(
zaxisID
);
for
(
int
levID
=
0
;
levID
<
nlevs
;
levID
++
)
for
(
int
levID
=
0
;
levID
<
varList2
[
varID
].
nlevels
;
levID
++
)
{
vlistDefFlag
(
vlistID1
,
varID
,
levID
,
true
);
vlistDefFlag
(
vlistID2
,
varID
,
levID
,
true
);
...
...
@@ -432,6 +431,7 @@ CMOR_lite(void *process)
for
(
int
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
int
varID
,
levelID
;
cdoInqRecord
(
streamID1
,
&
varID
,
&
levelID
);
auto
&
var
=
vars
[
varID
];
...
...
@@ -453,9 +453,9 @@ CMOR_lite(void *process)
cdoReadRecord
(
streamID1
,
array
.
data
(),
&
nmiss
);
const
auto
missval
=
v
listInqVarMissval
(
vlistID2
,
varID2
)
;
auto
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID2
))
;
if
(
v
listInqVarNumber
(
vlistID2
,
varID2
)
!=
CDI_REAL
)
gridsize
*=
2
;
const
auto
missval
=
v
arList2
[
varID2
].
missval
;
auto
gridsize
=
varList2
[
varID2
].
gridsize
;
if
(
v
arList2
[
varID2
].
nwpv
!=
CDI_REAL
)
gridsize
*=
2
;
if
(
nmiss
&&
var
.
changemissval
)
{
...
...
src/Collgrid.cc
View file @
011065d6
...
...
@@ -101,9 +101,9 @@ genGrid(int ngrids, int nfiles, std::vector<EnsfileType> &ef, bool ginit, int ig
if
(
nxblocks
!=
-
1
)
nx
=
nxblocks
;
auto
gridID
=
vlistGrid
(
ef
[
0
].
vlistID
,
igrid
);
auto
gridtype
=
(
globalGridType
!=
CDI_UNDEFID
)
?
globalGridType
:
gridInqType
(
gridID
);
if
(
ngrids
>
1
&&
gridtype
==
GRID_GENERIC
&&
gridInqXsize
(
gridID
)
==
0
&&
gridInqYsize
(
gridID
)
==
0
)
return
gridID2
;
if
(
gridtype
==
GRID_UNSTRUCTURED
)
lunstructured
=
true
;
auto
gridtype
0
=
(
globalGridType
!=
CDI_UNDEFID
)
?
globalGridType
:
gridInqType
(
gridID
);
if
(
ngrids
>
1
&&
gridtype
0
==
GRID_GENERIC
&&
gridInqXsize
(
gridID
)
==
0
&&
gridInqYsize
(
gridID
)
==
0
)
return
gridID2
;
if
(
gridtype
0
==
GRID_UNSTRUCTURED
)
lunstructured
=
true
;
const
int
nv
=
lunstructured
?
gridInqNvertex
(
gridID
)
:
0
;
const
bool
lcenter
=
globalGridType
==
CDI_UNDEFID
&&
gridInqXvals
(
gridID
,
nullptr
)
>
0
&&
gridInqYvals
(
gridID
,
nullptr
)
>
0
;
const
bool
lbounds
=
lunstructured
&&
globalGridType
==
CDI_UNDEFID
&&
gridInqXbounds
(
gridID
,
nullptr
)
>
0
...
...
@@ -117,7 +117,7 @@ genGrid(int ngrids, int nfiles, std::vector<EnsfileType> &ef, bool ginit, int ig
for
(
int
fileID
=
0
;
fileID
<
nfiles
;
fileID
++
)
{
gridID
=
vlistGrid
(
ef
[
fileID
].
vlistID
,
igrid
);
const
int
gridtype
=
(
globalGridType
!=
CDI_UNDEFID
)
?
globalGridType
:
gridInqType
(
gridID
);
const
auto
gridtype
=
(
globalGridType
!=
CDI_UNDEFID
)
?
globalGridType
:
gridInqType
(
gridID
);
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
)
lregular
=
true
;
else
if
(
gridtype
==
GRID_CURVILINEAR
)
...
...
@@ -317,7 +317,7 @@ genGrid(int ngrids, int nfiles, std::vector<EnsfileType> &ef, bool ginit, int ig
}
}
gridID2
=
gridCreate
(
gridtype
,
xsize2
*
ysize2
);
gridID2
=
gridCreate
(
gridtype
0
,
xsize2
*
ysize2
);
if
(
!
lunstructured
)
{
gridDefXsize
(
gridID2
,
xsize2
);
...
...
@@ -348,7 +348,7 @@ genGrid(int ngrids, int nfiles, std::vector<EnsfileType> &ef, bool ginit, int ig
grid_copy_attributes
(
gridID
,
gridID2
);
if
(
gridtype
==
GRID_PROJECTION
)
grid_copy_mapping
(
gridID
,
gridID2
);
if
(
gridtype
0
==
GRID_PROJECTION
)
grid_copy_mapping
(
gridID
,
gridID2
);
return
gridID2
;
}
...
...
src/Derivepar.cc
View file @
011065d6
...
...
@@ -40,7 +40,6 @@ Derivepar(void *process)
{
ModelMode
mode
(
ModelMode
::
UNDEF
);
int
nrecs
;
int
i
;
size_t
offset
;
int
varID
,
levelID
;
int
surfaceID
=
-
1
;
...
...
@@ -69,8 +68,8 @@ Derivepar(void *process)
const
auto
streamID1
=
cdoOpenRead
(
0
);
const
auto
vlistID1
=
cdoStreamInqVlist
(
streamID1
);
auto
gridID
=
vlistGrid
(
vlistID1
,
0
);
if
(
gridInqType
(
gridID
)
==
GRID_SPECTRAL
)
cdoAbort
(
"Spectral data unsupported!"
);
auto
gridID
0
=
vlistGrid
(
vlistID1
,
0
);
if
(
gridInqType
(
gridID
0
)
==
GRID_SPECTRAL
)
cdoAbort
(
"Spectral data unsupported!"
);
auto
gridsize
=
vlist_check_gridsize
(
vlistID1
);
...
...
@@ -81,7 +80,7 @@ Derivepar(void *process)
vlist_hybrid_vct
(
vlistID1
,
&
zaxisIDh
,
&
nvct
,
vct
,
&
nhlevf
);
if
(
Options
::
cdoVerbose
)
for
(
i
=
0
;
i
<
nvct
/
2
;
++
i
)
cdoPrint
(
"vct: %5d %25.17f %25.17f"
,
i
,
vct
[
i
],
vct
[
nvct
/
2
+
i
]);
for
(
int
i
=
0
;
i
<
nvct
/
2
;
++
i
)
cdoPrint
(
"vct: %5d %25.17f %25.17f"
,
i
,
vct
[
i
],
vct
[
nvct
/
2
+
i
]);
if
(
zaxisIDh
==
-
1
)
cdoAbort
(
"No 3D variable with hybrid sigma pressure coordinate found!"
);
...
...
@@ -266,12 +265,12 @@ Derivepar(void *process)
if
(
operatorID
==
GHEIGHT
)
{
var_id
=
geopotential_height
;
varID
=
vlistDefVar
(
vlistID2
,
gridID
,
zaxisIDh
,
TIME_VARYING
);
varID
=
vlistDefVar
(
vlistID2
,
gridID
0
,
zaxisIDh
,
TIME_VARYING
);
}
else
if
(
operatorID
==
SEALEVELPRESSURE
)
{
var_id
=
air_pressure_at_sea_level
;
varID
=
vlistDefVar
(
vlistID2
,
gridID
,
surfaceID
,
TIME_VARYING
);
varID
=
vlistDefVar
(
vlistID2
,
gridID
0
,
surfaceID
,
TIME_VARYING
);
}
else
cdoAbort
(
"Internal problem, invalid operatorID: %d!"
,
operatorID
);
...
...
src/Detrend.cc
View file @
011065d6
...
...
@@ -176,16 +176,16 @@ Detrend(void *process)
{
const
auto
ompthID
=
cdo_omp_get_thread_num
();
for
(
int
tsID
=
0
;
tsID
<
nsteps
;
++
tsID
)
array1
[
ompthID
][
tsID
]
=
vars
[
tsID
][
varID
][
levelID
].
vec_d
[
i
];
for
(
int
k
=
0
;
k
<
nsteps
;
++
k
)
array1
[
ompthID
][
k
]
=
vars
[
k
][
varID
][
levelID
].
vec_d
[
i
];
detrend
(
nsteps
,
deltaTS0
,
missval
,
array1
[
ompthID
],
array2
[
ompthID
]);
for
(
int
tsID
=
0
;
tsID
<
nsteps
;
++
tsID
)
vars
[
tsID
][
varID
][
levelID
].
vec_d
[
i
]
=
array2
[
ompthID
][
tsID
];
for
(
int
k
=
0
;
k
<
nsteps
;
++
k
)
vars
[
k
][
varID
][
levelID
].
vec_d
[
i
]
=
array2
[
ompthID
][
k
];
}
}
}
for
(
int
tsID
=
0
;
tsID
<
nts
;
tsID
++
)
for
(
tsID
=
0
;
tsID
<
nts
;
tsID
++
)
{
dtlist
.
taxisDefTimestep
(
taxisID2
,
tsID
);
cdoDefTimestep
(
streamID2
,
tsID
);
...
...
src/Distgrid.cc
View file @
011065d6
...
...
@@ -235,7 +235,6 @@ Distgrid(void *process)
int
nrecs
;
char
filesuffix
[
32
];
char
filename
[
8192
];
int
index
;
int
gridtype
=
-
1
;
cdoInitialize
(
process
);
...
...
@@ -255,17 +254,20 @@ Distgrid(void *process)
const
auto
ngrids
=
vlistNgrids
(
vlistID1
);
for
(
index
=
0
;
index
<
ngrids
;
index
++
)
{
gridID1
=
vlistGrid
(
vlistID1
,
index
);
gridtype
=
gridInqType
(
gridID1
);
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_UNSTRUCTURED
||
(
gridtype
==
GRID_GENERIC
&&
gridInqXsize
(
gridID1
)
>
0
&&
gridInqYsize
(
gridID1
)
>
0
))
break
;
}
{
int
index
;
for
(
index
=
0
;
index
<
ngrids
;
index
++
)
{
gridID1
=
vlistGrid
(
vlistID1
,
index
);
gridtype
=
gridInqType
(
gridID1
);
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_UNSTRUCTURED
||
(
gridtype
==
GRID_GENERIC
&&
gridInqXsize
(
gridID1
)
>
0
&&
gridInqYsize
(
gridID1
)
>
0
))
break
;
}
if
(
index
==
ngrids
)
cdoAbort
(
"No Lon/Lat, Gaussian, curvilinear or generic grid found (%s data unsupported)!"
,
gridNamePtr
(
gridtype
));
if
(
index
==
ngrids
)
cdoAbort
(
"No Lon/Lat, Gaussian, curvilinear or generic grid found (%s data unsupported)!"
,
gridNamePtr
(
gridtype
));
}
const
bool
lunstruct
=
gridtype
==
GRID_UNSTRUCTURED
;
...
...
src/EOFs.cc
View file @
011065d6
...
...
@@ -282,7 +282,6 @@ EOFs(void *process)
if
(
Options
::
cdoVerbose
)
cdoPrint
(
"Allocated eigenvalue/eigenvector structures with nts=%d gridsize=%zu"
,
nts
,
gridsizemax
);
double
*
covar_array
=
nullptr
;
double
**
covar
=
nullptr
;
double
sum_w
=
1.
;
...
...
@@ -321,16 +320,18 @@ EOFs(void *process)
}
}
size_t
ipack
=
0
;
for
(
size_t
i
=
0
;
i
<
gridsize
;
++
i
)
{
if
(
!
DBL_IS_EQUAL
(
weight
[
i
],
0.0
)
&&
!
DBL_IS_EQUAL
(
weight
[
i
],
missval
)
&&
!
DBL_IS_EQUAL
(
in
[
i
],
missval
))
{
if
(
pack
[
ipack
]
!=
i
)
cdoAbort
(
"Missing values unsupported!"
);
ipack
++
;
}
}
if
(
ipack
!=
npack
)
cdoAbort
(
"Missing values unsupported!"
);
{
size_t
ipack
=
0
;
for
(
size_t
i
=
0
;
i
<
gridsize
;
++
i
)
{
if
(
!
DBL_IS_EQUAL
(
weight
[
i
],
0.0
)
&&
!
DBL_IS_EQUAL
(
weight
[
i
],
missval
)
&&
!
DBL_IS_EQUAL
(
in
[
i
],
missval
))
{
if
(
pack
[
ipack
]
!=
i
)
cdoAbort
(
"Missing values unsupported!"
);
ipack
++
;
}
}
if
(
ipack
!=
npack
)
cdoAbort
(
"Missing values unsupported!"
);
}
if
(
grid_space
)
{
...
...
@@ -481,7 +482,7 @@ EOFs(void *process)
{
if
(
Options
::
cdoVerbose
)
cdoPrint
(
"allocating covar with %i x %i elements | npack=%zu"
,
nts
,
nts
,
npack
);
covar_array
=
(
double
*
)
Malloc
(
nts
*
nts
*
sizeof
(
double
));
double
*
covar_array
=
(
double
*
)
Malloc
(
nts
*
nts
*
sizeof
(
double
));
covar
=
(
double
**
)
Malloc
(
nts
*
sizeof
(
double
*
));
for
(
int
i
=
0
;
i
<
nts
;
++
i
)
covar
[
i
]
=
covar_array
+
nts
*
i
;
...
...
src/EcaEtccdi.cc
View file @
011065d6
...
...
@@ -234,7 +234,6 @@ etccdi_op(ETCCDI_REQUEST *request)
int
nrecs
;
int
levelID
;
size_t
nmiss
;
int
nlevels
;
int
year
,
month
,
day
,
dayoy
;
int64_t
vdate
;
int
vtime
;
...
...
@@ -372,8 +371,8 @@ etccdi_op(ETCCDI_REQUEST *request)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
auto
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID
));
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID2
,
varID
));
const
auto
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID
));
const
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID2
,
varID
));
hsets
[
dayoy
].
createVarLevels
(
varID
,
nlevels
,
gridsize
);
}
}
...
...
@@ -493,7 +492,7 @@ etccdi_op(ETCCDI_REQUEST *request)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
==
TIME_CONSTANT
)
continue
;
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
const
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
if
(
request
->
func2
==
func_sum
)
...
...
@@ -541,7 +540,7 @@ etccdi_op(ETCCDI_REQUEST *request)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
==
TIME_CONSTANT
)
continue
;
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
const
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
if
(
request
->
func2
==
func_sum
)
...
...
@@ -579,7 +578,7 @@ etccdi_op(ETCCDI_REQUEST *request)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
==
TIME_CONSTANT
)
continue
;
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
const
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
#ifdef _OPENMP
...
...
@@ -757,7 +756,7 @@ etccdi_op(ETCCDI_REQUEST *request)
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
==
TIME_CONSTANT
)
continue
;
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
const
auto
nlevels
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
#ifdef _OPENMP
...
...
src/EcaIndices.cc
View file @
011065d6
...
...
@@ -319,6 +319,8 @@ static const char HURR_LONGNAME[] = "Hurricane days index is the number of da
static
const
char
HURR_NAME2
[]
=
"consecutive_hurricane_days_index_per_time_period"
;
static
const
char
HURR_LONGNAME2
[]
=
"Greatest number of consecutive hurricane days per time period. The time period should be defined by the bounds of the time coordinate."
;
// clang-format on
/* ECA temperature indices */
static
int
addWithFrequency
(
std
::
vector
<
std
::
string
>
&
params
,
const
char
*
operatorName
,
size_t
defaultDays
)
...
...
@@ -1900,8 +1902,7 @@ Fdns(void *process)
request
.
var1
.
f1arg
=
TO_KELVIN
(
0.0
);
request
.
var1
.
f2
=
vfarsellec
;
request
.
var1
.
f2arg
=
0.01
;
request
.
var1
.
f3
=
vfaradd
;
/* any f with f(a, b) = miss, if a = miss or b =
miss will do here */
request
.
var1
.
f3
=
vfaradd
;
// any f with f(a, b) = miss, if a = miss or b = miss will do here
request
.
var1
.
f4
=
vfarnum
;
request
.
var1
.
f5
=
nullptr
;
request
.
var1
.
epilog
=
ECA_NONE
;
...
...
@@ -2083,4 +2084,3 @@ Hurr(void *process)
return
0
;
}
// clang-format on
src/Ensstat3.cc
View file @
011065d6
...
...
@@ -83,7 +83,7 @@ roc_curve_integrate(const double **roc, const int n)
void
*
Ensstat3
(
void
*
process
)
{
int
i
,
j
;
int
j
;
int
nrecs
=
0
,
nrecs0
;
size_t
nmiss
=
0
;
int
cum
;
...
...
@@ -146,7 +146,7 @@ Ensstat3(void *process)
/* --> #pragma omp parallel for ... */
/* *************************************************** */
FieldVector
field
(
Threading
::
ompNumThreads
);
for
(
i
=
0
;
i
<
Threading
::
ompNumThreads
;
i
++
)
for
(
int
i
=
0
;
i
<
Threading
::
ompNumThreads
;
i
++
)
{
field
[
i
].
resize
(
nfiles
);
field
[
i
].
weightv
.
resize
(
nfiles
);
...
...
@@ -171,7 +171,7 @@ Ensstat3(void *process)
double
*
levs
=
(
double
*
)
Calloc
(
nfiles
,
sizeof
(
double
));
const
auto
zaxisID2
=
zaxisCreate
(
ZAXIS_GENERIC
,
nfiles
);
for
(
i
=
0
;
i
<
nfiles
;
i
++
)
levs
[
i
]
=
i
;
for
(
int
i
=
0
;
i
<
nfiles
;
i
++
)
levs
[
i
]
=
i
;
zaxisDefLevels
(
zaxisID2
,
levs
);
zaxisDefName
(
zaxisID2
,
"histogram_binID"
);
...
...
@@ -242,7 +242,7 @@ Ensstat3(void *process)
lThresh
=
(
double
*
)
Malloc
(
nbins
*
sizeof
(
double
));
roc
=
(
double
**
)
Malloc
((
nbins
+
1
)
*
sizeof
(
double
*
));
for
(
i
=
0
;
i
<
nbins
;
i
++
)
for
(
int
i
=
0
;
i
<
nbins
;
i
++
)
{
ctg_tab
[
i
]
=
(
int
*
)
Calloc
(
4
,
sizeof
(
int
));
roc
[
i
]
=
(
double
*
)
Calloc
(
2
,
sizeof
(
double
));
...
...
@@ -444,7 +444,7 @@ Ensstat3(void *process)
for
(
binID
=
0
;
binID
<
nfiles
;
binID
++
)
{
for
(
i
=
0
;
i
<
osize
;
i
++
)
tmpdoub
[
i
]
=
(
double
)
array2
[
binID
][
i
];
for
(
int
i
=
0
;
i
<
osize
;
i
++
)
tmpdoub
[
i
]
=
(
double
)
array2
[
binID
][
i
];
cdoDefRecord
(
streamID2
,
varID2
[
varID
],
binID
);
cdoWriteRecord
(
streamID2
,
tmpdoub
.
data
(),
nmiss
);
...
...
@@ -454,7 +454,7 @@ Ensstat3(void *process)
{
fprintf
(
stdout
,
"# : TP FP FN TN TPR FPR
\n
"
);
for
(
i
=
0
;
i
<=
nbins
;
i
++
)
for
(
int
i
=
0
;
i
<=
nbins
;
i
++
)
{
const
int
p
=
ctg_tab
[
i
][
TP
]
+
ctg_tab
[
i
][
FN
];
const
int
n
=
ctg_tab
[
i
][
FP
]
+
ctg_tab
[
i
][
TN
];
...
...
src/Ensval.cc
View file @
011065d6
...
...
@@ -49,6 +49,7 @@ enum RESTYPE_BRS
BRS_RESOL
,
BRS_UNCTY
};
enum
RESTYPE_CRPS
{
CRPS_RES
,
...
...
@@ -59,7 +60,7 @@ enum RESTYPE_CRPS
void
*
Ensval
(
void
*
process
)
{
int
i
,
k
;
int
k
;
int
nrecs
=
0
,
nrecs0
,
nostreams
=
0
,
ngrids
;
size_t
nmiss
;
int
levelID
=
-
1
,
varID
=
-
1
;
...
...
@@ -78,7 +79,6 @@ Ensval(void *process)
double
crps_reli
=
0
,
crps_pot
=
0
,
crps
=
0
;
double
heavyside0
,
heavysideN
;
double
brs_reli
,
brs_resol
,
brs_uncty
,
brs_thresh
=
0
;
double
g
,
o
,
p
;
int
fileID
;
char
file_suffix
[
32
];
...
...
@@ -128,9 +128,7 @@ Ensval(void *process)
// one stream for each value of the decomposition
std
::
vector
<
CdoStreamID
>
streamID2
(
nostreams
);
std
::
vector
<
int
>
vlistID2
(
nostreams
);
std
::
vector
<
int
>
taxisID2
(
nostreams
);
std
::
vector
<
int
>
zaxisID2
(
nostreams
);
std
::
vector
<
int
>
vlistID2
(
nostreams
),
taxisID2
(
nostreams
),
zaxisID2
(
nostreams
);
Varray
<
double
>
val
(
nfiles
,
0
);