#!/usr/bin/env tcsh

cd /disks/themisdata/qa/state15/autoprocess/

source themis_cshrc

#Parse big ASCII
################

foreach name (`find /home/bfds/THEMIS/THEMIS_?/THEMIS* -name '*EPHDEF60*'`)
 
 rm shell_big2smallascii.bm
 echo ' ' > shell_big2smallascii.bm

 set line="bigascii2smallascii,'$name'"
 echo $line
 echo $line >> shell_big2smallascii.bm

 echo exit >> shell_big2smallascii.bm

 idl shell_big2smallascii.bm


 #ASCII to CDF
 #############

 rm shell_ascii2cdf.bm

 echo "@compile_cdaweb" > shell_ascii2cdf.bm
 echo "@compile_IDLmakecdf" >> shell_ascii2cdf.bm

 foreach name (`find /disks/themisdata/qa/state15/ASCII/ -name '*EPHDEF.txt'`)
 set line="make_probe_state_cdf,'$name',version=2"
 echo $line
 echo $line >> shell_ascii2cdf.bm
 end

 echo exit >> shell_ascii2cdf.bm

 idl shell_ascii2cdf.bm

 rm -f /disks/themisdata/qa/state15/ASCII/*EPHDEF.txt

end

touch /disks/themisdata/qa/state15/autoprocess/timestamp_record.txt

mv *.cdf ../CDF

