1 |
#! /bin/csh -f |
2 |
# Script to make HMI lev1.5 observables from HMI lev1 data |
3 |
# |
4 |
# this is run in the task instance directory where there is a 'ticket' file that specifies |
5 |
# the request. |
6 |
|
7 |
# XXXXXXXXXX test |
8 |
# set echo |
9 |
# XXXXXXXXXX test |
10 |
|
11 |
set HERE = $cwd |
12 |
|
13 |
if ($?WORKFLOW_ROOT) then |
14 |
set WFDIR = $WORKFLOW_DATA |
15 |
set WFCODE = $WORKFLOW_ROOT |
16 |
else |
17 |
echo Need WORKFLOW_ROOT variable to be set. |
18 |
exit 1 |
19 |
endif |
20 |
|
21 |
foreach ATTR (WANTLOW WANTHIGH GATE) |
22 |
set ATTRTXT = `grep $ATTR ticket` |
23 |
set $ATTRTXT |
24 |
end |
25 |
|
26 |
set product = `cat $WFDIR/gates/$GATE/product` |
27 |
set key = `cat $WFDIR/gates/$GATE/key` |
28 |
|
29 |
# set HMIprogram = /home/couvidat/cvs/JSOC/bin/linux_x86_64/HMI_observables |
30 |
# copied 23 Oct 2010 2:38 PM |
31 |
set HMIprogram = $WFCODE/bin/HMI_observables |
32 |
set MAKEIMAGES = "$WFCODE/scripts/makeimageslowhigh" |
33 |
|
34 |
# note in Sebastien's code camera=1 is front camera, where CAMERA=2. |
35 |
set camera = 1 |
36 |
set nrt = 1 |
37 |
set cadence = 45 |
38 |
set input = hmi.lev1c_nrt |
39 |
#set otherargs = "levin="lev1" levout="lev15" wavelength=3 dpath=/home/couvidat/cvs/JSOC/proj/lev1.5_hmi/apps" |
40 |
set otherargs = "levin="lev1" levout="lev15" wavelength=3" |
41 |
|
42 |
# align times in format for HMIprogram |
43 |
|
44 |
# round times to a slot |
45 |
set indexlow = `index_convert ds=$product $key=$WANTLOW` |
46 |
set indexhigh = `index_convert ds=$product $key=$WANTHIGH` |
47 |
@ indexhigh = $indexhigh - 1 |
48 |
set wantlow = `index_convert ds=$product $key"_index"=$indexlow` |
49 |
set wanthigh = `index_convert ds=$product $key"_index"=$indexhigh` |
50 |
# make qsub name from index from door opening |
51 |
set indexbase = `index_convert ds=$product $key=2010.03.24_TAI` |
52 |
@ qsubname = $indexhigh - $indexbase |
53 |
|
54 |
if ($indexhigh < $indexlow) then |
55 |
echo No data to process, $WANTLOW to $WANTHIGH > $HERE/runlog |
56 |
exit 0 |
57 |
endif |
58 |
|
59 |
set TEMPLOG = $HERE/runlog |
60 |
set babble = $HERE/babble |
61 |
set TEMPCMD = $HERE/LOS.$qsubname |
62 |
echo 6 > $HERE/retstatus |
63 |
|
64 |
# make qsub script |
65 |
echo "#! /bin/csh -f " >$TEMPCMD |
66 |
echo "setenv OMP_NUM_THREADS 8" >>$TEMPCMD |
67 |
echo "cd $HERE" >>$TEMPCMD |
68 |
echo "hostname >>&$TEMPLOG" >>$TEMPCMD |
69 |
echo "$HMIprogram lev1=$input quicklook=$nrt camid=$camera cadence=$cadence $otherargs begin="$wantlow" end="$wanthigh" >>&$TEMPLOG" >>$TEMPCMD |
70 |
echo 'set retstatus = $?' >>$TEMPCMD |
71 |
echo 'echo $retstatus >' "$HERE/retstatus" >>$TEMPCMD |
72 |
# echo 'if ($retstatus == 0) then' >>$TEMPCMD |
73 |
# echo " echo XXXX Start image processing" >>$TEMPCMD |
74 |
# echo " $MAKEIMAGES $wantlow $wanthigh" >>$TEMPCMD |
75 |
# echo "endif" >> $TEMPCMD |
76 |
echo "rm -f $HERE/qsub_running" >>$TEMPCMD |
77 |
|
78 |
# execute qsub script |
79 |
touch $HERE/qsub_running |
80 |
qsub -e $TEMPLOG -o $TEMPLOG -q j8.q $TEMPCMD |
81 |
endif |
82 |
|
83 |
set waitcount=0 |
84 |
while (-e $HERE/qsub_running) |
85 |
sleep 10 |
86 |
@ waitcount = $waitcount + 1 |
87 |
if ($waitcount > 720) then |
88 |
echo "timed out after 2 hours" >$HERE/FailMessage |
89 |
set retstatus = 5 |
90 |
exit $retstatus |
91 |
endif |
92 |
echo -n '+' >>$babble |
93 |
end |
94 |
|
95 |
set retstatus = `cat $HERE/retstatus` |
96 |
exit $retstatus |