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

Last change on this file since 19161 was 19019, checked in by Daniela Dorner, 6 years ago
added and updated reference values and formula for corrected R750
  • Property svn:executable set to *
File size: 3.1 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.2 #82
90 )
91
92for (( i=0; i < ${#rates[@]} ; i++))
93do
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"
103done
104
105# several periods are split:
106# 71b
107query="UPDATE RunInfo SET fR750Ref=250.0 WHERE fPeriod=69 AND fNight>20170726"
108mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
109# 69b
110query="UPDATE RunInfo SET fR750Ref=253.0 WHERE fPeriod=69 AND fNight>20170524"
111mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
112# 60a
113query="UPDATE RunInfo SET fR750Ref=239.3 WHERE fPeriod=60 AND fNight<20170901"
114mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
115# 46a
116query="UPDATE RunInfo SET fR750Ref=271 WHERE fPeriod=46 AND fNight<20150716"
117mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
118# 24b
119query="UPDATE RunInfo SET fR750Ref=286.2 WHERE fPeriod=24 AND fNight>20131003"
120mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
121
122zd="cos(fZenithDistanceMean/180*Pi())"
123min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60"
124cor="pow("$zd", 1.94)*exp((1-1/"$zd")*0.331)*exp(2.39*(1-"$zd"))"
125
126# fill corrected R750
127query="UPDATE RunInfo SET "
128query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) "
129query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0"
130echo $query
131mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
132
Note: See TracBrowser for help on using the repository browser.