Runstat 4.2 KB
Newer Older
Uwe Schulzweida's avatar
Uwe Schulzweida committed
1
2
3
4
5
6
@BeginModule
@NewPage
@Name      = Runstat
@Title     = Running statistical values
@Section   = Statistical values
@Class     = Statistic
Uwe Schulzweida's avatar
Uwe Schulzweida committed
7
@Arguments = infile outfile
Uwe Schulzweida's avatar
Uwe Schulzweida committed
8
@Operators = runmin runmax runrange runsum runmean runavg runstd runstd1 runvar runvar1
Uwe Schulzweida's avatar
Uwe Schulzweida committed
9
10

@BeginDescription
Uwe Schulzweida's avatar
Uwe Schulzweida committed
11
This module computes running statistical values over a selected number of timesteps. Depending on 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
12
the chosen operator the minimum, maximum, range, sum, average, variance or standard deviation of a selected 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
13
14
number of consecutive timesteps read from @file{infile} is written to @file{outfile}. 
The time of @file{outfile} is determined by the time in the middle of all contributing timesteps of @file{infile}.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
@EndDescription
@EndModule


@BeginOperator_runmin
@Title     = Running minimum
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = min{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
29
o(t+(nts-1)/2,x) = \mbox{\textbf{min}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_runmax
@Title     = Running maximum
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = max{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
46
o(t+(nts-1)/2,x) = \mbox{\textbf{max}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
47
48
49
50
51
52
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@BeginOperator_runrange
@Title     = Running range
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = range{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
o(t+(nts-1)/2,x) = \mbox{\textbf{range}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
70
71
72
73
74
75
76
77
78
79
@BeginOperator_runsum
@Title     = Running sum
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = sum{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
80
o(t+(nts-1)/2,x) = \mbox{\textbf{sum}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_runmean
@Title     = Running mean
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = mean{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
97
o(t+(nts-1)/2,x) = \mbox{\textbf{mean}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_runavg
@Title     = Running average
@Parameter = nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = avg{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
114
o(t+(nts-1)/2,x) = \mbox{\textbf{avg}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
115
116
117
118
119
120
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
121
122
123
124
125
@BeginOperator_runvar
@Title     = Running variance
@Parameter = nts

@BeginDescription
Uwe Schulzweida's avatar
Uwe Schulzweida committed
126
Normalize by n. 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
127

Uwe Schulzweida's avatar
Uwe Schulzweida committed
128
129
130
131
132
@IfMan
o(t+(nts-1)/2,x) = var{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
133
o(t+(nts-1)/2,x) = \mbox{\textbf{var}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
134
135
136
137
138
139
140
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_runvar1
Uwe Schulzweida's avatar
Uwe Schulzweida committed
141
@Title     = Running variance (n-1)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
142
143
144
@Parameter = nts

@BeginDescription
Uwe Schulzweida's avatar
Uwe Schulzweida committed
145
Normalize by (n-1). 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
146
147
148
149
150
151

@IfMan
o(t+(nts-1)/2,x) = var1{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
152
o(t+(nts-1)/2,x) = \mbox{\textbf{var1}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
153
154
155
156
157
158
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
159
160
161
162
163
@BeginOperator_runstd
@Title     = Running standard deviation
@Parameter = nts

@BeginDescription
Uwe Schulzweida's avatar
Uwe Schulzweida committed
164
Normalize by n. 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
165

Uwe Schulzweida's avatar
Uwe Schulzweida committed
166
@IfMan
Uwe Schulzweida's avatar
Uwe Schulzweida committed
167
o(t+(nts-1)/2,x) = std{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
168
169
170
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
171
o(t+(nts-1)/2,x) = \mbox{\textbf{std}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
172
173
174
175
176
177
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
178
@BeginOperator_runstd1
Uwe Schulzweida's avatar
Uwe Schulzweida committed
179
@Title     = Running standard deviation (n-1)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
180
181
182
@Parameter = nts

@BeginDescription
Uwe Schulzweida's avatar
Uwe Schulzweida committed
183
Normalize by (n-1). 
Uwe Schulzweida's avatar
Uwe Schulzweida committed
184
185
186
187
188
189

@IfMan
o(t+(nts-1)/2,x) = std1{i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
Uwe Schulzweida's avatar
Uwe Schulzweida committed
190
o(t+(nts-1)/2,x) = \mbox{\textbf{std1}}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
Uwe Schulzweida's avatar
Uwe Schulzweida committed
191
192
193
194
195
196
@EndMath
@EndifDoc
@EndDescription
@EndOperator


Uwe Schulzweida's avatar
Uwe Schulzweida committed
197
198
@BeginParameter
@Item = nts
Uwe Schulzweida's avatar
Uwe Schulzweida committed
199
INTEGER  Number of timesteps
Uwe Schulzweida's avatar
Uwe Schulzweida committed
200
201
202
@EndParameter


Uwe Schulzweida's avatar
Uwe Schulzweida committed
203
@BeginEnvironment
204
@Item = CDO_TIMESTAT_DATE
Uwe Schulzweida's avatar
Uwe Schulzweida committed
205
Sets the time stamp in outfile to the "first", "middle" or "last" contributing timestep of infile.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
206
207
208
@EndEnvironment


Uwe Schulzweida's avatar
Uwe Schulzweida committed
209
@BeginExample
Uwe Schulzweida's avatar
Uwe Schulzweida committed
210
To compute the running mean over 9 timesteps use:
Uwe Schulzweida's avatar
Uwe Schulzweida committed
211
@BeginVerbatim
Uwe Schulzweida's avatar
Uwe Schulzweida committed
212
   cdo runmean,9 infile outfile
Uwe Schulzweida's avatar
Uwe Schulzweida committed
213
214
@EndVerbatim
@EndExample