Changeset 20031 for trunk/Mars/hawc/processing/extract-aux-data.sh
- Timestamp:
- 01/07/21 14:38:53 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/processing/extract-aux-data.sh
r20030 r20031 1 1 #!/bin/bash 2 3 # Specify the telescope for which to run the script. Replace '1' 4 # by $1 if the telesocpe number is supplied as an option to the script 5 TELESCOPE=1 2 6 3 7 # The base directory of the aux-files … … 7 11 # The path (relative to your Mars/build directory where the processing macros are stored 8 12 MACROS=../hawc/processing 13 # File to which the queries are written 14 OUTPUT="insert-aux.sql" 9 15 10 16 # Open the query-file with the create table statement … … 13 19 CREATE TABLE AuxData 14 20 ( 21 Telescope TINYINT UNSIGNED NOT NULL, 15 22 NIGHT INT UNSIGNED NOT NULL, 16 23 RUNID MEDIUMINT UNSIGNED NOT NULL, … … 48 55 RateSum0 FLOAT, 49 56 RateSum1 FLOAT, 50 PRIMARY KEY( NIGHT, RUNID)57 PRIMARY KEY(Telescope, NIGHT, RUNID) 51 58 ) 52 59 SELECT * FROM 53 60 ( VALUES 54 "\ > insert-data.sql61 "\ > ${OUTPUT} 55 62 56 63 # Get all available runs and their start and stop time … … 61 68 NIGHT, RUNID, TSTARTI+TSTARTF, TSTOPI+TSTOPF 62 69 FROM 63 RawData\ 70 RawData 71 WHERE 72 Telescope=${TELESCOPE}\ 64 73 "\ 65 74 | mysql \ … … 129 138 130 139 # Write the result as one row to the query file 131 echo "/* "${FNAME}" */" >> insert-data.sql132 echo "ROW(" >> insert-data.sql133 echo " "${ NIGHT}, ${RUNID}, >> insert-data.sql134 echo " "${DRS_TEMP}, >> insert-data.sql135 echo " "${BIAS_DATA}, >> insert-data.sql136 echo " "${FTU_DATA}, >> insert-data.sql137 echo " "${FTM_DATA} >> insert-data.sql138 echo ")," >> insert-data.sql140 echo "/* "${FNAME}" */" >> ${OUTPUT} 141 echo "ROW(" >> ${OUTPUT} 142 echo " "${TELESCOPE], ${NIGHT}, ${RUNID}, >> ${OUTPUT} 143 echo " "${DRS_TEMP}, >> ${OUTPUT} 144 echo " "${BIAS_DATA}, >> ${OUTPUT} 145 echo " "${FTU_DATA}, >> ${OUTPUT} 146 echo " "${FTM_DATA} >> ${OUTPUT} 147 echo ")," >> ${OUTPUT} 139 148 140 149 done … … 144 153 AS 145 154 ( 146 NIGHT, RUNID,155 Telescope, NIGHT, RUNID, 147 156 TavgDRS, TrmsDRS, 148 157 Umed, Uavg, Udev, Urms, … … 156 165 RateSum0, RateSum1 157 166 )\ 158 " >> insert-data.sql167 " >> ${OUTPUT}
Note:
See TracChangeset
for help on using the changeset viewer.