1 | #!/bin/bash
|
---|
2 |
|
---|
3 | sqlpw=/home/$USER/.mysql.pw.op
|
---|
4 | dbname=factdata
|
---|
5 |
|
---|
6 | # reference values for corrected R750
|
---|
7 | rates=( 0.0 # 0
|
---|
8 | 0.0 # 1
|
---|
9 | 0.0 # 2
|
---|
10 | 0.0 # 3
|
---|
11 | 0.0 # 4
|
---|
12 | 0.0 # 5
|
---|
13 | 0.0 # 6
|
---|
14 | 260.6 # 7
|
---|
15 | 265.2 # 8
|
---|
16 | 270.9 # 9
|
---|
17 | 291.0 #10
|
---|
18 | 253.1 #11
|
---|
19 | 254.5 #12
|
---|
20 | 239.3 #13
|
---|
21 | 248.7 #14
|
---|
22 | 245.5 #15
|
---|
23 | 265.4 #16
|
---|
24 | 250.1 #17
|
---|
25 | 257.4 #18
|
---|
26 | 253.6 #19
|
---|
27 | 276.4 #20
|
---|
28 | 268.5 #21
|
---|
29 | 261.9 #22
|
---|
30 | 255.7 #23
|
---|
31 | 268.7 #24a
|
---|
32 | 284.4 #25
|
---|
33 | 274.8 #26
|
---|
34 | 271.1 #27
|
---|
35 | 270.0 #28
|
---|
36 | 0.0 #29
|
---|
37 | 248.2 #30
|
---|
38 | 248.2 #31
|
---|
39 | 284.4 #32
|
---|
40 | 284.1 #33
|
---|
41 | 273.8 #34
|
---|
42 | 263.4 #35
|
---|
43 | 258.3 #36
|
---|
44 | 277.0 #37
|
---|
45 | 275.5 #38
|
---|
46 | 283.8 #39
|
---|
47 | 284.7 #40
|
---|
48 | 292.3 #41
|
---|
49 | 292.2 #42
|
---|
50 | 276.5 #43
|
---|
51 | 276.8 #44
|
---|
52 | 272.9 #45
|
---|
53 | 249.1 #46b
|
---|
54 | 249.5 #47
|
---|
55 | 250.4 #48
|
---|
56 | 255.1 #49
|
---|
57 | 266.7 #50
|
---|
58 | 266.0 #51
|
---|
59 | 268.0 #52
|
---|
60 | 258.9 #53
|
---|
61 | 246.2 #54
|
---|
62 | 243.9 #55
|
---|
63 | 240.6 #56
|
---|
64 | 244.8 #57
|
---|
65 | 246.8 #58
|
---|
66 | 239.3 #59
|
---|
67 | 247.3 #60b
|
---|
68 | 248.2 #61
|
---|
69 | 261.5 #62
|
---|
70 | 259.6 #63
|
---|
71 | 248.6 #64
|
---|
72 | 253.1 #65
|
---|
73 | 248.1 #66
|
---|
74 | 237.4 #67
|
---|
75 | 233.6 #68
|
---|
76 | 288.9 #69a
|
---|
77 | 253.0 #70
|
---|
78 | 232.9 #71a
|
---|
79 | 238.7 #72
|
---|
80 | 223.7 #73
|
---|
81 | 215.7 #74
|
---|
82 | 248.2 #75
|
---|
83 | 250.6 #76
|
---|
84 | 254.2 #77
|
---|
85 | 247.4 #78
|
---|
86 | 254.6 #79
|
---|
87 | 248.3 #80
|
---|
88 | 244.0 #81
|
---|
89 | 247.2 #82
|
---|
90 | )
|
---|
91 |
|
---|
92 | for (( i=0; i < ${#rates[@]} ; i++))
|
---|
93 | do
|
---|
94 | if [ "${rates[$i]}" = "0.0" ]
|
---|
95 | then
|
---|
96 | rate="NULL"
|
---|
97 | else
|
---|
98 | rate=${rates[$i]}
|
---|
99 | fi
|
---|
100 | query="UPDATE RunInfo SET fR750Ref="$rate" WHERE fPeriod="$i
|
---|
101 | echo $query
|
---|
102 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
103 | done
|
---|
104 |
|
---|
105 | # several periods are split:
|
---|
106 | # 71b
|
---|
107 | query="UPDATE RunInfo SET fR750Ref=250.0 WHERE fPeriod=69 AND fNight>20170726"
|
---|
108 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
109 | # 69b
|
---|
110 | query="UPDATE RunInfo SET fR750Ref=253.0 WHERE fPeriod=69 AND fNight>20170524"
|
---|
111 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
112 | # 60a
|
---|
113 | query="UPDATE RunInfo SET fR750Ref=239.3 WHERE fPeriod=60 AND fNight<20170901"
|
---|
114 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
115 | # 46a
|
---|
116 | query="UPDATE RunInfo SET fR750Ref=271 WHERE fPeriod=46 AND fNight<20150716"
|
---|
117 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
118 | # 24b
|
---|
119 | query="UPDATE RunInfo SET fR750Ref=286.2 WHERE fPeriod=24 AND fNight>20131003"
|
---|
120 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
121 |
|
---|
122 | zd="cos(fZenithDistanceMean/180*Pi())"
|
---|
123 | min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60"
|
---|
124 | cor="pow("$zd", 1.94)*exp((1-1/"$zd")*0.331)*exp(2.39*(1-"$zd"))"
|
---|
125 |
|
---|
126 | # fill corrected R750
|
---|
127 | query="UPDATE RunInfo SET "
|
---|
128 | query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) "
|
---|
129 | query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0"
|
---|
130 | echo $query
|
---|
131 | mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
|
---|
132 |
|
---|