![]() ![]() |
![]() |
File: [Development] / JSOC / proj / globalhs / scripts / doshtcheck
(download)
Revision: 1.12, Wed Jun 18 17:44:36 2014 UTC (8 years, 11 months ago) by tplarson Branch: MAIN CVS Tags: Ver_8-5 Changes since 1.11: +1 -1 lines add MEMUSE=1 to jretile call |
#! /bin/tcsh -f # script to check output of sht. setenv PATH $JSOCROOT/bin/$JSOC_MACHINE':'$JSOCROOT/proj/globalhs/scripts':'$PATH @ i = 1 while ($i <= $#argv ) set $argv[$i] @ i++ end if (! $?starttime) then echo must specify parameter starttime exit 1 endif if (! $?totaltime) then echo must specify parameter totaltime exit 1 endif set totalsecs = `durcon $totaltime` if ($status) then echo incorrect format for parameter totaltime exit 1 endif if (! $?lchunk) then echo must specify parameter lchunk exit 1 endif if (! $?lmin) set lmin = 0 if (! $?lmax) set lmax = 300 date echo $PWD echo $0 $argv if (! -es v2t.parms.blank) then echo parameter file blank missing: v2t.parms.blank is required exit 1 endif grep -v "^[[:space:]]*#" v2t.parms.blank | sed s@"[[:space:]]"@"\n"@g | grep -v '^[[:space:]]*$' > parms.tmp grep "^[[:space:]]*##" v2t.parms.blank | awk -F '##' '{print $2}' > script.parms set vars = `cat script.parms` @ i = 1 while ($i <= $#vars ) set $vars[$i] @ i++ end set out = `cat parms.tmp | grep ^tsout= | cut -d= -f2` set epoch = `show_info -j $out | grep -i '^keyword:t_start_epoch' | cut -d, -f5` set epochsecs = `time_convert o=jsoc time=$epoch` set cadence = `show_info -j $out | grep -i '^keyword:t_step' | cut -d, -f5` durcon $starttime >& /dev/null if ($status) then set startsecs = `time_convert o=jsoc time=$starttime` set firstday = `echo "($startsecs - $epochsecs)/86400" | bc` else set startsecs = `durcon $starttime` set firstday = `echo "$startsecs / 86400" | bc` set startsecs = `echo "$startsecs + $epochsecs" | bc` endif set start = `time_convert o=cal zone=tai s=$startsecs` set endsecs = `echo "$startsecs + $totalsecs - $cadence" | bc` set end = `time_convert o=cal zone=tai s=$endsecs` @ lchunkfirst = $lmin / $lchunk @ lchunklast = $lmax / $lchunk @ nlc = ($lchunklast - $lchunkfirst) + 1 set in = `cat parms.tmp | grep ^in= | sed s/\'//g | sed s/\"//g | awk -F '[=[]' '{print $2}'` set tchunk = `cat parms.tmp | grep TCHUNK= | cut -d= -f2` set clauselist = `cat parms.tmp | grep ^in= | cut -d= -f2- | sed s@"\["@"\n"@g | sed s@]@"\n"@g | grep =` show_coverage -iq ds=$in low=$start high=$end block=$tchunk $clauselist > coverage.txt set ntimes = `cat coverage.txt | wc -l` set nmiss = `cat coverage.txt | awk -v total=0 '$2 == 0 {total+=1} END {print total}'` @ nexpected = ($ntimes - $nmiss) * $nlc set chunksecs = `durcon $tchunk` set ndt = `echo "$chunksecs / $cadence" | bc` set tagclause = `cat parms.tmp | grep TAG=` # calculate first llast @ lfirst = $lchunkfirst * $lchunk @ llast = $lfirst + $lchunk - 1 if ($llast > $lmax) set llast = $lmax #calculate last lfirst @ lfirst = $lchunklast * $lchunk if ($lfirst < $lmin) set lfirst = $lmin set outrecset = $out'['$starttime/$totaltime']['$lmin-$lfirst']['$llast-$lmax']['$ndt']['$tagclause']' show_info "$outrecset" -APiR >& shtout.tmp if (`grep -c "/SUM.*/data\.fits" shtout.tmp` != $nexpected) then echo failure of sht for starttime = $starttime, totaltime = $totaltime : some outputs missing exit 1 endif @ lfirst = $lchunkfirst * $lchunk @ llast = $lfirst + $lchunk - 1 if ($lfirst < $lmin) set lfirst = $lmin if ($llast > $lmax) set llast = $lmax set inrecset = $out'['$starttime/$totaltime']['$lfirst']['$llast']['$ndt']['$tagclause']' jretile in="$inrecset" out=$scratch LMIN=$lmin LMAX=$lmin LCHUNK=1 TTOTAL=$totaltime TCHUNK=$totaltime TSTART=$start MEMUSE=1 >& lzero.log if ($status != 0 || `grep -c "ERROR" lzero.log` != 0) then echo problem retiling l=$lmin echo check lzero.log exit 1 endif set ndt = `echo "$totalsecs / $cadence" | bc` set file = `show_info $scratch"[$starttime][$lmin][$lmin][$ndt][$tagclause]" -APq` set idlfile=check1.idl if (`echo $sourcetype | grep -c mdi`) then cat > $idlfile << EOF x1=mklzero($firstday,$ndt,$cadence,ref='$lzeroref') q2=fitsio_read_image('$file') q2=q2[*,0] nx=n_elements(q2)/2 if (nx ne $ndt) then exit ix=2*lindgen(nx) x2=q2[ix] g1=fltarr(nx) g2=fltarr(nx) w1=where(finite(x1) and x1 ne 0) w2=where(finite(x2) and x2 ne 0) g1[w1]=1 g2[w2]=1 print,histogram(g1+2*g2,min=0) EOF endif if ($sourcetype == hmi) then # set inrecset = `cat v2t.parms.blank | grep in= | cut -d'=' -f 2 | sed s@XXXX@"$starttime/$totaltime"@ | sed s/"'"/""/g` # show_info -q "$inrecset" key=quality > quality.txt cat > $idlfile << EOF q2=fitsio_read_image('$file') q2=q2[*,0] nx=n_elements(q2)/2 if (nx ne $ndt) then exit spawn,'cat ../quality.txt',hexwords qual=lonarr(nx) reads,hexwords,qual,format='(z)' ix=2*lindgen(nx) x2=q2[ix] gq=fltarr(nx) g2=fltarr(nx) wq=where(qual ge 0) w2=where(finite(x2) and x2 ne 0) gq[wq]=1 g2[w2]=1 print,histogram(gq+2*g2,min=0) EOF endif set test=`idl < $idlfile` echo histogram: $test if ($#test != 4 || $test[2] != 0 || $test[3] > 2) then echo comparison with previous timeseries fails exit 1 endif echo successful completion rm script.parms lzero.log parms.tmp coverage.txt exit 0
Karen Tian |
Powered by ViewCVS 0.9.4 |