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

Last change on this file since 19007 was 18939, checked in by Daniela Dorner, 7 years ago
updated correction formula and reference values for periods
  • Property svn:executable set to *
File size: 2.5 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.7 # 7
15 261.2 # 8
16 267.9 # 9
17 287.0 #10
18 251.3 #11
19 251.3 #12
20 237.7 #13
21 246.6 #14
22 243.4 #15
23 267.9 #16
24 249.4 #17
25 254.8 #18
26 261.5 #19
27 274.2 #20
28 264.5 #21
29 228.9 #22
30 255.1 #23
31 269.0 #24
32 281.9 #25
33 271.4 #26
34 270.5 #27
35 267.9 #28
36 0.0 #29
37 246.9 #30
38 246.9 #31
39 282.8 #32
40 282.7 #33
41 272.0 #34
42 261.1 #35
43 256.0 #36
44 273.6 #37
45 273.2 #38
46 280.8 #39
47 282.9 #40
48 286.7 #41
49 290.7 #42
50 275.5 #43
51 276.1 #44
52 267.2 #45
53 246.9 #46b
54 248.1 #47
55 246.2 #48
56 253.3 #49
57 265.1 #50
58 266.2 #51
59 264.7 #52
60 257.6 #53
61 244.9 #54
62 244.7 #55
63 239.6 #56
64 244.6 #57
65 242.6 #58
66 237.1 #59
67 247.3 #60b
68 245.5 #61
69 260.3 #62
70 258.7 #63
71 248.7 #64
72 248.2 #65
73 245.9 #66
74 235.9 #67
75 233.2 #68
76 287.2 #69
77 243.1 #70
78 231.4 #71
79 237.8 #72
80 222.3 #73
81 214.0 #74
82 244.0 #75
83 249.6 #76
84 253.4 #77
85 0.0 #78
86 )
87
88for (( i=0; i < ${#rates[@]} ; i++))
89do
90 if [ "${rates[$i]}" = "0.0" ]
91 then
92 rate="NULL"
93 else
94 rate=${rates[$i]}
95 fi
96 query="UPDATE RunInfo SET fR750Ref="$rate" WHERE fPeriod="$i
97 echo $query
98 mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
99done
100
101# periods 42 and 60 are split:
102# 60a
103query="UPDATE RunInfo SET fR750Ref=237.1 WHERE fPeriod=60 AND fNight<20170901"
104mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
105# 46a
106query="UPDATE RunInfo SET fR750Ref=271 WHERE fPeriod=46 AND fNight<20150716"
107mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
108
109zd="cos(fZenithDistanceMean/180*Pi())"
110min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60"
111cor="pow("$zd", 1.091)*exp((1-1/"$zd")*0.593)*exp(1.829*(1-"$zd"))"
112
113# fill corrected R750
114query="UPDATE RunInfo SET "
115query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) "
116query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0"
117echo $query
118mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query"
119
Note: See TracBrowser for help on using the repository browser.