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
30c333d6
Commit
30c333d6
authored
Feb 06, 2012
by
Uwe Schulzweida
Browse files
use hour_of_year()
parent
9a68a8c4
Changes
8
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
30c333d6
...
...
@@ -441,6 +441,7 @@ src/Ydaypctl.c -text
src/Ydaystat.c -text
src/Ydrunpctl.c -text
src/Ydrunstat.c -text
src/Yhourarith.c -text
src/Yhourstat.c -text
src/Ymonarith.c -text
src/Ymonpctl.c -text
...
...
src/Makefile.am
View file @
30c333d6
...
...
@@ -162,6 +162,7 @@ cdo_SOURCES += Arith.c \
Ydaystat.c
\
Ydrunpctl.c
\
Ydrunstat.c
\
Yhourarith.c
\
Yhourstat.c
\
Ymonarith.c
\
Ymonpctl.c
\
...
...
src/Makefile.in
View file @
30c333d6
...
...
@@ -129,16 +129,17 @@ am_cdo_OBJECTS = cdo-cdo.$(OBJEXT) cdo-Arith.$(OBJEXT) \
cdo-Writegrid.
$(OBJEXT)
cdo-Writerandom.
$(OBJEXT)
\
cdo-Ydayarith.
$(OBJEXT)
cdo-Ydaypctl.
$(OBJEXT)
\
cdo-Ydaystat.
$(OBJEXT)
cdo-Ydrunpctl.
$(OBJEXT)
\
cdo-Ydrunstat.
$(OBJEXT)
cdo-Yhourstat.
$(OBJEXT)
\
cdo-Ymonarith.
$(OBJEXT)
cdo-Ymonpctl.
$(OBJEXT)
\
cdo-Ymonstat.
$(OBJEXT)
cdo-Yseaspctl.
$(OBJEXT)
\
cdo-Yseasstat.
$(OBJEXT)
cdo-Zonstat.
$(OBJEXT)
\
cdo-cdo_pthread.
$(OBJEXT)
cdo-cdo_vlist.
$(OBJEXT)
\
cdo-color.
$(OBJEXT)
cdo-commandline.
$(OBJEXT)
\
cdo-ecacore.
$(OBJEXT)
cdo-ecautil.
$(OBJEXT)
\
cdo-exception.
$(OBJEXT)
cdo-expr.
$(OBJEXT)
\
cdo-expr_lex.
$(OBJEXT)
cdo-expr_yacc.
$(OBJEXT)
\
cdo-field.
$(OBJEXT)
cdo-field2.
$(OBJEXT)
cdo-fieldc.
$(OBJEXT)
\
cdo-Ydrunstat.
$(OBJEXT)
cdo-Yhourarith.
$(OBJEXT)
\
cdo-Yhourstat.
$(OBJEXT)
cdo-Ymonarith.
$(OBJEXT)
\
cdo-Ymonpctl.
$(OBJEXT)
cdo-Ymonstat.
$(OBJEXT)
\
cdo-Yseaspctl.
$(OBJEXT)
cdo-Yseasstat.
$(OBJEXT)
\
cdo-Zonstat.
$(OBJEXT)
cdo-cdo_pthread.
$(OBJEXT)
\
cdo-cdo_vlist.
$(OBJEXT)
cdo-color.
$(OBJEXT)
\
cdo-commandline.
$(OBJEXT)
cdo-ecacore.
$(OBJEXT)
\
cdo-ecautil.
$(OBJEXT)
cdo-exception.
$(OBJEXT)
\
cdo-expr.
$(OBJEXT)
cdo-expr_lex.
$(OBJEXT)
\
cdo-expr_yacc.
$(OBJEXT)
cdo-field.
$(OBJEXT)
\
cdo-field2.
$(OBJEXT)
cdo-fieldc.
$(OBJEXT)
\
cdo-fieldmem.
$(OBJEXT)
cdo-fieldmer.
$(OBJEXT)
\
cdo-fieldzon.
$(OBJEXT)
cdo-fouriertrans.
$(OBJEXT)
\
cdo-gradsdeslib.
$(OBJEXT)
cdo-grid.
$(OBJEXT)
\
...
...
@@ -370,13 +371,13 @@ cdo_SOURCES = cdo.c Arith.c Arithc.c Arithdays.c Arithlat.c CDItest.c \
Transpose.c Trend.c Trms.c Tstepcount.c Vardup.c Vargen.c
\
Varrms.c Vertint.c Vertstat.c Vertwind.c Wct.c Wind.c
\
Writegrid.c Writerandom.c Ydayarith.c Ydaypctl.c Ydaystat.c
\
Ydrunpctl.c Ydrunstat.c Yhourstat.c Ymonarith.c
Ymonpctl.c
\
Ymonstat.c Yseaspctl.c Yseasstat.c Zonstat.c cdo.h
cdo_int.h
\
cdo_pthread.c cdo_vlist.c color.c color.h
commandline.c
\
counter.h dmemory.h dtypes.h ecacore.c ecacore.h
ecautil.c
\
ecautil.h error.h etopo.h temp.h mask.h exception.c
expr.c
\
expr.h expr_lex.c expr_yacc.c expr_yacc.h field.c
field.h
\
field2.c fieldc.c fieldmem.c fieldmer.c fieldzon.c
\
Ydrunpctl.c Ydrunstat.c
Yhourarith.c
Yhourstat.c Ymonarith.c
\
Ymonpctl.c
Ymonstat.c Yseaspctl.c Yseasstat.c Zonstat.c cdo.h
\
cdo_int.h
cdo_pthread.c cdo_vlist.c color.c color.h
\
commandline.c
counter.h dmemory.h dtypes.h ecacore.c ecacore.h
\
ecautil.c
ecautil.h error.h etopo.h temp.h mask.h exception.c
\
expr.c
expr.h expr_lex.c expr_yacc.c expr_yacc.h field.c
\
field.h
field2.c fieldc.c fieldmem.c fieldmer.c fieldzon.c
\
fouriertrans.c functs.h gradsdeslib.c gradsdeslib.h grid.c
\
grid.h grid_gme.c grid_lcc.c grid_rot.c griddes.c griddes.h
\
griddes_h5.c griddes_nc.c hetaeta.c hetaeta.h history.c
\
...
...
@@ -676,6 +677,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Ydaystat.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Ydrunpctl.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Ydrunstat.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Yhourarith.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Yhourstat.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Ymonarith.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/cdo-Ymonpctl.Po@am__quote@
...
...
@@ -3002,6 +3004,20 @@ cdo-Ydrunstat.obj: Ydrunstat.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@
DEPDIR
=
$(DEPDIR)
$(CCDEPMODE)
$(depcomp)
@AMDEPBACKSLASH@
@am__fastdepCC_FALSE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-c
-o
cdo-Ydrunstat.obj
`if
test
-f
'Ydrunstat.c'
;
then
$(CYGPATH_W)
'Ydrunstat.c'
;
else
$(CYGPATH_W)
'$(srcdir)/Ydrunstat.c'
;
fi`
cdo-Yhourarith.o
:
Yhourarith.c
@am__fastdepCC_TRUE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-MT
cdo-Yhourarith.o
-MD
-MP
-MF
$(DEPDIR)/cdo-Yhourarith.Tpo
-c
-o
cdo-Yhourarith.o
`test
-f
'Yhourarith.c'
||
echo
'$(srcdir)/'
`Yhourarith.c
@am__fastdepCC_TRUE@
$(am__mv)
$(DEPDIR)/cdo-Yhourarith.Tpo
$(DEPDIR)/cdo-Yhourarith.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@
source
=
'Yhourarith.c'
object
=
'cdo-Yhourarith.o'
libtool
=
no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@
DEPDIR
=
$(DEPDIR)
$(CCDEPMODE)
$(depcomp)
@AMDEPBACKSLASH@
@am__fastdepCC_FALSE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-c
-o
cdo-Yhourarith.o
`test
-f
'Yhourarith.c'
||
echo
'$(srcdir)/'
`Yhourarith.c
cdo-Yhourarith.obj
:
Yhourarith.c
@am__fastdepCC_TRUE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-MT
cdo-Yhourarith.obj
-MD
-MP
-MF
$(DEPDIR)/cdo-Yhourarith.Tpo
-c
-o
cdo-Yhourarith.obj
`if
test
-f
'Yhourarith.c'
;
then
$(CYGPATH_W)
'Yhourarith.c'
;
else
$(CYGPATH_W)
'$(srcdir)/Yhourarith.c'
;
fi`
@am__fastdepCC_TRUE@
$(am__mv)
$(DEPDIR)/cdo-Yhourarith.Tpo
$(DEPDIR)/cdo-Yhourarith.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@
source
=
'Yhourarith.c'
object
=
'cdo-Yhourarith.obj'
libtool
=
no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@
DEPDIR
=
$(DEPDIR)
$(CCDEPMODE)
$(depcomp)
@AMDEPBACKSLASH@
@am__fastdepCC_FALSE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-c
-o
cdo-Yhourarith.obj
`if
test
-f
'Yhourarith.c'
;
then
$(CYGPATH_W)
'Yhourarith.c'
;
else
$(CYGPATH_W)
'$(srcdir)/Yhourarith.c'
;
fi`
cdo-Yhourstat.o
:
Yhourstat.c
@am__fastdepCC_TRUE@
$(CC)
$(DEFS)
$(DEFAULT_INCLUDES)
$(INCLUDES)
$(cdo_CPPFLAGS)
$(CPPFLAGS)
$(AM_CFLAGS)
$(CFLAGS)
-MT
cdo-Yhourstat.o
-MD
-MP
-MF
$(DEPDIR)/cdo-Yhourstat.Tpo
-c
-o
cdo-Yhourstat.o
`test
-f
'Yhourstat.c'
||
echo
'$(srcdir)/'
`Yhourstat.c
@am__fastdepCC_TRUE@
$(am__mv)
$(DEPDIR)/cdo-Yhourstat.Tpo
$(DEPDIR)/cdo-Yhourstat.Po
...
...
src/Mergetime.c
View file @
30c333d6
...
...
@@ -158,7 +158,7 @@ void *Mergetime(void *argument)
char
vdatestr
[
32
],
vtimestr
[
32
];
date2str
(
vdate
,
vdatestr
,
sizeof
(
vdatestr
));
time2str
(
vtime
,
vtimestr
,
sizeof
(
vtimestr
));
cdoPrint
(
"Timestep %4d in stream %d (%s %s) already exist, skipped!"
,
sf
[
fileID
].
tsID
,
sf
[
fileID
].
streamID
,
vdatestr
,
vtimestr
);
cdoPrint
(
"Timestep %4d in stream %d (%s %s) already exist, skipped!"
,
sf
[
fileID
].
tsID
+
1
,
sf
[
fileID
].
streamID
,
vdatestr
,
vtimestr
);
goto
SKIP_TIMESTEP
;
}
...
...
src/Yhourarith.c
0 → 100644
View file @
30c333d6
/*
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2012 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
/*
This module contains the following operators:
Yhourarith yhouradd Add multi-year hourly time series
Yhourarith yhoursub Subtract multi-year hourly time series
Yhourarith yhourmul Multiply multi-year hourly time series
Yhourarith yhourdiv Divide multi-year hourly time series
*/
#include
<cdi.h>
#include
"cdo.h"
#include
"cdo_int.h"
#include
"pstream.h"
#define MAX_HOUR 9301
/* 31*12*25 + 1 */
static
int
hour_of_year
(
int
vdate
,
int
vtime
)
{
int
year
,
month
,
day
,
houroy
;
int
hour
,
minute
,
second
;
cdiDecodeDate
(
vdate
,
&
year
,
&
month
,
&
day
);
cdiDecodeTime
(
vtime
,
&
hour
,
&
minute
,
&
second
);
if
(
month
>=
1
&&
month
<=
12
&&
day
>=
1
&&
day
<=
31
&&
hour
>=
0
&&
hour
<
24
)
houroy
=
((
month
-
1
)
*
31
+
day
-
1
)
*
25
+
hour
+
1
;
else
houroy
=
0
;
if
(
houroy
<
0
||
houroy
>=
MAX_HOUR
)
{
char
vdatestr
[
32
],
vtimestr
[
32
];
date2str
(
vdate
,
vdatestr
,
sizeof
(
vdatestr
));
time2str
(
vtime
,
vtimestr
,
sizeof
(
vtimestr
));
cdoAbort
(
"Hour of year %d out of range (%s %s)!"
,
houroy
,
vdatestr
,
vtimestr
);
}
return
(
houroy
);
}
void
*
Yhourarith
(
void
*
argument
)
{
int
operatorID
;
int
operfunc
;
int
streamID1
,
streamID2
,
streamID3
;
int
gridsize
;
int
nrecs
,
nvars
,
nlev
,
recID
;
int
tsID
;
int
varID
,
levelID
;
int
offset
;
int
vlistID1
,
vlistID2
,
vlistID3
;
int
taxisID1
,
taxisID2
,
taxisID3
;
int
vdate
,
vtime
;
int
houroy
;
field_t
field1
,
field2
;
int
**
varnmiss2
[
MAX_HOUR
];
double
**
vardata2
[
MAX_HOUR
];
cdoInitialize
(
argument
);
cdoOperatorAdd
(
"yhouradd"
,
func_add
,
0
,
NULL
);
cdoOperatorAdd
(
"yhoursub"
,
func_sub
,
0
,
NULL
);
cdoOperatorAdd
(
"yhourmul"
,
func_mul
,
0
,
NULL
);
cdoOperatorAdd
(
"yhourdiv"
,
func_div
,
0
,
NULL
);
operatorID
=
cdoOperatorID
();
operfunc
=
cdoOperatorF1
(
operatorID
);
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
streamID2
=
streamOpenRead
(
cdoStreamName
(
1
));
vlistID1
=
streamInqVlist
(
streamID1
);
vlistID2
=
streamInqVlist
(
streamID2
);
vlistID3
=
vlistDuplicate
(
vlistID1
);
vlistCompare
(
vlistID1
,
vlistID2
,
CMP_ALL
);
gridsize
=
vlistGridsizeMax
(
vlistID1
);
field1
.
ptr
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
field2
.
ptr
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
taxisID1
=
vlistInqTaxis
(
vlistID1
);
taxisID2
=
vlistInqTaxis
(
vlistID2
);
taxisID3
=
taxisDuplicate
(
taxisID1
);
vlistDefTaxis
(
vlistID3
,
taxisID3
);
streamID3
=
streamOpenWrite
(
cdoStreamName
(
2
),
cdoFiletype
());
streamDefVlist
(
streamID3
,
vlistID3
);
nvars
=
vlistNvars
(
vlistID2
);
for
(
houroy
=
0
;
houroy
<
MAX_HOUR
;
++
houroy
)
vardata2
[
houroy
]
=
NULL
;
tsID
=
0
;
while
(
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
))
)
{
vdate
=
taxisInqVdate
(
taxisID2
);
vtime
=
taxisInqVtime
(
taxisID2
);
houroy
=
hour_of_year
(
vdate
,
vtime
);
if
(
vardata2
[
houroy
]
!=
NULL
)
cdoAbort
(
"Hour of year %d already allocatd!"
,
houroy
);
vardata2
[
houroy
]
=
(
double
**
)
malloc
(
nvars
*
sizeof
(
double
*
));
varnmiss2
[
houroy
]
=
(
int
**
)
malloc
(
nvars
*
sizeof
(
int
*
));
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID
));
nlev
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID2
,
varID
));
vardata2
[
houroy
][
varID
]
=
(
double
*
)
malloc
(
nlev
*
gridsize
*
sizeof
(
double
));
varnmiss2
[
houroy
][
varID
]
=
(
int
*
)
malloc
(
nlev
*
sizeof
(
int
));
}
for
(
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
streamInqRecord
(
streamID2
,
&
varID
,
&
levelID
);
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID
));
offset
=
gridsize
*
levelID
;
streamReadRecord
(
streamID2
,
vardata2
[
houroy
][
varID
]
+
offset
,
&
field2
.
nmiss
);
varnmiss2
[
houroy
][
varID
][
levelID
]
=
field2
.
nmiss
;
}
tsID
++
;
}
tsID
=
0
;
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
))
)
{
vdate
=
taxisInqVdate
(
taxisID1
);
vtime
=
taxisInqVtime
(
taxisID1
);
houroy
=
hour_of_year
(
vdate
,
vtime
);
if
(
vardata2
[
houroy
]
==
NULL
)
cdoAbort
(
"Hour of year %d not found!"
,
houroy
);
taxisDefVdate
(
taxisID3
,
vdate
);
taxisDefVtime
(
taxisID3
,
vtime
);
streamDefTimestep
(
streamID3
,
tsID
);
for
(
recID
=
0
;
recID
<
nrecs
;
recID
++
)
{
streamInqRecord
(
streamID1
,
&
varID
,
&
levelID
);
streamReadRecord
(
streamID1
,
field1
.
ptr
,
&
field1
.
nmiss
);
gridsize
=
gridInqSize
(
vlistInqVarGrid
(
vlistID2
,
varID
));
offset
=
gridsize
*
levelID
;
memcpy
(
field2
.
ptr
,
vardata2
[
houroy
][
varID
]
+
offset
,
gridsize
*
sizeof
(
double
));
field2
.
nmiss
=
varnmiss2
[
houroy
][
varID
][
levelID
];
field1
.
grid
=
vlistInqVarGrid
(
vlistID1
,
varID
);
field1
.
missval
=
vlistInqVarMissval
(
vlistID1
,
varID
);
field2
.
grid
=
vlistInqVarGrid
(
vlistID2
,
varID
);
field2
.
missval
=
vlistInqVarMissval
(
vlistID2
,
varID
);
farfun
(
&
field1
,
field2
,
operfunc
);
streamDefRecord
(
streamID3
,
varID
,
levelID
);
streamWriteRecord
(
streamID3
,
field1
.
ptr
,
field1
.
nmiss
);
}
tsID
++
;
}
streamClose
(
streamID3
);
streamClose
(
streamID2
);
streamClose
(
streamID1
);
for
(
houroy
=
0
;
houroy
<
MAX_HOUR
;
++
houroy
)
if
(
vardata2
[
houroy
]
)
{
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
free
(
vardata2
[
houroy
][
varID
]);
free
(
varnmiss2
[
houroy
][
varID
]);
}
free
(
vardata2
[
houroy
]);
free
(
varnmiss2
[
houroy
]);
}
if
(
field1
.
ptr
)
free
(
field1
.
ptr
);
if
(
field2
.
ptr
)
free
(
field2
.
ptr
);
cdoFinish
();
return
(
0
);
}
src/Yhourstat.c
View file @
30c333d6
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-201
1
Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-201
2
Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -33,7 +33,32 @@
#include
"pstream.h"
#define NHOUR 8952
/* 31*12*24 */
#define MAX_HOUR 9301
/* 31*12*25 + 1 */
static
int
hour_of_year
(
int
vdate
,
int
vtime
)
{
int
year
,
month
,
day
,
houroy
;
int
hour
,
minute
,
second
;
cdiDecodeDate
(
vdate
,
&
year
,
&
month
,
&
day
);
cdiDecodeTime
(
vtime
,
&
hour
,
&
minute
,
&
second
);
if
(
month
>=
1
&&
month
<=
12
&&
day
>=
1
&&
day
<=
31
&&
hour
>=
0
&&
hour
<
24
)
houroy
=
((
month
-
1
)
*
31
+
day
-
1
)
*
25
+
hour
+
1
;
else
houroy
=
0
;
if
(
houroy
<
0
||
houroy
>=
MAX_HOUR
)
{
char
vdatestr
[
32
],
vtimestr
[
32
];
date2str
(
vdate
,
vdatestr
,
sizeof
(
vdatestr
));
time2str
(
vtime
,
vtimestr
,
sizeof
(
vtimestr
));
cdoAbort
(
"Hour of year %d out of range (%s %s)!"
,
houroy
,
vdatestr
,
vtimestr
);
}
return
(
houroy
);
}
void
*
Yhourstat
(
void
*
argument
)
...
...
@@ -46,21 +71,20 @@ void *Yhourstat(void *argument)
int
recID
;
int
gridID
;
int
vdate
,
vtime
;
int
year
,
month
,
day
,
houroy
;
int
hour
,
minute
,
second
;
int
houroy
;
int
nrecs
,
nrecords
;
int
levelID
;
int
tsID
;
int
otsID
;
long
nsets
[
N
HOUR
];
long
nsets
[
MAX_
HOUR
];
int
streamID1
,
streamID2
;
int
vlistID1
,
vlistID2
,
taxisID1
,
taxisID2
;
int
nmiss
;
int
nvars
,
nlevel
;
int
*
recVarID
,
*
recLevelID
;
int
vdates
[
N
HOUR
],
vtimes
[
N
HOUR
];
int
vdates
[
MAX_
HOUR
],
vtimes
[
MAX_
HOUR
];
double
missval
;
field_t
**
vars1
[
N
HOUR
],
**
vars2
[
N
HOUR
],
**
samp1
[
N
HOUR
];
field_t
**
vars1
[
MAX_
HOUR
],
**
vars2
[
MAX_
HOUR
],
**
samp1
[
MAX_
HOUR
];
field_t
field
;
cdoInitialize
(
argument
);
...
...
@@ -76,7 +100,7 @@ void *Yhourstat(void *argument)
operatorID
=
cdoOperatorID
();
operfunc
=
cdoOperatorF1
(
operatorID
);
for
(
houroy
=
0
;
houroy
<
N
HOUR
;
houroy
++
)
for
(
houroy
=
0
;
houroy
<
MAX_
HOUR
;
++
houroy
)
{
vars1
[
houroy
]
=
NULL
;
vars2
[
houroy
]
=
NULL
;
...
...
@@ -115,16 +139,7 @@ void *Yhourstat(void *argument)
if
(
cdoVerbose
)
cdoPrint
(
"process timestep: %d %d %d"
,
tsID
+
1
,
vdate
,
vtime
);
cdiDecodeDate
(
vdate
,
&
year
,
&
month
,
&
day
);
cdiDecodeTime
(
vtime
,
&
hour
,
&
minute
,
&
second
);
if
(
month
>=
1
&&
month
<=
12
&&
hour
>=
0
&&
hour
<
24
)
houroy
=
((
month
-
1
)
*
31
+
day
-
1
)
*
24
+
hour
;
else
houroy
=
0
;
if
(
houroy
<
0
||
houroy
>=
NHOUR
)
cdoAbort
(
"hour of year %d out of range (date=%d time=%d)!"
,
houroy
,
vdate
,
vtime
);
houroy
=
hour_of_year
(
vdate
,
vtime
);
vdates
[
houroy
]
=
vdate
;
vtimes
[
houroy
]
=
vtime
;
...
...
@@ -245,7 +260,7 @@ void *Yhourstat(void *argument)
tsID
++
;
}
for
(
houroy
=
0
;
houroy
<
N
HOUR
;
houroy
++
)
for
(
houroy
=
0
;
houroy
<
MAX_
HOUR
;
++
houroy
)
if
(
nsets
[
houroy
]
)
{
if
(
operfunc
==
func_mean
||
operfunc
==
func_avg
)
...
...
@@ -305,7 +320,7 @@ void *Yhourstat(void *argument)
otsID
++
;
}
for
(
houroy
=
0
;
houroy
<
N
HOUR
;
houroy
++
)
for
(
houroy
=
0
;
houroy
<
MAX_
HOUR
;
++
houroy
)
{
if
(
vars1
[
houroy
]
!=
NULL
)
{
...
...
src/modules.c
View file @
30c333d6
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-201
1
Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-201
2
Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -192,12 +192,13 @@ void *Vertwind(void *argument);
void
*
Wind
(
void
*
argument
);
void
*
Writegrid
(
void
*
argument
);
void
*
Writerandom
(
void
*
argument
);
void
*
Yhourstat
(
void
*
argument
);
void
*
Ydayarith
(
void
*
argument
);
void
*
Ydaypctl
(
void
*
argument
);
void
*
Ydaystat
(
void
*
argument
);
void
*
Ydrunpctl
(
void
*
argument
);
void
*
Ydrunstat
(
void
*
argument
);
void
*
Yhourarith
(
void
*
argument
);
void
*
Yhourstat
(
void
*
argument
);
void
*
Ymonarith
(
void
*
argument
);
void
*
Ymonpctl
(
void
*
argument
);
void
*
Ymonstat
(
void
*
argument
);
...
...
@@ -292,7 +293,8 @@ void *Wct(void *argument);
#define FilterOperators {"bandpass", "highpass", "lowpass"}
#define FldrmsOperators {"fldrms"}
#define FldstatOperators {"fldmin", "fldmax", "fldsum", "fldmean", "fldavg", "fldvar", "fldstd", "fldpctl"}
#define Fldstat2Operators {"fldcor", "fldcovar"}
#define FldcorOperators {"fldcor"}
#define FldcovarOperators {"fldcovar"}
#define FourierOperators {"fourier"}
#define GatherOperators {"gather"}
#define GengridOperators {"gengrid"}
...
...
@@ -414,7 +416,8 @@ void *Wct(void *argument);
#define MonstatOperators {"monmin", "monmax", "monsum", "monmean", "monavg", "monvar", "monstd"}
#define DaystatOperators {"daymin", "daymax", "daysum", "daymean", "dayavg", "dayvar", "daystd"}
#define HourstatOperators {"hourmin", "hourmax", "hoursum", "hourmean", "houravg", "hourvar", "hourstd"}
#define Timstat2Operators {"timcor", "timcovar"}
#define TimcorOperators {"timcor"}
#define TimcovarOperators {"timcovar"}
#define Timstat3Operators {"meandiff2test", "varquot2test"}
#define TinfoOperators {"tinfo"}
#define TocomplexOperators {"retocomplex", "imtocomplex"}
...
...
@@ -432,12 +435,13 @@ void *Wct(void *argument);
#define WindOperators {"uv2dv", "uv2dvl", "dv2uv", "dv2uvl", "dv2ps"}
#define WritegridOperators {"writegrid"}
#define WriterandomOperators {"writerandom"}
#define YhourstatOperators {"yhourmin", "yhourmax", "yhoursum", "yhourmean", "yhouravg", "yhourvar", "yhourstd"}
#define YdayarithOperators {"ydayadd", "ydaysub", "ydaymul", "ydaydiv"}
#define YdaypctlOperators {"ydaypctl"}
#define YdaystatOperators {"ydaymin", "ydaymax", "ydaysum", "ydaymean", "ydayavg", "ydayvar", "ydaystd"}
#define YdrunpctlOperators {"ydrunpctl"}
#define YdrunstatOperators {"ydrunmin", "ydrunmax", "ydrunsum", "ydrunmean", "ydrunavg", "ydrunvar", "ydrunstd"}
#define YhourarithOperators {"yhouradd", "yhoursub", "yhourmul", "yhourdiv"}
#define YhourstatOperators {"yhourmin", "yhourmax", "yhoursum", "yhourmean", "yhouravg", "yhourvar", "yhourstd"}
#define YmonarithOperators {"ymonadd", "ymonsub", "ymonmul", "ymondiv"}
#define YmonpctlOperators {"ymonpctl"}
#define YmonstatOperators {"ymonmin", "ymonmax", "ymonsum", "ymonmean", "ymonavg", "ymonvar", "ymonstd"}
...
...
@@ -539,7 +543,8 @@ static modules_t Modules[] =
{
Filter
,
FilterHelp
,
FilterOperators
,
CDI_REAL
,
1
,
1
},
{
Fldrms
,
NULL
,
FldrmsOperators
,
CDI_REAL
,
2
,
1
},
{
Fldstat
,
FldstatHelp
,
FldstatOperators
,
CDI_REAL
,
1
,
1
},
{
Fldstat2
,
FldcorHelp
,
Fldstat2Operators
,
CDI_REAL
,
2
,
1
},
{
Fldstat2
,
FldcorHelp
,
FldcorOperators
,
CDI_REAL
,
2
,
1
},
{
Fldstat2
,
FldcovarHelp
,
FldcovarOperators
,
CDI_REAL
,
2
,
1
},
{
Fourier
,
NULL
,
FourierOperators
,
CDI_COMP
,
1
,
1
},
{
Gather
,
NULL
,
GatherOperators
,
CDI_REAL
,
-
1
,
1
},
{
Gengrid
,
NULL
,
GengridOperators
,
CDI_REAL
,
2
,
1
},
...
...
@@ -651,7 +656,8 @@ static modules_t Modules[] =
{
Timstat
,
MonstatHelp
,
MonstatOperators
,
CDI_REAL
,
1
,
1
},
{
Timstat
,
DaystatHelp
,
DaystatOperators
,
CDI_REAL
,
1
,
1
},
{
Timstat
,
HourstatHelp
,
HourstatOperators
,
CDI_REAL
,
1
,
1
},
{
Timstat2
,
TimcorHelp
,
Timstat2Operators
,
CDI_REAL
,
2
,
1
},
{
Timstat2
,
TimcorHelp
,
TimcorOperators
,
CDI_REAL
,
2
,
1
},
{
Timstat2
,
TimcovarHelp
,
TimcovarOperators
,
CDI_REAL
,
2
,
1
},
{
Timstat3
,
NULL
,
Timstat3Operators
,
CDI_REAL
,
2
,
1
},
{
Tinfo
,
NULL
,
TinfoOperators
,
CDI_BOTH
,
1
,
0
},
{
Tocomplex
,
NULL
,
TocomplexOperators
,
CDI_REAL
,
1
,
1
},
...
...
@@ -668,12 +674,13 @@ static modules_t Modules[] =
{
Wind
,
WindHelp
,
WindOperators
,
CDI_REAL
,
1
,
1
},
{
Writegrid
,
NULL
,
WritegridOperators
,
CDI_REAL
,
1
,
1
},
/* no cdi output */
{
Writerandom
,
NULL
,
WriterandomOperators
,
CDI_REAL
,
1
,
1
},
{
Yhourstat
,
YhourstatHelp
,
YhourstatOperators
,
CDI_REAL
,
1
,
1
},
{
Ydayarith
,
YdayarithHelp
,
YdayarithOperators
,
CDI_REAL
,
2
,
1
},
{
Ydaypctl
,
YdaypctlHelp
,
YdaypctlOperators
,
CDI_REAL
,
3
,
1
},
{
Ydaystat
,
YdaystatHelp
,
YdaystatOperators
,
CDI_REAL
,
1
,
1
},
{
Ydrunpctl
,
YdrunpctlHelp
,
YdrunpctlOperators
,
CDI_REAL
,
3
,
1
},
{
Ydrunstat
,
YdrunstatHelp
,
YdrunstatOperators
,
CDI_REAL
,
1
,
1
},
{
Yhourarith
,
NULL
,
YhourarithOperators
,
CDI_REAL
,
2
,
1
},
{
Yhourstat
,
YhourstatHelp
,
YhourstatOperators
,
CDI_REAL
,
1
,
1
},
{
Ymonarith
,
YmonarithHelp
,
YmonarithOperators
,
CDI_REAL
,
2
,
1
},
{
Ymonpctl
,
YmonpctlHelp
,
YmonpctlOperators
,
CDI_REAL
,
3
,
1
},
{
Ymonstat
,
YmonstatHelp
,
YmonstatOperators
,
CDI_REAL
,
1
,
1
},
...
...
src/operator_help.h
View file @
30c333d6
...
...
@@ -243,6 +243,10 @@ static char *MergeHelp[] = {
" on different timesteps."
,
" After this operation every input timestep is in ofile and"
,
" all timesteps are sorted by date and time."
,
""
,
"ENVIRONMENT"
,
" SKIP_SAME_TIME"
,
" If set to 1, skips all timesteps with a double entry of the same timestamp."
,
NULL
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment