source: trunk/DataCheck/Tools/fill_r750.sh@ 19272

Last change on this file since 19272 was 19228, checked in by Daniela Dorner, 6 years ago
added reference values for last periods
  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2
3sqlpw=/home/$USER/.mysql.pw.op
4dbname=factdata
5
6# reference values for corrected R750
7rates=( 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.3 #82
90 245.2 #83
91 236.0 #84
92 231.6 #85
93 )
94
95for (( i=0; i < ${#rates[@]} ; i++))
96do
97 if [ "${rates[$i]}" = "0.0" ]
98 then
99 rate="NULL"
100 else
101 rate=${rates[$i]}
102 fi
103 query="UPDATE RunInfo SET fR750Ref="$rate" WHERE fPeriod="$i
104 echo $query
105 mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
106done
107
108# several periods are split:
109# 71b
110query="UPDATE RunInfo SET fR750Ref=250.0 WHERE fPeriod=69 AND fNight>20170726"
111mysql --defaults-file=$sqlpw -s -e "$query"
112# 69b
113query="UPDATE RunInfo SET fR750Ref=253.0 WHERE fPeriod=69 AND fNight>20170524"
114mysql --defaults-file=$sqlpw -s -e "$query"
115# 60a
116query="UPDATE RunInfo SET fR750Ref=239.3 WHERE fPeriod=60 AND fNight<20170901"
117mysql --defaults-file=$sqlpw -s -e "$query"
118# 46a
119query="UPDATE RunInfo SET fR750Ref=271 WHERE fPeriod=46 AND fNight<20150716"
120mysql --defaults-file=$sqlpw -s -e "$query"
121# 24b
122query="UPDATE RunInfo SET fR750Ref=286.2 WHERE fPeriod=24 AND fNight>20131003"
123mysql --defaults-file=$sqlpw -s -e "$query"
124
125zd="cos(fZenithDistanceMean/180*Pi())"
126min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60"
127cor="pow("$zd", 1.94)*exp((1-1/"$zd")*0.331)*exp(2.39*(1-"$zd"))"
128
129# fill corrected R750
130query="UPDATE RunInfo SET "
131query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) "
132query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0"
133echo $query
134mysql --defaults-file=$sqlpw -s -e "$query"
135
Note: See TracBrowser for help on using the repository browser.