Skip to content
GitLab
Menu
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
e6eeda06
Commit
e6eeda06
authored
Feb 20, 2018
by
Uwe Schulzweida
Browse files
Set ColumnLimit to 120.
parent
221485bd
Changes
342
Expand all
Hide whitespace changes
Inline
Side-by-side
src/.clang-format
View file @
e6eeda06
...
...
@@ -36,7 +36,7 @@ BreakBeforeBinaryOperators: All
BreakBeforeBraces: GNU
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit:
8
0
ColumnLimit:
12
0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
...
...
src/Adisit.cc
View file @
e6eeda06
...
...
@@ -46,10 +46,8 @@
static
double
adisit_1
(
double
tpot
,
double
sal
,
double
p
)
{
double
a_a1
=
3.6504E-4
,
a_a2
=
8.3198E-5
,
a_a3
=
5.4065E-7
,
a_a4
=
4.0274E-9
,
a_b1
=
1.7439E-5
,
a_b2
=
2.9778E-7
,
a_c1
=
8.9309E-7
,
a_c2
=
3.1628E-8
,
a_c3
=
2.1987E-10
,
a_d
=
4.1057E-9
,
a_e1
=
1.6056E-10
,
a_e2
=
5.0484E-12
;
double
a_a1
=
3.6504E-4
,
a_a2
=
8.3198E-5
,
a_a3
=
5.4065E-7
,
a_a4
=
4.0274E-9
,
a_b1
=
1.7439E-5
,
a_b2
=
2.9778E-7
,
a_c1
=
8.9309E-7
,
a_c2
=
3.1628E-8
,
a_c3
=
2.1987E-10
,
a_d
=
4.1057E-9
,
a_e1
=
1.6056E-10
,
a_e2
=
5.0484E-12
;
double
qc
=
p
*
(
a_a1
+
p
*
(
a_c1
-
a_e1
*
p
));
double
qv
=
p
*
(
a_b1
-
a_d
*
p
);
...
...
@@ -74,10 +72,8 @@ adisit_1(double tpot, double sal, double p)
static
double
adipot
(
double
t
,
double
s
,
double
p
)
{
double
a_a1
=
3.6504E-4
,
a_a2
=
8.3198E-5
,
a_a3
=
5.4065E-7
,
a_a4
=
4.0274E-9
,
a_b1
=
1.7439E-5
,
a_b2
=
2.9778E-7
,
a_c1
=
8.9309E-7
,
a_c2
=
3.1628E-8
,
a_c3
=
2.1987E-10
,
a_d
=
4.1057E-9
,
a_e1
=
1.6056E-10
,
a_e2
=
5.0484E-12
;
double
a_a1
=
3.6504E-4
,
a_a2
=
8.3198E-5
,
a_a3
=
5.4065E-7
,
a_a4
=
4.0274E-9
,
a_b1
=
1.7439E-5
,
a_b2
=
2.9778E-7
,
a_c1
=
8.9309E-7
,
a_c2
=
3.1628E-8
,
a_c3
=
2.1987E-10
,
a_d
=
4.1057E-9
,
a_e1
=
1.6056E-10
,
a_e2
=
5.0484E-12
;
double
s_rel
=
s
-
35.0
;
...
...
@@ -93,8 +89,7 @@ adipot(double t, double s, double p)
}
static
void
calc_adisit
(
long
gridsize
,
long
nlevel
,
double
*
pressure
,
field_type
tho
,
field_type
sao
,
field_type
tis
)
calc_adisit
(
long
gridsize
,
long
nlevel
,
double
*
pressure
,
field_type
tho
,
field_type
sao
,
field_type
tis
)
{
/* pressure units: hPa */
/* tho units: Celsius */
...
...
@@ -109,8 +104,7 @@ calc_adisit(long gridsize, long nlevel, double *pressure, field_type tho,
for
(
long
i
=
0
;
i
<
gridsize
;
++
i
)
{
if
(
DBL_IS_EQUAL
(
thoptr
[
i
],
tho
.
missval
)
||
DBL_IS_EQUAL
(
saoptr
[
i
],
sao
.
missval
))
if
(
DBL_IS_EQUAL
(
thoptr
[
i
],
tho
.
missval
)
||
DBL_IS_EQUAL
(
saoptr
[
i
],
sao
.
missval
))
{
tisptr
[
i
]
=
tis
.
missval
;
}
...
...
@@ -123,8 +117,7 @@ calc_adisit(long gridsize, long nlevel, double *pressure, field_type tho,
}
static
void
calc_adipot
(
long
gridsize
,
long
nlevel
,
double
*
pressure
,
field_type
t
,
field_type
s
,
field_type
tpot
)
calc_adipot
(
long
gridsize
,
long
nlevel
,
double
*
pressure
,
field_type
t
,
field_type
s
,
field_type
tpot
)
{
/* pressure units: hPa */
/* t units: Celsius */
...
...
@@ -139,8 +132,7 @@ calc_adipot(long gridsize, long nlevel, double *pressure, field_type t,
for
(
long
i
=
0
;
i
<
gridsize
;
++
i
)
{
if
(
DBL_IS_EQUAL
(
tptr
[
i
],
t
.
missval
)
||
DBL_IS_EQUAL
(
sptr
[
i
],
s
.
missval
))
if
(
DBL_IS_EQUAL
(
tptr
[
i
],
t
.
missval
)
||
DBL_IS_EQUAL
(
sptr
[
i
],
s
.
missval
))
{
tpotptr
[
i
]
=
tpot
.
missval
;
}
...
...
@@ -200,8 +192,7 @@ Adisit(void *process)
if
(
operatorID
==
ADISIT
)
{
if
(
strcmp
(
stdname
,
"sea_water_potential_temperature"
)
==
0
)
code
=
2
;
if
(
strcmp
(
stdname
,
"sea_water_potential_temperature"
)
==
0
)
code
=
2
;
}
else
{
...
...
@@ -226,8 +217,7 @@ Adisit(void *process)
zaxisID
=
vlistInqVarZaxis
(
vlistID1
,
thoID
);
int
nlevel2
=
zaxisInqSize
(
zaxisID
);
if
(
nlevel1
!=
nlevel2
)
cdoAbort
(
"temperature and salinity have different number of levels!"
);
if
(
nlevel1
!=
nlevel2
)
cdoAbort
(
"temperature and salinity have different number of levels!"
);
int
nlevel
=
nlevel1
;
double
*
pressure
=
(
double
*
)
Malloc
(
nlevel
*
sizeof
(
double
));
...
...
src/Afterburner.cc
View file @
e6eeda06
This diff is collapsed.
Click to expand it.
src/Arith.cc
View file @
e6eeda06
...
...
@@ -117,8 +117,7 @@ Arith(void *process)
if
(
ntsteps1
!=
1
&&
ntsteps2
==
1
)
{
filltype
=
FILL_VAR
;
cdoPrint
(
"Filling up stream2 >%s< by copying the first variable."
,
cdoGetStreamName
(
1
).
c_str
());
cdoPrint
(
"Filling up stream2 >%s< by copying the first variable."
,
cdoGetStreamName
(
1
).
c_str
());
}
else
{
...
...
@@ -135,8 +134,7 @@ Arith(void *process)
if
(
ntsteps1
==
1
&&
ntsteps2
!=
1
)
{
filltype
=
FILL_VAR
;
cdoPrint
(
"Filling up stream1 >%s< by copying the first variable."
,
cdoGetStreamName
(
0
).
c_str
());
cdoPrint
(
"Filling up stream1 >%s< by copying the first variable."
,
cdoGetStreamName
(
0
).
c_str
());
}
else
{
...
...
@@ -168,22 +166,19 @@ Arith(void *process)
varnmiss2
=
(
size_t
*
)
Malloc
(
nlevels2
*
sizeof
(
size_t
));
}
if
(
cdoVerbose
)
cdoPrint
(
"Number of timesteps: file1 %d, file2 %d"
,
ntsteps1
,
ntsteps2
);
if
(
cdoVerbose
)
cdoPrint
(
"Number of timesteps: file1 %d, file2 %d"
,
ntsteps1
,
ntsteps2
);
if
(
filltype
==
FILL_NONE
)
{
if
(
ntsteps1
!=
1
&&
ntsteps2
==
1
)
{
filltype
=
FILL_TS
;
cdoPrint
(
"Filling up stream2 >%s< by copying the first timestep."
,
cdoGetStreamName
(
1
).
c_str
());
cdoPrint
(
"Filling up stream2 >%s< by copying the first timestep."
,
cdoGetStreamName
(
1
).
c_str
());
}
else
if
(
ntsteps1
==
1
&&
ntsteps2
!=
1
)
{
filltype
=
FILL_TS
;
cdoPrint
(
"Filling up stream1 >%s< by copying the first timestep."
,
cdoGetStreamName
(
0
).
c_str
());
cdoPrint
(
"Filling up stream1 >%s< by copying the first timestep."
,
cdoGetStreamName
(
0
).
c_str
());
streamIDx1
=
streamID2
;
streamIDx2
=
streamID1
;
vlistIDx1
=
vlistID2
;
...
...
@@ -202,8 +197,7 @@ Arith(void *process)
{
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
int
nlev
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistIDx2
,
varID
));
vardata
[
varID
]
=
(
double
*
)
Malloc
(
nlev
*
gridsize
*
sizeof
(
double
));
vardata
[
varID
]
=
(
double
*
)
Malloc
(
nlev
*
gridsize
*
sizeof
(
double
));
varnmiss
[
varID
]
=
(
size_t
*
)
Malloc
(
nlev
*
sizeof
(
size_t
));
}
}
...
...
@@ -214,8 +208,7 @@ Arith(void *process)
{
nvars
=
vlistNvars
(
vlistID1
);
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
vlistDefVarMissval
(
vlistID3
,
varID
,
vlistInqVarMissval
(
vlistID1
,
varID
));
vlistDefVarMissval
(
vlistID3
,
varID
,
vlistInqVarMissval
(
vlistID1
,
varID
));
}
int
taxisID3
=
taxisDuplicate
(
taxisIDx1
);
...
...
@@ -228,8 +221,7 @@ Arith(void *process)
int
tsID2
=
0
;
while
((
nrecs
=
cdoStreamInqTimestep
(
streamIDx1
,
tsID
)))
{
if
(
tsID
==
0
||
filltype
==
FILL_NONE
||
filltype
==
FILL_FILE
||
filltype
==
FILL_VARTS
)
if
(
tsID
==
0
||
filltype
==
FILL_NONE
||
filltype
==
FILL_FILE
||
filltype
==
FILL_VARTS
)
{
int
nrecs2
=
cdoStreamInqTimestep
(
streamIDx2
,
tsID2
);
if
(
nrecs2
==
0
)
...
...
@@ -237,8 +229,7 @@ Arith(void *process)
if
(
filltype
==
FILL_NONE
&&
streamIDx2
==
streamID2
)
{
filltype
=
FILL_FILE
;
cdoPrint
(
"Filling up stream2 >%s< by copying all timesteps."
,
cdoGetStreamName
(
1
).
c_str
());
cdoPrint
(
"Filling up stream2 >%s< by copying all timesteps."
,
cdoGetStreamName
(
1
).
c_str
());
}
if
(
filltype
==
FILL_FILE
)
...
...
@@ -254,9 +245,7 @@ Arith(void *process)
vlistCompare
(
vlistID1
,
vlistID2
,
CMP_DIM
);
nrecs2
=
cdoStreamInqTimestep
(
streamIDx2
,
tsID2
);
if
(
nrecs2
==
0
)
cdoAbort
(
"Empty input stream %s!"
,
cdoGetStreamName
(
1
).
c_str
());
if
(
nrecs2
==
0
)
cdoAbort
(
"Empty input stream %s!"
,
cdoGetStreamName
(
1
).
c_str
());
}
else
cdoAbort
(
"Input streams have different number of timesteps!"
);
...
...
@@ -274,8 +263,7 @@ Arith(void *process)
fieldx1
->
nmiss
=
nmiss
;
int
varID2
=
varID
;
if
(
tsID
==
0
||
filltype
==
FILL_NONE
||
filltype
==
FILL_FILE
||
filltype
==
FILL_VARTS
)
if
(
tsID
==
0
||
filltype
==
FILL_NONE
||
filltype
==
FILL_FILE
||
filltype
==
FILL_VARTS
)
{
bool
lstatus
=
nlevels2
>
1
?
varID
==
0
:
recID
==
0
;
...
...
@@ -284,23 +272,18 @@ Arith(void *process)
pstreamInqRecord
(
streamIDx2
,
&
varID2
,
&
levelID2
);
pstreamReadRecord
(
streamIDx2
,
fieldx2
->
ptr
,
&
nmiss
);
fieldx2
->
nmiss
=
nmiss
;
if
(
varID
!=
varID2
)
cdoAbort
(
"Internal error, varIDs of input streams differ!"
);
if
(
levelID
!=
levelID2
)
cdoAbort
(
"Internal error, levelIDs of input streams differ!"
);
if
(
varID
!=
varID2
)
cdoAbort
(
"Internal error, varIDs of input streams differ!"
);
if
(
levelID
!=
levelID2
)
cdoAbort
(
"Internal error, levelIDs of input streams differ!"
);
}
if
(
filltype
==
FILL_TS
)
{
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
varID
));
size_t
offset
=
gridsize
*
levelID
;
arrayCopy
(
gridsize
,
fieldx2
->
ptr
,
vardata
[
varID
]
+
offset
);
varnmiss
[
varID
][
levelID
]
=
fieldx2
->
nmiss
;
}
else
if
(
lstatus
&&
(
filltype
==
FILL_VAR
||
filltype
==
FILL_VARTS
))
else
if
(
lstatus
&&
(
filltype
==
FILL_VAR
||
filltype
==
FILL_VARTS
))
{
size_t
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistIDx2
,
0
));
size_t
offset
=
gridsize
*
levelID2
;
...
...
src/Arithc.cc
View file @
e6eeda06
...
...
@@ -57,9 +57,7 @@ fill_vars(int vlistID)
}
}
if
(
nfound
==
0
)
cdoAbort
(
"Variable -n %s%s not found!"
,
cdoVarnames
[
0
],
cdoNumVarnames
>
1
?
",..."
:
""
);
if
(
nfound
==
0
)
cdoAbort
(
"Variable -n %s%s not found!"
,
cdoVarnames
[
0
],
cdoNumVarnames
>
1
?
",..."
:
""
);
}
else
{
...
...
src/Arithdays.cc
View file @
e6eeda06
...
...
@@ -62,8 +62,7 @@ dayofyear(int calendar, int vdate, int vtime)
doy
+=
(
day
-
1
);
doy
+=
(
second
+
minute
*
60
+
hour
*
3600
)
/
86400.
;
if
(
cdoVerbose
)
cdoPrint
(
"vdate, vtime, dpy, doy: %d %d %d %g"
,
vdate
,
vtime
,
dpy
,
doy
);
if
(
cdoVerbose
)
cdoPrint
(
"vdate, vtime, dpy, doy: %d %d %d %g"
,
vdate
,
vtime
,
dpy
,
doy
);
return
doy
;
}
...
...
@@ -136,9 +135,7 @@ Arithdays(void *process)
rconst
=
days_per_year
(
calendar
,
year
);
}
if
(
cdoVerbose
)
cdoPrint
(
"calendar %d year %d month %d result %g"
,
calendar
,
year
,
month
,
rconst
);
if
(
cdoVerbose
)
cdoPrint
(
"calendar %d year %d month %d result %g"
,
calendar
,
year
,
month
,
rconst
);
for
(
int
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
...
...
src/Arithlat.cc
View file @
e6eeda06
...
...
@@ -82,16 +82,12 @@ Arithlat(void *process)
gridID0
=
gridID
;
gridtype
=
gridInqType
(
gridID
);
int
projtype
=
(
gridtype
==
GRID_PROJECTION
)
?
gridInqProjType
(
gridID
)
:
-
1
;
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
projtype
==
CDI_PROJ_LCC
)
int
projtype
=
(
gridtype
==
GRID_PROJECTION
)
?
gridInqProjType
(
gridID
)
:
-
1
;
if
(
gridtype
==
GRID_LONLAT
||
gridtype
==
GRID_GAUSSIAN
||
projtype
==
CDI_PROJ_LCC
)
{
gridID
=
gridToCurvilinear
(
gridID
,
0
);
}
else
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_UNSTRUCTURED
)
else
if
(
gridtype
==
GRID_CURVILINEAR
||
gridtype
==
GRID_UNSTRUCTURED
)
{
/* No conversion necessary */
}
...
...
@@ -106,8 +102,7 @@ Arithlat(void *process)
"convert reduced to regular grid!"
,
gridNamePtr
(
gridtype
));
else
cdoAbort
(
"Unsupported grid type: %s"
,
gridNamePtr
(
gridtype
));
cdoAbort
(
"Unsupported grid type: %s"
,
gridNamePtr
(
gridtype
));
}
gridsize
=
gridInqSize
(
gridID
);
...
...
src/CDIread.cc
View file @
e6eeda06
...
...
@@ -68,23 +68,20 @@ datatypestr(int datatype)
}
static
void
print_stat
(
const
char
*
sinfo
,
int
memtype
,
int
datatype
,
int
filetype
,
off_t
nvalues
,
double
data_size
,
double
file_size
,
double
tw
)
print_stat
(
const
char
*
sinfo
,
int
memtype
,
int
datatype
,
int
filetype
,
off_t
nvalues
,
double
data_size
,
double
file_size
,
double
tw
)
{
nvalues
/=
1000000
;
data_size
/=
1024.
*
1024.
*
1024.
;
if
(
memtype
==
MEMTYPE_FLOAT
)
cdoPrint
(
"%s Read %.1f GB of 32 bit floats from %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
nvalues
/
tw
);
cdoPrint
(
"%s Read %.1f GB of 32 bit floats from %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
nvalues
/
tw
);
else
cdoPrint
(
"%s Read %.1f GB of 64 bit floats from %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
nvalues
/
tw
);
cdoPrint
(
"%s Read %.1f GB of 64 bit floats from %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
nvalues
/
tw
);
file_size
/=
1024.
*
1024.
*
1024.
;
cdoPrint
(
"%s Read %.1f GB in %.1f seconds, total %.1f MB/s"
,
sinfo
,
file_size
,
tw
,
1024
*
file_size
/
tw
);
cdoPrint
(
"%s Read %.1f GB in %.1f seconds, total %.1f MB/s"
,
sinfo
,
file_size
,
tw
,
1024
*
file_size
/
tw
);
}
void
*
...
...
@@ -136,8 +133,7 @@ CDIread(void *process)
size_t
gridsize
=
vlistGridsizeMax
(
vlistID
);
if
(
darray
==
NULL
)
darray
=
(
double
*
)
Malloc
(
gridsize
*
sizeof
(
double
));
if
(
farray
==
NULL
&&
memtype
==
MEMTYPE_FLOAT
)
farray
=
(
float
*
)
Malloc
(
gridsize
*
sizeof
(
float
));
if
(
farray
==
NULL
&&
memtype
==
MEMTYPE_FLOAT
)
farray
=
(
float
*
)
Malloc
(
gridsize
*
sizeof
(
float
));
t0
=
timer_val
(
timer_read
);
...
...
@@ -185,13 +181,10 @@ CDIread(void *process)
if
(
nruns
>
1
)
snprintf
(
sinfo
,
sizeof
(
sinfo
),
"(run %d)"
,
irun
+
1
);
print_stat
(
sinfo
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
tw
);
print_stat
(
sinfo
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
tw
);
}
if
(
nruns
>
1
)
print_stat
(
"(mean)"
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
twsum
/
nruns
);
if
(
nruns
>
1
)
print_stat
(
"(mean)"
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
twsum
/
nruns
);
if
(
darray
)
Free
(
darray
);
if
(
farray
)
Free
(
farray
);
...
...
src/CDItest.cc
View file @
e6eeda06
...
...
@@ -115,8 +115,7 @@ CDItest(void *process)
s_utime
=
e_utime
;
s_stime
=
e_stime
;
cdoPrint
(
"Copy number %d: %.2fs %.2fs %.2fs"
,
n
,
c_usertime
,
c_systime
,
c_cputime
);
cdoPrint
(
"Copy number %d: %.2fs %.2fs %.2fs"
,
n
,
c_usertime
,
c_systime
,
c_cputime
);
if
(
n
==
max_copy
)
break
;
}
...
...
src/CDIwrite.cc
View file @
e6eeda06
...
...
@@ -26,8 +26,8 @@ const char *filetypestr(int filetype);
const
char
*
datatypestr
(
int
datatype
);
static
void
print_stat
(
const
char
*
sinfo
,
int
memtype
,
int
datatype
,
int
filetype
,
off_t
nvalues
,
double
data_size
,
double
file_size
,
double
tw
)
print_stat
(
const
char
*
sinfo
,
int
memtype
,
int
datatype
,
int
filetype
,
off_t
nvalues
,
double
data_size
,
double
file_size
,
double
tw
)
{
nvalues
/=
1000000
;
data_size
/=
1024.
*
1024.
*
1024.
;
...
...
@@ -36,19 +36,18 @@ print_stat(const char *sinfo, int memtype, int datatype, int filetype,
if
(
tw
>
0
)
rout
=
nvalues
/
tw
;
if
(
memtype
==
MEMTYPE_FLOAT
)
cdoPrint
(
"%s Wrote %.1f GB of 32 bit floats to %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
rout
);
cdoPrint
(
"%s Wrote %.1f GB of 32 bit floats to %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
rout
);
else
cdoPrint
(
"%s Wrote %.1f GB of 64 bit floats to %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
rout
);
cdoPrint
(
"%s Wrote %.1f GB of 64 bit floats to %s %s, %.1f MVal/s"
,
sinfo
,
data_size
,
datatypestr
(
datatype
),
filetypestr
(
filetype
),
rout
);
file_size
/=
1024.
*
1024.
*
1024.
;
rout
=
0
;
if
(
tw
>
0
)
rout
=
1024
*
file_size
/
tw
;
cdoPrint
(
"%s Wrote %.1f GB in %.1f seconds, total %.1f MB/s"
,
sinfo
,
file_size
,
tw
,
rout
);
cdoPrint
(
"%s Wrote %.1f GB in %.1f seconds, total %.1f MB/s"
,
sinfo
,
file_size
,
tw
,
rout
);
}
void
*
...
...
@@ -73,8 +72,7 @@ CDIwrite(void *process)
cdoInitialize
(
process
);
if
(
cdoVerbose
)
cdoPrint
(
"parameter: <nruns, <grid, <nlevs, <ntimesteps, <nvars>>>>>"
);
if
(
cdoVerbose
)
cdoPrint
(
"parameter: <nruns, <grid, <nlevs, <ntimesteps, <nvars>>>>>"
);
if
(
operatorArgc
()
>
5
)
cdoAbort
(
"Too many arguments!"
);
...
...
@@ -123,8 +121,7 @@ CDIwrite(void *process)
int
gridID2
=
gridID
;
if
(
gridInqType
(
gridID
)
==
GRID_GME
)
gridID2
=
gridToUnstructured
(
gridID
,
0
);
if
(
gridInqType
(
gridID
)
!=
GRID_UNSTRUCTURED
&&
gridInqType
(
gridID
)
!=
GRID_CURVILINEAR
)
if
(
gridInqType
(
gridID
)
!=
GRID_UNSTRUCTURED
&&
gridInqType
(
gridID
)
!=
GRID_CURVILINEAR
)
gridID2
=
gridToCurvilinear
(
gridID
,
0
);
gridInqXvals
(
gridID2
,
&
xvals
[
0
]);
...
...
@@ -233,13 +230,10 @@ CDIwrite(void *process)
if
(
nruns
>
1
)
snprintf
(
sinfo
,
sizeof
(
sinfo
),
"(run %d)"
,
irun
+
1
);
print_stat
(
sinfo
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
tw
);
print_stat
(
sinfo
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
tw
);
}
if
(
nruns
>
1
)
print_stat
(
"(mean)"
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
twsum
/
nruns
);
if
(
nruns
>
1
)
print_stat
(
"(mean)"
,
memtype
,
datatype
,
filetype
,
nvalues
,
data_size
,
file_size
,
twsum
/
nruns
);
vlistDestroy
(
vlistID
);
...
...
src/CMOR.cc
View file @
e6eeda06
This diff is collapsed.
Click to expand it.
src/CMOR_lite.cc
View file @
e6eeda06
...
...
@@ -25,8 +25,7 @@
#include
"config.h"
#endif
#if defined(HAVE_LIBUDUNITS2) \
&& (defined(HAVE_UDUNITS2_H) || defined(HAVE_UDUNITS2_UDUNITS2_H))
#if defined(HAVE_LIBUDUNITS2) && (defined(HAVE_UDUNITS2_H) || defined(HAVE_UDUNITS2_UDUNITS2_H))
#define HAVE_UDUNITS2
#endif
...
...
@@ -100,8 +99,7 @@ cdo_define_var_units(var_t *var, int vlistID2, int varID, const char *units)
}
vlistDefVarUnits
(
vlistID2
,
varID
,
units
);
cdiDefAttTxt
(
vlistID2
,
varID
,
"original_units"
,
(
int
)
strlen
(
units_old
),
units_old
);
cdiDefAttTxt
(
vlistID2
,
varID
,
"original_units"
,
(
int
)
strlen
(
units_old
),
units_old
);
}
}
...
...
@@ -248,13 +246,10 @@ apply_cmorlist(list_t *pmlist, int nvars, int vlistID2, var_t *vars)
lmissval
=
true
;
missval
=
parameter2double
(
kv
->
values
[
0
]);
}
else
if
(
STR_IS_EQ
(
key
,
"table_id"
)
||
STR_IS_EQ
(
key
,
"modeling_realm"
)
||
STR_IS_EQ
(
key
,
"realm"
)
||
STR_IS_EQ
(
key
,
"project_id"
)
||
STR_IS_EQ
(
key
,
"frequency"
))
else
if
(
STR_IS_EQ
(
key
,
"table_id"
)
||
STR_IS_EQ
(
key
,
"modeling_realm"
)
||
STR_IS_EQ
(
key
,
"realm"
)
||
STR_IS_EQ
(
key
,
"project_id"
)
||
STR_IS_EQ
(
key
,
"frequency"
))
{
cdiDefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
key
,
(
int
)
strlen
(
value
),
value
);
cdiDefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
key
,
(
int
)
strlen
(
value
),
value
);
}
}
}
...
...
@@ -276,8 +271,7 @@ apply_cmorlist(list_t *pmlist, int nvars, int vlistID2, var_t *vars)
}
}
list_t
*
kvlist
=
pmlist_search_kvlist_ventry
(
pmlist
,
"name"
,
varname
,
nventry
,
ventry
);
list_t
*
kvlist
=
pmlist_search_kvlist_ventry
(
pmlist
,
"name"
,
varname
,
nventry
,
ventry
);
if
(
kvlist
)
{
bool
lvalid_min
=
false
,
lvalid_max
=
false
;
...
...
@@ -307,16 +301,13 @@ apply_cmorlist(list_t *pmlist, int nvars, int vlistID2, var_t *vars)
if
(
!
STR_IS_EQ
(
var
->
name
,
outname
))
{
vlistDefVarName
(
vlistID2
,
varID
,
outname
);
cdiDefAttTxt
(
vlistID2
,
varID
,
"original_name"
,
(
int
)
strlen
(
var
->
name
),
var
->
name
);
cdiDefAttTxt
(
vlistID2
,
varID
,
"original_name"
,
(
int
)
strlen
(
var
->
name
),
var
->
name
);
}
}
else
if
(
STR_IS_EQ
(
key
,
"param"
))
vlistDefVarParam
(
vlistID2
,
varID
,
stringToParam
(
parameter2word
(
value
)));
vlistDefVarParam
(
vlistID2
,
varID
,
stringToParam
(
parameter2word
(
value
)));
else
if
(
STR_IS_EQ
(
key
,
"out_param"
))
vlistDefVarParam
(
vlistID2
,
varID
,
stringToParam
(
parameter2word
(
value
)));
vlistDefVarParam
(
vlistID2
,
varID
,
stringToParam
(
parameter2word
(
value
)));
else
if
(
STR_IS_EQ
(
key
,
"comment"
))
cdiDefAttTxt
(
vlistID2
,
varID
,
key
,
(
int
)
strlen
(
value
),
value
);
else
if
(
STR_IS_EQ
(
key
,
"cell_methods"
))
...
...
@@ -331,19 +322,15 @@ apply_cmorlist(list_t *pmlist, int nvars, int vlistID2, var_t *vars)
{
var
->
lfactor
=
true
;
var
->
factor
=
parameter2double
(
value
);
if
(
cdoVerbose
)
cdoPrint
(
"%s - scale factor %g"
,
varname
,
var
->
factor
);
if
(
cdoVerbose
)
cdoPrint
(
"%s - scale factor %g"
,
varname
,
var
->
factor
);
}
else
if
(
STR_IS_EQ
(
key
,
"missval"
)
||
STR_IS_EQ
(
key
,
"missing_value"
))
else
if
(
STR_IS_EQ
(
key
,
"missval"
)
||
STR_IS_EQ
(
key
,
"missing_value"
))
{
double
missval
=
parameter2double
(
value
);
double
missval_old
=
vlistInqVarMissval
(
vlistID2
,
varID
);
if
(
!
DBL_IS_EQUAL
(
missval
,
missval_old
))
{
if
(
cdoVerbose
)
cdoPrint
(
"%s - change missval from %g to %g"
,
varname
,
missval_old
,
missval
);
if
(
cdoVerbose
)
cdoPrint
(
"%s - change missval from %g to %g"
,
varname
,
missval_old
,
missval
);
var
->
changemissval
=
true
;
var
->
missval_old
=
missval_old
;
vlistDefVarMissval
(
vlistID2
,
varID
,
missval
);
...
...
@@ -372,13 +359,11 @@ apply_cmorlist(list_t *pmlist, int nvars, int vlistID2, var_t *vars)
else
if
(
STR_IS_EQ
(
key
,
"datatype"
)
||
STR_IS_EQ
(
key
,
"type"
))
{
int
datatype
=
str2datatype
(
parameter2word
(
value
));
if
(
datatype
!=
-
1
)
vlistDefVarDatatype
(
vlistID2
,
varID
,
datatype
);
if
(
datatype
!=
-
1
)
vlistDefVarDatatype
(
vlistID2
,
varID
,
datatype
);
}
else
{
if
(
cdoVerbose
)
cdoPrint
(
"Attribute %s:%s not supported!"
,
varname
,
key
);
if
(
cdoVerbose
)
cdoPrint
(
"Attribute %s:%s not supported!"
,
varname
,
key
);
}
}
...
...
@@ -490,8 +475,7 @@ CMOR_lite(void *process)
var_t
*
var
=
&
vars
[
varID
];
if
(
var
->
convert
==
false
)
var
->
changeunits
=
false
;
if
(
var
->
changeunits
)
cdoConvertUnits
(
&
var
->
ut_converter
,
&
var
->
changeunits
,
(
char
*
)
&
var
->
units
,
(
char
*
)
&
var
->
units_old
,
cdoConvertUnits
(
&
var
->
ut_converter
,
&
var
->
changeunits
,
(
char
*
)
&
var
->
units
,
(
char
*
)
&
var
->
units_old
,
var
->
name
);
}
...
...
@@ -547,8 +531,7 @@ CMOR_lite(void *process)
{
for
(
size_t
i
=
0
;
i
<
gridsize
;
++
i
)
{
if
(
DBL_IS_EQUAL
(
array
[
i
],
var
->
missval_old
))
array
[
i
]
=
missval
;
if
(
DBL_IS_EQUAL
(
array
[
i
],
var
->
missval_old
))
array
[
i
]
=
missval
;
}
}
...
...
@@ -568,8 +551,7 @@ CMOR_lite(void *process)
{
if
(
!
DBL_IS_EQUAL
(
array
[
i
],
missval
))
{
array
[
i
]
=
cv_convert_double
(
(
const
cv_converter
*
)
var
->
ut_converter
,
array
[
i
]);
array
[
i
]
=
cv_convert_double
((
const
cv_converter
*
)
var
->
ut_converter
,
array
[
i
]);
if
(
ut_get_status
()
!=
UT_SUCCESS
)
nerr
++
;
}
}
...
...
src/CMOR_table.cc
View file @
e6eeda06
...
...
@@ -105,19 +105,13 @@ conv_cmor_table(list_t *pmlist)
if
(
vlen
)
{
if
(
strncmp
(
"name"
,
ename
,
len
)
==
0
||
strncmp
(
"standard_name"
,
ename
,
len
)
==
0
||
strncmp
(
"out_name"
,
ename
,
len
)
==
0
||
strncmp
(
"type"
,
ename
,
len
)
==
0
||
strncmp
(
"valid_min"
,
ename
,
len
)
==
0
||
strncmp
(
"valid_max"
,
ename
,
len
)
==
0
||
strncmp
(
"ok_min_mean_abs"
,
ename
,
len
)
==
0
||
strncmp
(
"ok_max_mean_abs"
,
ename
,
len
)
==
0
)
if
(
strncmp
(
"name"
,
ename
,
len
)
==
0
||
strncmp
(
"standard_name"
,
ename
,
len
)
==
0
||
strncmp
(
"out_name"
,
ename
,
len
)
==
0
||
strncmp
(
"type"
,
ename
,
len
)
==
0
||
strncmp
(
"valid_min"
,
ename
,
len
)
==
0
||
strncmp
(
"valid_max"
,
ename
,
len
)
==
0
||
strncmp
(
"ok_min_mean_abs"
,
ename
,
len
)
==
0
||
strncmp
(
"ok_max_mean_abs"
,
ename
,
len
)
==
0
)
printf
(
" %-15s = %s
\n
"
,
ename
,
ovalue
);
else
if
(
strncmp
(
"long_name"
,
ename
,
len
)
==
0
||
strncmp
(
"units"
,
ename
,
len
)
==
0
||
strncmp
(
"cell_methods"
,
ename
,
len
)
==
0
||
strncmp
(
"cell_measures"
,
ename
,
len
)
==
0
else
if
(
strncmp
(
"long_name"
,
ename
,
len
)
==
0
||
strncmp
(
"units"
,
ename
,
len
)
==
0
||
strncmp
(
"cell_methods"
,
ename
,
len
)
==
0
||
strncmp
(
"cell_measures"
,
ename
,
len
)
==
0
||
strncmp
(
"comment"
,
ename
,
len
)
==
0
)
printf
(
" %-15s =
\"
%.*s
\"\n
"
,
ename
,
vlen
,
ovalue
);
}
...
...
src/Cat.cc
View file @
e6eeda06
...
...
@@ -53,8 +53,7 @@ Cat(void *process)
for
(
int
indf
=
0
;
indf
<
nfiles
;
++
indf
)
{
if
(
cdoVerbose
)
cdoPrint
(
"Process file: %s"
,
cdoGetStreamName
(
indf
).
c_str
());
if
(
cdoVerbose
)
cdoPrint
(
"Process file: %s"
,
cdoGetStreamName
(
indf
).
c_str
());
if
(
cdoTimer
)
tw0
=
timer_val
(
timer_cat
);
int
streamID1
=
cdoStreamOpenRead
(
cdoStreamName
(
indf
));
...
...
@@ -69,15 +68,12 @@ Cat(void *process)
if
(
ntsteps
==
1
)
{
for
(
varID
=
0
;
varID
<
nvars
;
++
varID
)
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
!=
TIME_CONSTANT
)
break
;
if
(
vlistInqVarTimetype
(
vlistID1
,
varID
)
!=
TIME_CONSTANT
)
break
;
if
(
varID
==
nvars
)
ntsteps
=
0
;
}
bool
file_exists
=
(
!
cdoOverwriteMode
)
?
fileExists
(
cdoGetStreamName
(
nfiles
).
c_str
())