Changeset 19424 for trunk/DataCheck/Tools
- Timestamp:
- 01/08/19 14:28:21 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Tools/fill_r750.sh
r19422 r19424 1 1 #!/bin/bash 2 2 3 # setup 3 4 sqlpw=/home/$USER/.mysql.pw.op 4 5 dbname=factdata 6 # fill only corrected R750 7 short="yes" # comment line to fill also reference values 8 9 # setup for zd- and th-correction: 10 zd="cos(fZenithDistanceMean/180*Pi())" 11 min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60" 12 cor="pow("$zd", 1.94)*exp((1-1/"$zd")*0.331)*exp(2.39*(1-"$zd"))" 13 14 # fill corrected R750 15 echo "" 16 echo "Filling the corrected R750 to the DB..." 17 query="UPDATE RunInfo SET " 18 query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) " 19 query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0" 20 echo $query 21 mysql --defaults-file=$sqlpw -s -e "$query" 22 23 # todo: replace this by trigger in DB (finalize correction formula for this) 24 25 if [ "$short" == "yes" ] 26 then 27 echo "" 28 echo "Exit (short=yes)" 29 exit 30 fi 31 5 32 6 33 # reference values for corrected R750 … … 97 124 ) 98 125 126 # fill reference values 127 echo "" 128 echo "Filling the reference values for the corrected R750 for "${#rates[@]}" periods to the DB..." 99 129 for (( i=0; i < ${#rates[@]} ; i++)) 100 130 do … … 106 136 fi 107 137 query="UPDATE RunInfo SET fR750Ref="$rate" WHERE fPeriod="$i 108 echo $query138 #echo $query 109 139 mysql --defaults-file=$sqlpw -u operator -h 10.0.100.21 $dbname -s -e "$query" 110 140 done 111 141 112 142 # several periods are split: 143 # update the values for those 113 144 # 71b 114 145 query="UPDATE RunInfo SET fR750Ref=250.0 WHERE fPeriod=71 AND fNight>20170726" … … 127 158 mysql --defaults-file=$sqlpw -s -e "$query" 128 159 129 zd="cos(fZenithDistanceMean/180*Pi())"130 min="TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn/60"131 cor="pow("$zd", 1.94)*exp((1-1/"$zd")*0.331)*exp(2.39*(1-"$zd"))"132 160 133 # fill corrected R750 134 query="UPDATE RunInfo SET " 135 query=$query" fR750Cor=round(fNumThreshold750/("$min")/("$cor"),2) " 136 query=$query" WHERE fRunTypeKey=1 AND NOT (("$min")/("$cor"))=0" 137 echo $query 138 mysql --defaults-file=$sqlpw -s -e "$query" 161 echo "" 162 echo "Done" 139 163
Note:
See TracChangeset
for help on using the changeset viewer.