-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_main_tnumber_test.go
45 lines (39 loc) · 1.15 KB
/
example_main_tnumber_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package gomeos
import (
"fmt"
)
func ExampleTNumberToSpan() {
tf_seq := TFloatIn("{1.2@2022-10-01, 2.3@2022-10-02,3.4@2022-10-03}", &TFloatSeq{})
fs := TNumberToSpan(tf_seq, &FloatSpan{})
fmt.Println(fs.FloatSpanOut(10))
// Output:
// [1.2, 3.4]
}
func ExampleTNumberValueSpans() {
tf_seq := TFloatIn("{1.2@2022-10-01, 2.3@2022-10-02,3.4@2022-10-03}", &TFloatSeq{})
fs := TNumberValueSpans(tf_seq, &FloatSpanSet{})
fmt.Println(fs.FloatSpanSetOut(10))
// Output:
// {[1.2, 1.2], [2.3, 2.3], [3.4, 3.4]}
}
func ExampleTNumberToTBox() {
tf_seq := TFloatIn("{1.2@2022-10-01, 2.3@2022-10-02,3.4@2022-10-03}", &TFloatSeq{})
tbox := TNumberToTBox(tf_seq)
fmt.Println(TBoxOut(tbox, 10))
// Output:
// TBOXFLOAT XT([1.2, 3.4],[2022-10-01 00:00:00+00, 2022-10-03 00:00:00+00])
}
func ExampleTNumberIntegral() {
tf_seq := TFloatIn("{1.2@2022-10-01, 2.3@2022-10-02,3.4@2022-10-03}", &TFloatSeq{})
res := TNumberIntegral(tf_seq)
fmt.Println(res)
// Output:
// 0
}
func ExampleTNumberTwavg() {
tf_seq := TFloatIn("{1.2@2022-10-01, 2.3@2022-10-02,3.4@2022-10-03}", &TFloatSeq{})
res := TNumberTwavg(tf_seq)
fmt.Println(res)
// Output:
// 2.3000000000000003
}